22#include <vrfobjcore/simObjectReference.h>
26#include <VxTerrain/VxPagedTerrainInterface.h>
28#include <VxMath/VxMath.h>
29#include <VxMath/BoundingBox.h>
31#include <tbb/concurrent_vector.h>
32#include <tbb/task_arena.h>
33#include <tbb/spin_mutex.h>
38class DtTerrainImplementation;
42class VxPagedTerrainProducer;
47class VxCollisionGeometry;
49class VxTriangleMeshUVGrid;
50class VxTriangleMeshBVTree;
116 std::vector<DtSimObjectReference>
140 virtual void step(VxTerrain::VxPagedTerrainProducer* producer)
override;
150 const std::vector<VxTerrain::VxTerrainRequest>& request, VxTerrain::VxPagedTerrainProducer* producer)
override;
160 const std::vector<VxTerrain::VxTerrainRequest>& request, VxTerrain::VxPagedTerrainProducer* producer)
override;
271 const std::shared_ptr<DtVortexTriangleOutputInterface> outputInterface, Vx::VxTriangleMeshBVTree* triMesh);
304 virtual bool modifyTriangleMesh(Vx::VxTriangleMeshBVTree* currentMesh,
const Vx::VxTriangleMeshBVTree* newMesh,
305 const int upAxis,
double tolerance = 0.1);
318 Vx::VxTriangleMeshBVTree* meshOne, Vx::VxTriangleMeshBVTree* meshTwo,
double tolerance = 0.1);
334 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.
tbb::concurrent_vector< VortexCellToInsert > myCellsToInsert
Cells to insert on the next update.
Definition vortexPagedTerrain.h:348
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:79
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:329
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:340
std::shared_ptr< DtSurfaceToVxMaterialMapper > myMaterialMapper
Material mapper for surface to Vortex material conversion.
Definition vortexPagedTerrain.h:335
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:342
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:331
NewTerrainRequestQueue myNewTerrainRequests
Queue of new terrain requests.
Definition vortexPagedTerrain.h:347
virtual void produce(const std::vector< VxTerrain::VxTerrainRequest > &request, VxTerrain::VxPagedTerrainProducer *producer) override
Called when new requests for terrain arise.
tbb::spin_mutex myCellsToModifySwapMutex
Protects swap operation on myCellsToModify (push_back is thread-safe)
Definition vortexPagedTerrain.h:352
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:339
bool myWaitForFutureRequests
Whether to wait for future requests to complete.
Definition vortexPagedTerrain.h:344
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:351
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:332
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:349
DtTerrainImplementation * myTerrainImplementation
Pointer to the terrain implementation.
Definition vortexPagedTerrain.h:330
int myDynamicTerrainRegenerationFailureCount
Maximum number of failures before giving up on regeneration.
Definition vortexPagedTerrain.h:341
std::unique_ptr< tbb::task_arena > myDynamicTerrainTaskArena
Task arena for dynamic terrain processing.
Definition vortexPagedTerrain.h:337
virtual ~DtVortexPagedTerrainInterface() override
Destructor.
Producer that manages terrain in the Vortex physics universe.
Definition vortexPagedTerrainProducer.h:31
Main class responsible for managing the Vortex physics simulation environment.
Definition vortexPhysicalWorld.h:55
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:17
Definition vortexDynamicTerrainHandler.h:36
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Classes for handling terrain triangle data and requests for the Vortex physics engine.
std::shared_ptr< DtVortexTriangleOutputInterface > newTriangleInterface
Triangle Interface.
Definition vortexPagedTerrain.h:98
VxMath::BoundingBox requestBounds
The bounding box of this request.
Definition vortexPagedTerrain.h:97
Vx::VxTriangleMeshBVTree * newTriangleMesh
The triangle mesh.
Definition vortexPagedTerrain.h:99
VortexCellToInsert()
Default constructor.
~VortexCellToInsert()
Destructor.
int sourceId
The source ID this cell collision geometry links to.
Definition vortexPagedTerrain.h:113
Vx::VxCollisionGeometry * collisionGeometry
Collision Geometry.
Definition vortexPagedTerrain.h:114
std::vector< DtSimObjectReference > objects
List of objects that will need to be dropped if this is a dynamic terrain event.
Definition vortexPagedTerrain.h:117
Vx::VxTriangleMeshBVTree * newTriangleData
This is the new triangleData.
Definition vortexPagedTerrain.h:115
VortexCellToModify()
Default constructor.
Data structure for managing new terrain requests from the Vortex Forecaster.
Definition vortexPagedTerrain.h:74
int priority
Priority level of the request.
Definition vortexPagedTerrain.h:76
int requestId
Unique identifier for the request.
Definition vortexPagedTerrain.h:77
std::shared_future< void > future
Future object for asynchronous processing.
Definition vortexPagedTerrain.h:75
Provides mapping functionality between VR-Forces terrain surface types and Vortex physics materials.
Defines the base class for all VREngage messages.