22#include <vrfobjcore/simObjectReference.h>
26#include <VxTerrain/VxPagedTerrainInterface.h>
28#include <VxMath/VxMath.h>
29#include <VxMath/BoundingBox.h>
34#include <tbb/concurrent_vector.h>
35#include <tbb/task_arena.h>
36#include <tbb/spin_mutex.h>
39class DtTerrainImplementation;
43class VxPagedTerrainProducer;
48class VxCollisionGeometry;
50class VxTriangleMeshUVGrid;
51class VxTriangleMeshBVTree;
119 std::vector<DtSimObjectReference>
143 virtual void step(VxTerrain::VxPagedTerrainProducer* producer)
override;
152 virtual void produce(
const std::vector<VxTerrain::VxTerrainRequest>& request,
153 VxTerrain::VxPagedTerrainProducer* producer)
override;
162 virtual void update(
const std::vector<VxTerrain::VxTerrainRequest>& request,
163 VxTerrain::VxPagedTerrainProducer* producer)
override;
269 Vx::VxTriangleMeshBVTree* triMeshParam =
nullptr);
279 virtual void buildTriangleMesh(
const std::shared_ptr<DtVortexTriangleOutputInterface> outputInterface,
280 Vx::VxTriangleMeshBVTree* triMesh);
314 const Vx::VxTriangleMeshBVTree* newMesh,
316 double tolerance = 0.1);
329 Vx::VxTriangleMeshBVTree* meshOne, Vx::VxTriangleMeshBVTree* meshTwo,
double tolerance = 0.1);
345 std::shared_ptr<DtSurfaceToVxMaterialMapper>
Manages dynamic terrain events and updates in the Vortex physics engine.
Definition vortexDynamicTerrainHandler.h:52
void fixTriangleMeshOrphanEdges(Vx::VxTriangleMeshBVTree *triMesh)
Sets the orphan edges of the triangle mesh to not have an invalid angle between meshes.
virtual void queueNewTerrainRequests(const std::vector< VxTerrain::VxTerrainRequest > &requests)
Sort the incoming requests to have the highest priority ones first.
virtual void resetDynamicTerrain()
Discards dynamic terrain work created for the current Vortex application.
tbb::concurrent_vector< VortexCellToInsert > myCellsToInsert
Cells to insert on the next update.
Definition vortexPagedTerrain.h:360
virtual std::shared_ptr< DtSurfaceToVxMaterialMapper > materialMapper() const
Gets the material mapper.
virtual void processQueuedCollisionGeometries()
Helper function for processing queued collision geometries.
std::list< VortexNewTerrainRequest > NewTerrainRequestQueue
Definition vortexPagedTerrain.h:80
virtual void processNewTerrainRequest(VxTerrain::VxTerrainRequest req, Vx::VxTriangleMeshBVTree *triMesh=nullptr)
Processes a terrain request and builds a collision geometry for Vortex.
virtual void queueTerrainRegenerationRequests()
Queues up and manages any new dynamic terrain or terrain regeneration requests.
DtVortexPhysicalWorld * myPhysicalWorld
Pointer to the physical world.
Definition vortexPagedTerrain.h:340
virtual void step(VxTerrain::VxPagedTerrainProducer *producer) override
Called every frame from within the vortex application while running.
virtual void buildTriangleMesh(const std::shared_ptr< DtVortexTriangleOutputInterface > outputInterface, Vx::VxTriangleMeshBVTree *triMesh)
Fills out a triangle mesh based on all the triangles from the output interface.
double myDynamicTerrainRegenerationRetryInterval
Interval for retrying dynamic terrain regeneration.
Definition vortexPagedTerrain.h:351
std::shared_ptr< DtSurfaceToVxMaterialMapper > myMaterialMapper
Material mapper for surface to Vortex material conversion.
Definition vortexPagedTerrain.h:346
virtual void setTerrainHeightToleranceCheck(double val)
Sets the maximum terrain height tolerance check value.
virtual Vx::VxTriangleMeshBVTree * createVortexTriangleMesh(DtVortexTriangleOutputInterface &outputInterface)
Creates a triangle mesh based on the output interface.
virtual bool areTriangleMeshesDifferent(Vx::VxTriangleMeshBVTree *meshOne, Vx::VxTriangleMeshBVTree *meshTwo, double tolerance=0.1)
Compares each triangle from both meshes and checks if they are equal.
virtual double terrainHeightToleranceCheck() const
Gets the maximum terrain height tolerance check value.
unsigned int myInitialTriangleVectorSize
Initial size for triangle vectors.
Definition vortexPagedTerrain.h:353
virtual DtTerrainProcessPolygonsBox getTerrainProcessBox(const Vx::VxBoundingBox &bb)
Gets the terrain process box in terms of geocentric/local terrain.
virtual void setMaterialMapper(std::shared_ptr< DtSurfaceToVxMaterialMapper > val)
Sets the material mapper.
DtVortexPagedTerrainProducer * myTerrainProducer
Pointer to the terrain producer.
Definition vortexPagedTerrain.h:342
NewTerrainRequestQueue myNewTerrainRequests
Queue of new terrain requests.
Definition vortexPagedTerrain.h:359
virtual void produce(const std::vector< VxTerrain::VxTerrainRequest > &request, VxTerrain::VxPagedTerrainProducer *producer) override
Called when new requests for terrain arise.
std::atomic< unsigned int > myDynamicTerrainGeneration
Identifies updates owned by the current application.
Definition vortexPagedTerrain.h:358
tbb::spin_mutex myCellsToModifySwapMutex
Protects swap operation on myCellsToModify (push_back is thread-safe)
Definition vortexPagedTerrain.h:364
virtual Vx::VxCollisionGeometry * createVortexCollisionGeometry(DtVortexTriangleOutputInterface &outputInterface, Vx::VxTriangleMeshBVTree *triMeshParam=nullptr)
Creates a collision geometry based on the vertices and the surface.
double myTerrainHeightToleranceCheck
Height tolerance for terrain checks.
Definition vortexPagedTerrain.h:350
bool myWaitForFutureRequests
Whether to wait for future requests to complete.
Definition vortexPagedTerrain.h:355
virtual void update(const std::vector< VxTerrain::VxTerrainRequest > &request, VxTerrain::VxPagedTerrainProducer *producer) override
Called when pending requests for terrain get higher priority.
tbb::spin_mutex myCellsToInsertSwapMutex
Protects swap operation on myCellsToInsert (push_back is thread-safe)
Definition vortexPagedTerrain.h:363
virtual bool modifyTriangleMesh(Vx::VxTriangleMeshBVTree *currentMesh, const Vx::VxTriangleMeshBVTree *newMesh, const int upAxis, double tolerance=0.1)
Modifies a triangle mesh with z values from a new mesh.
DtVortexPagedTerrainInterface()
Default constructor.
std::weak_ptr< DtVortexDynamicTerrainHandler > myDynamicTerrainHandler
Pointer to the dynamic terrain handler.
Definition vortexPagedTerrain.h:343
virtual int generateSourceID(double minXCoordinate, double minYCoordinate)
Generates a source ID given the minimum x and y coordinate of a request.
virtual bool processTerrainRegenerationRequest(const std::pair< int, Vx::VxTriangleMeshBVTree * > ®enerationData)
Processes all dynamic terrain events that have been queued up for regeneration.
tbb::concurrent_vector< VortexCellToModify > myCellsToModify
Cells to modify on the next step.
Definition vortexPagedTerrain.h:361
DtTerrainImplementation * myTerrainImplementation
Pointer to the terrain implementation.
Definition vortexPagedTerrain.h:341
int myDynamicTerrainRegenerationFailureCount
Maximum number of failures before giving up on regeneration.
Definition vortexPagedTerrain.h:352
std::unique_ptr< tbb::task_arena > myDynamicTerrainTaskArena
Task arena for dynamic terrain processing.
Definition vortexPagedTerrain.h:348
virtual ~DtVortexPagedTerrainInterface() override
Destructor.
Producer that manages terrain in the Vortex physics universe.
Definition vortexPagedTerrainProducer.h:33
Main class responsible for managing the Vortex physics simulation environment.
Definition vortexPhysicalWorld.h:65
Interface for collecting and processing terrain triangles for Vortex.
Definition pagedTerrainRequest.h:83
Export macros for the VR-Forces Vortex extension library.
#define VREVRFVORTEX_DLL
Export macro for non-Windows platforms.
Definition export.h:30
Wheel articulated part IDs used in the system.
Definition surfaceToVxMaterialMapper.h:20
Definition vortexDynamicTerrainHandler.h:36
!
Definition glsVreMessageUtil.h:50
Classes for handling terrain triangle data and requests for the Vortex physics engine.
std::shared_ptr< DtVortexTriangleOutputInterface > newTriangleInterface
Triangle Interface.
Definition vortexPagedTerrain.h:99
VxMath::BoundingBox requestBounds
The bounding box of this request.
Definition vortexPagedTerrain.h:98
Vx::VxTriangleMeshBVTree * newTriangleMesh
The triangle mesh.
Definition vortexPagedTerrain.h:100
VortexCellToInsert()
Default constructor.
~VortexCellToInsert()
Destructor.
int requestId
The request ID associated with the collision geometry.
Definition vortexPagedTerrain.h:117
int sourceId
The source ID this cell collision geometry links to.
Definition vortexPagedTerrain.h:114
Vx::VxCollisionGeometry * collisionGeometry
Legacy non-owning pointer; dynamic updates re-resolve it.
Definition vortexPagedTerrain.h:115
std::vector< DtSimObjectReference > objects
List of objects that will need to be dropped if this is a dynamic terrain event.
Definition vortexPagedTerrain.h:120
unsigned int generation
Dynamic terrain generation that created this update.
Definition vortexPagedTerrain.h:118
Vx::VxTriangleMeshBVTree * newTriangleData
Owned mesh data to apply; cleared after deletion.
Definition vortexPagedTerrain.h:116
VortexCellToModify()
Default constructor.
Data structure for managing new terrain requests from the Vortex Forecaster.
Definition vortexPagedTerrain.h:75
int priority
Priority level of the request.
Definition vortexPagedTerrain.h:77
int requestId
Unique identifier for the request.
Definition vortexPagedTerrain.h:78
std::shared_future< void > future
Future object for asynchronous processing.
Definition vortexPagedTerrain.h:76
Provides mapping functionality between VR-Forces terrain surface types and Vortex physics materials.
Defines the base class for all VREngage messages.