|
VR-Engage
2.3
|
This class manages the terrain being inserted into the Vortex universe, maintaining a collection of paged cells with collision geometries. It also handles dynamic terrain within Vortex.
#include <vortexPagedTerrainProducer.h>
Classes | |
| struct | PagedCell |
Public Types | |
| using | PagedCells = std::unordered_map<int, PagedCell*> |
Public Member Functions | |
| DtVortexPagedTerrainProducer () | |
| virtual | ~DtVortexPagedTerrainProducer () override |
| virtual void | preStep () override |
| void | insertTerrain (int sourceId, int requestId, VxMath::BoundingBox requestBounds, Vx::VxCollisionGeometry *cg) |
| void | insertTerrain (int sourceId, int requestId) |
| PagedCell * | getPagedCellForSourceID (int sourceId) |
| PagedCells | getPagedCells () |
| virtual std::vector< Vx::VxCollisionGeometry * > | getAllCollisionGeometries () |
| bool | isTerrainAvailable (const VxMath::Vector3 &inputCords) |
| void | setTerrainCellSize (double cellSize) |
| double | getTerrainCellSize () const |
Protected Member Functions | |
| virtual void | _initialize () override |
Protected Attributes | |
| double | myPagedTerrainCellSize |
| PagedCells | myPagedCells |
| tbb::spin_mutex | myInsertMutex |
| std::shared_ptr< bool > | myAlive |
| using makVre::DtVortexPagedTerrainProducer::PagedCells = std::unordered_map<int, PagedCell*> |
Map type for storing paged cells indexed by source ID.
| makVre::DtVortexPagedTerrainProducer::DtVortexPagedTerrainProducer | ( | ) |
Constructor.
Initializes a new terrain producer with default settings.
|
overridevirtual |
Destructor.
Cleans up terrain cells and resources.
|
overridevirtual |
Performs pre-step operations.
Gets collision geometries of parts, maps terrain requests, and sets request priorities before stepping. Also manages the PagedCells being tracked.
| void makVre::DtVortexPagedTerrainProducer::insertTerrain | ( | int | sourceId, |
| int | requestId, | ||
| VxMath::BoundingBox | requestBounds, | ||
| Vx::VxCollisionGeometry * | cg ) |
Inserts terrain with new collision geometry.
Adds the specified parts and collision geometries to the area of a given request with the received source ID. Use when the terrain element is not already present. Also inserts this into the myPagedCells map.
| sourceId | Source ID to link this collision geometry to |
| requestId | Request ID to link this collision geometry to |
| requestBounds | Request bounds of this terrain request |
| cg | Collision geometry to insert |
| void makVre::DtVortexPagedTerrainProducer::insertTerrain | ( | int | sourceId, |
| int | requestId ) |
Inserts terrain with existing source ID.
Calls default insertTerrain where a request ID shares the same source ID as another request.
| sourceId | Source ID to link this collision geometry to |
| requestId | Request ID to link this collision geometry to |
| PagedCell * makVre::DtVortexPagedTerrainProducer::getPagedCellForSourceID | ( | int | sourceId | ) |
Gets the paged cell for a source ID.
| sourceId | The source ID to look up |
| PagedCells makVre::DtVortexPagedTerrainProducer::getPagedCells | ( | ) |
Gets all paged cells.
|
virtual |
Gets all collision geometries.
| bool makVre::DtVortexPagedTerrainProducer::isTerrainAvailable | ( | const VxMath::Vector3 & | inputCords | ) |
Checks if terrain is available below coordinates.
| inputCords | Position to check for terrain |
| void makVre::DtVortexPagedTerrainProducer::setTerrainCellSize | ( | double | cellSize | ) |
Sets the terrain cell size.
| cellSize | The new cell size in meters |
| double makVre::DtVortexPagedTerrainProducer::getTerrainCellSize | ( | ) | const |
Gets the terrain cell size.
|
overrideprotectedvirtual |
Initializes the paged terrain producer.
Internal method called during initialization.
|
protected |
Size of terrain cells in meters.
|
protected |
Map of all paged cells by source ID.
|
protected |
Mutex for thread-safe insertion.
|
protected |
Alive token captured by value into VxCollisionGeometry destruction callbacks. Cleared in the destructor so callbacks that fire after this producer has been torn down (e.g. CGs still refcounted elsewhere) can detect the dangling case and skip touching this instance.