VR-Engage  2.2
Loading...
Searching...
No Matches
vreMovementBasedTerrainPreloadController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreMovementBasedTerrainPreloadController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for preloading terrain based on entity movement
9//!
10//! This file defines the DtVreMovementBasedTerrainPreloadController class which
11//! provides terrain preloading capabilities based on the current movement and
12//! anticipated position of the entity. It predicts which areas of terrain will
13//! be needed soon and ensures they are loaded in advance.
14
15
16#pragma once
17
18class DtBooleanInputPort;
19
20#include "vreVrfmodel/export.h"
21#include <vrfmodel/movementBasedTerrainPreloadController.h>
22#include "vreVrfModel/vreSimComponent.h"
23
24namespace makVre
25{
26//! \brief Type identifier for the VRE movement-based terrain preload controller component
27const char DtVreMovementBasedTerrainPreloadControllerType[] = "vre-movement-based-terrain-preload-controller";
28
29//! \brief Controller that preloads terrain based on entity movement prediction
30//!
31//! This controller is a provider to the DtVrfObjectTerrainPreloadManager.
32//! It uses the current movement speed and direction of the entity to predict
33//! the terrain area that will be needed in the near future by its host entity.
34//! The controller adjusts preloading based on whether the entity is in a normal
35//! movement state or is falling, which requires different terrain loading patterns.
36//!
37//! Uses Descriptor Type: DtVreMovementBasedTerrainPreloadControllerDescriptor
39 : public DtVreSimComponent<DtMovementBasedTerrainPreloadController>
40{
41private:
42 //! \brief Default constructor (not implemented)
43 //!
44 //! Default constructor is private and not implemented to prevent
45 //! creation of instances without proper initialization.
47 //! \brief Copy constructor (not implemented)
48 //!
49 //! Copy constructor is private and not implemented to prevent
50 //! copy construction.
52 //! \brief Assignment operator (not implemented)
53 //! \return Reference to this object
54 //!
55 //! Assignment operator is private and not implemented to prevent assignment.
57
58public:
59 //! \brief Constructor
60 //! \param name The name of this component
61 //! \param owner The local object that owns this component
62 //! \param simManager The simulation services manager
63 //! \param desc Component descriptor with configuration parameters
64 //! \param parentRegistry Optional parent registry for reader/writer functionality
65 //!
66 //! Creates a new movement-based terrain preload controller with the specified parameters.
67 DtVreMovementBasedTerrainPreloadController(const DtString& name, DtLocalObject* owner,
68 DtSimulationServices* simManager, DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
69
70 //! \brief Virtual destructor
71 //!
72 //! Cleans up resources used by the movement-based terrain preload controller component.
74
75 //! \brief Gets the type identifier for this component
76 //! \return String identifying the component type (DtVreMovementBasedTerrainPreloadControllerType)
77 //!
78 //! Implements the DtSimComponent::type() method to return the
79 //! type identifier for this component.
80 virtual const char* type() const override;
81
82 //! \brief Calculates the terrain area to preload
83 //! \param args Arguments containing information for terrain preload calculation
84 //!
85 //! Overridden to check the falling port and adjust the preload shape
86 //! accordingly. If the entity is falling, the preload shape is forced to
87 //! be a chord, which provides a more appropriate preload area for falling entities.
88 //! This ensures that terrain is properly loaded in the expected landing area.
89 virtual void calculateTerrainPreLoad(DtVrfObjectTerrainPreloadArgs& args) override;
90
91 //! \brief Factory method to create a new instance of this component
92 //! \param name The name for the new component
93 //! \param owner The local object that will own this component
94 //! \param simManager The simulation services manager
95 //! \param desc Optional component descriptor
96 //! \param parentRegistry Optional parent registry for reader/writer functionality
97 //! \return Pointer to the newly created component
98 //!
99 //! Static factory method used by the component creation system to instantiate
100 //! new instances of this component type.
101 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
102 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
103
104 //! \brief Creates input and output ports for the component
105 //! \return True if ports are successfully created, false otherwise
106 //!
107 //! Creates, initializes, and adds to the port group all the ports needed
108 //! by this component, including the falling input port which influences
109 //! terrain preloading behavior.
110 virtual bool createPorts() override;
111
112protected:
113 //! \brief Input port for entity falling state
114 //!
115 //! Boolean input port that indicates whether the entity is in a falling state.
116 //! When true, the terrain preloading shape is adjusted to better accommodate
117 //! the trajectory of a falling entity.
118 DtBooleanInputPort* myFallingInputPort;
119};
120
121} // namespace makVre
DtVreMovementBasedTerrainPreloadController & operator=(const DtVreMovementBasedTerrainPreloadController &orig)
Assignment operator (not implemented)
DtBooleanInputPort * myFallingInputPort
Input port for entity falling state.
Definition vreMovementBasedTerrainPreloadController.h:118
DtVreMovementBasedTerrainPreloadController()
Default constructor (not implemented)
virtual const char * type() const override
Gets the type identifier for this component.
DtVreMovementBasedTerrainPreloadController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method to create a new instance of this component.
virtual bool createPorts() override
Creates input and output ports for the component.
DtVreMovementBasedTerrainPreloadController(const DtVreMovementBasedTerrainPreloadController &orig)
Copy constructor (not implemented)
virtual ~DtVreMovementBasedTerrainPreloadController() override
Virtual destructor.
virtual void calculateTerrainPreLoad(DtVrfObjectTerrainPreloadArgs &args) override
Calculates the terrain area to preload.
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreMovementBasedTerrainPreloadControllerType[]
Type identifier for the VRE movement-based terrain preload controller component.
Definition vreMovementBasedTerrainPreloadController.h:27