|
VR-Engage
2.2
|
This class is responsible for handling dynamic terrain modifications in VR-Forces and translating them to the Vortex physics engine. It processes terrain change notifications, identifies affected terrain cells, and schedules regeneration of collision geometries to reflect the terrain changes.
#include <vortexDynamicTerrainHandler.h>
Public Types | |
| using | DynamicTerrainRequestMap = tbb::concurrent_unordered_map<int, Vx::VxTriangleMeshBVTree*> |
Public Member Functions | |
| DtVortexDynamicTerrainHandler (DtVortexPhysicalWorld *physicalWorld) | |
| virtual | ~DtVortexDynamicTerrainHandler () |
| void | registerDynamicTerrainHandler () |
| void | unregisterDynamicTerrainHandler () |
| virtual void | swapDynamicTerrainRequests (DynamicTerrainRequestMap &reqMap) |
| virtual bool | doBoxesIntersect (const VxMath::BoundingBox &firstBB, const VxMath::BoundingBox &secondBB) const |
| virtual bool | newRequestsAvailable () const |
| virtual void | reset () |
Protected Member Functions | |
| virtual void | processTerrainChangeNotification (const DtTerrainChangeNotificationInfo &terrainChangeInfo) |
Static Protected Member Functions | |
| static void | terrainChangeNotification (const DtTerrainChangeNotificationInfo &terrainChangeInfo, void *usr) |
Protected Attributes | |
| DtVortexPhysicalWorld * | myPhysicalWorld |
| DynamicTerrainRequestMap | myDynamicTerrainRequests |
| using makVre::DtVortexDynamicTerrainHandler::DynamicTerrainRequestMap = tbb::concurrent_unordered_map<int, Vx::VxTriangleMeshBVTree*> |
Map type for tracking dynamic terrain modification requests.
Maps terrain cell source IDs to new triangle meshes that need to be applied.
|
explicit |
Constructor.
Initializes the dynamic terrain handler with a reference to the Vortex physical world. Only the physical world should create this handler.
| physicalWorld | Pointer to the Vortex physical world that owns this handler |
|
virtual |
Destructor.
| void makVre::DtVortexDynamicTerrainHandler::registerDynamicTerrainHandler | ( | ) |
Registers this handler with the terrain system.
Connects to the terrain change notification callback in the terrain interface to receive notifications when terrain is modified.
| void makVre::DtVortexDynamicTerrainHandler::unregisterDynamicTerrainHandler | ( | ) |
Unregisters this handler from the terrain system.
Disconnects from the terrain change notification callback, stopping the processing of terrain modifications.
|
virtual |
Swaps the internal dynamic terrain request map with the provided map.
Used to safely extract pending terrain modification requests for processing. The provided map is typically empty before the call and contains all pending requests after the call.
| reqMap | Map to swap with the internal request map |
|
virtual |
Checks if two bounding boxes intersect.
Determines if two Vortex bounding boxes overlap in 3D space. Used to identify which terrain cells are affected by a terrain modification.
| firstBB | First bounding box to check |
| secondBB | Second bounding box to check |
|
virtual |
Checks if new terrain modification requests are available.
|
virtual |
Resets all pending terrain modification requests.
Clears all pending terrain modification requests and performs cleanup. This is typically called when the scenario is reset or a new terrain is loaded.
|
staticprotected |
Static callback function for terrain change notifications.
This static function is registered with the terrain interface and forwards terrain change notifications to the appropriate instance.
| terrainChangeInfo | Information about the terrain change |
| usr | Pointer to the DtVortexDynamicTerrainHandler instance |
|
protectedvirtual |
Processes a terrain change notification.
Identifies terrain cells affected by the terrain change and creates requests for regenerating their collision geometries. The affected cells are determined by checking for intersection between the terrain change bounding box and the cell bounding boxes.
| terrainChangeInfo | Information about the terrain change |
|
protected |
Pointer to the Vortex physical world.
|
protected |
Map of pending terrain modification requests.