VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVortexDynamicTerrainHandler Class Reference

Detailed Description

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

DtVortexPhysicalWorldmyPhysicalWorld
 
DynamicTerrainRequestMap myDynamicTerrainRequests
 

Member Typedef Documentation

◆ DynamicTerrainRequestMap

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.

Constructor & Destructor Documentation

◆ DtVortexDynamicTerrainHandler()

makVre::DtVortexDynamicTerrainHandler::DtVortexDynamicTerrainHandler ( DtVortexPhysicalWorld * physicalWorld)
explicit

Constructor.

Initializes the dynamic terrain handler with a reference to the Vortex physical world. Only the physical world should create this handler.

Parameters
physicalWorldPointer to the Vortex physical world that owns this handler

◆ ~DtVortexDynamicTerrainHandler()

virtual makVre::DtVortexDynamicTerrainHandler::~DtVortexDynamicTerrainHandler ( )
virtual

Destructor.

Member Function Documentation

◆ registerDynamicTerrainHandler()

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.

◆ unregisterDynamicTerrainHandler()

void makVre::DtVortexDynamicTerrainHandler::unregisterDynamicTerrainHandler ( )

Unregisters this handler from the terrain system.

Disconnects from the terrain change notification callback, stopping the processing of terrain modifications.

◆ swapDynamicTerrainRequests()

virtual void makVre::DtVortexDynamicTerrainHandler::swapDynamicTerrainRequests ( DynamicTerrainRequestMap & reqMap)
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.

Parameters
reqMapMap to swap with the internal request map

◆ doBoxesIntersect()

virtual bool makVre::DtVortexDynamicTerrainHandler::doBoxesIntersect ( const VxMath::BoundingBox & firstBB,
const VxMath::BoundingBox & secondBB ) const
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.

Parameters
firstBBFirst bounding box to check
secondBBSecond bounding box to check
Returns
True if the boxes intersect, false otherwise

◆ newRequestsAvailable()

virtual bool makVre::DtVortexDynamicTerrainHandler::newRequestsAvailable ( ) const
virtual

Checks if new terrain modification requests are available.

Returns
True if there are pending terrain modification requests, false otherwise

◆ reset()

virtual void makVre::DtVortexDynamicTerrainHandler::reset ( )
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.

◆ terrainChangeNotification()

static void makVre::DtVortexDynamicTerrainHandler::terrainChangeNotification ( const DtTerrainChangeNotificationInfo & terrainChangeInfo,
void * usr )
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.

Parameters
terrainChangeInfoInformation about the terrain change
usrPointer to the DtVortexDynamicTerrainHandler instance

◆ processTerrainChangeNotification()

virtual void makVre::DtVortexDynamicTerrainHandler::processTerrainChangeNotification ( const DtTerrainChangeNotificationInfo & terrainChangeInfo)
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.

Parameters
terrainChangeInfoInformation about the terrain change

Member Data Documentation

◆ myPhysicalWorld

DtVortexPhysicalWorld* makVre::DtVortexDynamicTerrainHandler::myPhysicalWorld
protected

Pointer to the Vortex physical world.

◆ myDynamicTerrainRequests

DynamicTerrainRequestMap makVre::DtVortexDynamicTerrainHandler::myDynamicTerrainRequests
protected

Map of pending terrain modification requests.


The documentation for this class was generated from the following file: