VR-Engage  2.2
Loading...
Searching...
No Matches
vortexPagedTerrainExtension.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vortexPagedTerrainExtension.h
7//! \brief Extension for integrating paged terrain into the Vortex physics engine
8//! \ingroup vreVrfVortex
9
10#pragma once
11
12#include <vreVrfVortex/export.h>
13
14#include <VxSim/IDynamics.h>
15#include <VxSim/IExtension.h>
16#include <VxSim/IApplicationListener.h>
17
18class DtTerrainImplementation;
19
20namespace Vx
21{
22class VxUniverse;
23}
24
25namespace VxSim
26{
27class VxPluginExtension;
28}
29
30namespace VxTerrain
31{
32class VxPagedTerrainProducer;
33class VxSpatialForecaster;
34class VxPagedTerrainInterface;
35} // namespace VxTerrain
36
37//! \brief Extension that integrates VR-Forces terrain with the Vortex physics engine
38//!
39//! This extension manages the paged terrain system in Vortex, creating and destroying
40//! the terrain producer and interface as needed during application mode changes.
41//! It handles efficient terrain collision geometry generation for physics simulation.
42class VREVRFVORTEX_DLL DtVortexPagedTerrainExtension : public VxSim::IDynamics,
43 public VxSim::IExtension,
44 public VxSim::IApplicationListener
45{
46public:
47 //! \brief Constructor
48 //!
49 //! Creates a new terrain extension with the given proxy.
50 //!
51 //! \param iProxy The extension proxy to associate with
52 DtVortexPagedTerrainExtension(VxSim::VxExtension* iProxy);
53
54 //! \brief Destructor
55 //!
56 //! Cleans up terrain producer and related resources.
58
59 //! \brief Handles application mode changes
60 //!
61 //! Called at the beginning of the update loop before the new mode is actually set.
62 //! Used for creating and deleting the terrain producer:
63 //! - Creates when previous == editing && next == simulating
64 //! - Deletes when previous == simulating && next == editing
65 //! - Does nothing otherwise
66 //!
67 //! \param previous Previous application mode
68 //! \param next Next application mode
69 virtual void onApplicationModeChange(VxSim::eApplicationMode previous, VxSim::eApplicationMode next) override;
70
71protected:
72 //! \brief Creates the terrain producer and adds it to the universe
73 //!
74 //! The terrain producer's responsibility is to feed the Vortex collision detection
75 //! with parts and collision geometries that represent the terrain. It performs
76 //! queries on a terrain database via the paged terrain interface in regions where
77 //! terrain collision representations are required by the physics simulation.
78 //!
79 //! Also creates the paged terrain interface (DtVortexPagedTerrain) which answers these
80 //! queries and creates the requested collision geometries from the terrain database.
81 //!
82 //! \param universe The Vortex universe to add the producer to
83 void createTerrainProducer(Vx::VxUniverse* universe);
84
85 //! \brief Deletes the terrain producer and related resources
86 //!
87 //! Removes the terrain producer and interface from the universe and cleans up resources.
88 //!
89 //! \param universe The Vortex universe containing the producer
90 void deleteTerrainProducer(Vx::VxUniverse* universe);
91
92protected:
93 VxTerrain::VxPagedTerrainProducer* myTerrainProducer; //!< Terrain producer for generating collision geometries
94 VxTerrain::VxPagedTerrainInterface* myTerrainSource; //!< Interface for accessing terrain data
95 VxTerrain::VxSpatialForecaster* myForecaster; //!< Forecaster for predicting needed terrain areas
96};
VxTerrain::VxSpatialForecaster * myForecaster
Forecaster for predicting needed terrain areas.
Definition vortexPagedTerrainExtension.h:95
virtual ~DtVortexPagedTerrainExtension() override
Destructor.
void createTerrainProducer(Vx::VxUniverse *universe)
Creates the terrain producer and adds it to the universe.
void deleteTerrainProducer(Vx::VxUniverse *universe)
Deletes the terrain producer and related resources.
DtVortexPagedTerrainExtension(VxSim::VxExtension *iProxy)
Constructor.
VxTerrain::VxPagedTerrainProducer * myTerrainProducer
Terrain producer for generating collision geometries.
Definition vortexPagedTerrainExtension.h:93
VxTerrain::VxPagedTerrainInterface * myTerrainSource
Interface for accessing terrain data.
Definition vortexPagedTerrainExtension.h:94
virtual void onApplicationModeChange(VxSim::eApplicationMode previous, VxSim::eApplicationMode next) override
Handles application mode changes.
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 vortexConfiguration.h:29
Definition vortexDynamicTerrainHandler.h:36