VR-Engage  2.3
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.
43 public VxSim::IDynamics,
44 public VxSim::IExtension,
45 public VxSim::IApplicationListener
46{
47public:
48 //! \brief Factory key for creating instances of this addon
49 static const VxSim::VxFactoryKey kFactoryKey;
50
51public:
52 //! \brief Constructor
53 //!
54 //! Creates a new terrain extension with the given proxy.
55 //!
56 //! \param iProxy The extension proxy to associate with
57 DtVortexPagedTerrainExtension(VxSim::VxExtension* iProxy);
58
59 //! \brief Destructor
60 //!
61 //! Cleans up terrain producer and related resources.
63
64 //! \brief Handles application mode changes
65 //!
66 //! Called at the beginning of the update loop before the new mode is actually set.
67 //! Used for creating and deleting the terrain producer:
68 //! - Creates when previous == editing && next == simulating
69 //! - Deletes when previous == simulating && next == editing
70 //! - Does nothing otherwise
71 //!
72 //! \param previous Previous application mode
73 //! \param next Next application mode
74 virtual void onApplicationModeChange(VxSim::eApplicationMode previous, VxSim::eApplicationMode next) override;
75
76 //! \brief Called when this extension is added to a universe
77 //! \param universe Universe this extension was added to
78 virtual void onAddToUniverse(Vx::VxUniverse* universe) override;
79
80 //! \brief Called when this extension is removed from a universe
81 //! \param universe Universe this extension was removed from
82 virtual void onRemoveFromUniverse(Vx::VxUniverse* universe) override;
83
84protected:
85 //! \brief Creates the terrain producer and adds it to the universe
86 //!
87 //! The terrain producer's responsibility is to feed the Vortex collision detection
88 //! with parts and collision geometries that represent the terrain. It performs
89 //! queries on a terrain database via the paged terrain interface in regions where
90 //! terrain collision representations are required by the physics simulation.
91 //!
92 //! Also creates the paged terrain interface (DtVortexPagedTerrain) which answers these
93 //! queries and creates the requested collision geometries from the terrain database.
94 //!
95 //! \param universe The Vortex universe to add the producer to
96 void createTerrainProducer(Vx::VxUniverse* universe);
97
98 //! \brief Deletes the terrain producer and related resources
99 //!
100 //! Removes the terrain producer and interface from the universe and cleans up resources.
101 //!
102 //! \param universe The Vortex universe containing the producer
103 void deleteTerrainProducer(Vx::VxUniverse* universe);
104
105protected:
106 VxTerrain::VxPagedTerrainProducer* myTerrainProducer; //!< Terrain producer for generating collision geometries
107 VxTerrain::VxPagedTerrainInterface* myTerrainSource; //!< Interface for accessing terrain data
108 VxTerrain::VxSpatialForecaster* myForecaster; //!< Forecaster for predicting needed terrain areas
109};
VxTerrain::VxSpatialForecaster * myForecaster
Forecaster for predicting needed terrain areas.
Definition vortexPagedTerrainExtension.h:108
virtual ~DtVortexPagedTerrainExtension() override
Destructor.
void createTerrainProducer(Vx::VxUniverse *universe)
Creates the terrain producer and adds it to the universe.
static const VxSim::VxFactoryKey kFactoryKey
Factory key for creating instances of this addon.
Definition vortexPagedTerrainExtension.h:49
void deleteTerrainProducer(Vx::VxUniverse *universe)
Deletes the terrain producer and related resources.
DtVortexPagedTerrainExtension(VxSim::VxExtension *iProxy)
Constructor.
virtual void onRemoveFromUniverse(Vx::VxUniverse *universe) override
Called when this extension is removed from a universe.
VxTerrain::VxPagedTerrainProducer * myTerrainProducer
Terrain producer for generating collision geometries.
Definition vortexPagedTerrainExtension.h:106
VxTerrain::VxPagedTerrainInterface * myTerrainSource
Interface for accessing terrain data.
Definition vortexPagedTerrainExtension.h:107
virtual void onApplicationModeChange(VxSim::eApplicationMode previous, VxSim::eApplicationMode next) override
Handles application mode changes.
virtual void onAddToUniverse(Vx::VxUniverse *universe) override
Called when this extension is added to a universe.
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 vortexConfiguration.h:29
Definition vortexDynamicTerrainHandler.h:36