VR-Engage  2.2
Loading...
Searching...
No Matches
vreGunActuatorDescriptor.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreGunActuatorDescriptor.h
7//! \ingroup vreVrfobjparam
8//! \brief Gun actuator descriptor for VREngage
9//!
10//! This file defines the DtVreGunActuatorDescriptor class, which configures gun
11//! actuator components in VREngage. It provides parameters for ammunition, firing rates,
12//! ranges, and other properties necessary for gun behavior in simulations.
13
14#pragma once
15
17#include <vrfobjparam/actuatorComponentDescriptor.h>
18#include <vrfutil/rwStringList.h>
19#include <readerWriter/rwInt.h>
20#include <readerWriter/rwVector.h>
21
22namespace makVre
23{
24//! \brief Type identifier string for the gun actuator descriptor
25const char DtVreGunActuatorDescriptorType[] = "vre-gun-actuator-descriptor";
26
27//! \brief Gun actuator descriptor for VREngage weapon systems
28//!
29//! This class defines a descriptor for gun actuator components in VREngage.
30//! It provides configuration for ammunition, firing rates, ranges, muzzle parameters,
31//! and other properties necessary for realistic gun behavior in simulations.
32class VREVRFOBJPARAM_DLL DtVreGunActuatorDescriptor : public DtActuatorComponentDescriptor
33{
34private:
35 //! \brief Default constructor (not implemented)
36 //!
37 //! Default constructor is private and not implemented to prevent
38 //! creation of instances without proper initialization.
40
41public:
42 //! \brief Constructor with component name
43 //! \param componentName The name of this component
44 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
45 //!
46 //! Creates a new gun actuator descriptor with the specified name.
47 DtVreGunActuatorDescriptor(const DtString& componentName, DtReaderWriterRegistry* parentRegistry = 0);
48
49 //! \brief Constructor with component name as symbol string
50 //! \param componentName The name of this component as a symbol string
51 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
52 //!
53 //! Creates a new gun actuator descriptor with the specified name.
54 DtVreGunActuatorDescriptor(const DtSymbolString& componentName, DtReaderWriterRegistry* parentRegistry = NULL);
55
56 //! \brief Copy constructor
57 //! \param orig The source descriptor to copy from
58 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
59 //!
60 //! Creates a new gun actuator descriptor as a copy of the provided original.
61 DtVreGunActuatorDescriptor(const DtVreGunActuatorDescriptor& orig, DtReaderWriterRegistry* parentRegistry = 0);
62
63 //! \brief Virtual destructor
64 //!
65 //! Cleans up resources used by the descriptor.
66 virtual ~DtVreGunActuatorDescriptor() override;
67
68 //! \brief Assignment operator
69 //! \param orig The source descriptor to copy from
70 //! \return Reference to this descriptor after assignment
71 //!
72 //! Assigns the contents of the provided descriptor to this one.
74
75 //! \brief Gets the type identifier for this descriptor
76 //! \return String identifying this descriptor type
77 //!
78 //! Returns a unique type identifier string for this descriptor type.
79 //! Will return DtVreGunActuatorDescriptorType.
80 virtual DtString type() const override;
81
82 //! \brief Creates a clone of this descriptor
83 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
84 //! \return Pointer to a new descriptor that is a clone of this one
85 //!
86 //! Creates a new gun actuator descriptor as a deep copy of this one.
87 virtual DtComponentDescriptor* clone(DtReaderWriterRegistry* parentRegistry = 0) const override;
88
89 //! \brief Factory function to create a new instance of this descriptor
90 //! \return Pointer to a newly created descriptor
91 //!
92 //! Static factory function used by the descriptor creation system to instantiate
93 //! new instances of this descriptor type.
94 static DtComponentDescriptor* creator();
95
96 //! \brief Gets the attached part index
97 //! \return The index of the attached part
98 //!
99 //! Returns the index of the articulated part to which this gun is attached.
100 virtual int attachedPart() const;
101
102 //! \brief Sets the attached part index
103 //! \param part The index of the attached part
104 //!
105 //! Sets the index of the articulated part to which this gun is attached.
106 virtual void setAttachedPart(int part);
107
108 //! \brief Gets the muzzle speed
109 //! \return The muzzle speed in meters per second
110 //!
111 //! Returns the speed of projectiles as they exit the gun's muzzle.
112 virtual DtReal muzzleSpeed() const;
113
114 //! \brief Sets the muzzle speed
115 //! \param muzzleSpeed The muzzle speed in meters per second
116 //!
117 //! Sets the speed of projectiles as they exit the gun's muzzle.
118 virtual void setMuzzleSpeed(DtReal muzzleSpeed);
119
120 //! \brief Gets the number of rounds per magazine
121 //! \return The number of rounds per magazine
122 //!
123 //! Returns the number of rounds that can be loaded in a single magazine.
124 virtual int roundsPerMagazine() const;
125
126 //! \brief Sets the number of rounds per magazine
127 //! \param roundsPerMagazine The number of rounds per magazine
128 //!
129 //! Sets the number of rounds that can be loaded in a single magazine.
131
132 //! \brief Gets the firing rate
133 //! \return The firing rate in rounds per minute
134 //!
135 //! Returns the maximum firing rate of the gun in rounds per minute.
136 virtual int roundsPerMinute() const;
137
138 //! \brief Sets the firing rate
139 //! \param roundsPerMinute The firing rate in rounds per minute
140 //!
141 //! Sets the maximum firing rate of the gun in rounds per minute.
142 virtual void setRoundsPerMinute(const int roundsPerMinute);
143
144 //! \brief Gets the muzzle offset
145 //! \return Reference to the muzzle offset vector
146 //!
147 //! Returns the offset vector from the entity's origin to the gun's muzzle.
148 virtual const DtVector& muzzleOffset() const;
149
150 //! \brief Sets the muzzle offset
151 //! \param muzzleOffset The muzzle offset vector
152 //!
153 //! Sets the offset vector from the entity's origin to the gun's muzzle.
154 virtual void setMuzzleOffset(const DtVector& muzzleOffset);
155
156 //! \brief Gets the loading time
157 //! \return The loading time in seconds
158 //!
159 //! Returns the time required to load a new magazine into the gun.
160 virtual DtReal loadTime() const;
161
162 //! \brief Sets the loading time
163 //! \param loadTime The loading time in seconds
164 //!
165 //! Sets the time required to load a new magazine into the gun.
166 virtual void setLoadTime(DtReal loadTime);
167
168 //! \brief Gets the unloading time
169 //! \return The unloading time in seconds
170 //!
171 //! Returns the time required to unload a magazine from the gun.
172 virtual DtReal unloadTime() const;
173
174 //! \brief Sets the unloading time
175 //! \param unloadTime The unloading time in seconds
176 //!
177 //! Sets the time required to unload a magazine from the gun.
178 virtual void setUnloadTime(DtReal unloadTime);
179
180 //! \brief Gets the effective range
181 //! \return The effective range in meters
182 //!
183 //! Returns the effective range of the gun for accurate targeting.
184 virtual DtReal range() const;
185
186 //! \brief Sets the effective range
187 //! \param range The effective range in meters
188 //!
189 //! Sets the effective range of the gun for accurate targeting.
190 virtual void setRange(DtReal range);
191
192
193 //! \brief Gets the range name
194 //! \return String identifying the range configuration
195 //!
196 //! Returns a name that identifies the range configuration of this gun.
197 virtual const DtString& rangeName() const;
198
199 //! \brief Sets the range name
200 //! \param rangeName String identifying the range configuration
201 //!
202 //! Sets a name that identifies the range configuration of this gun.
203 virtual void setRangeName(const DtString& rangeName);
204
205
206 //! \brief Gets the number of rounds per detonation
207 //! \return The number of rounds required for detonation
208 //!
209 //! Returns the number of rounds that must be fired before detonation occurs.
210 //! This is typically used for special ammunition types that require multiple hits.
211 virtual int roundsPerDetonation() const;
212
213 //! \brief Sets the number of rounds per detonation
214 //! \param rpd The number of rounds required for detonation
215 //!
216 //! Sets the number of rounds that must be fired before detonation occurs.
217 //! This is typically used for special ammunition types that require multiple hits.
218 virtual void setRoundsPerDetonation(const int rpd);
219
220 //! \brief Gets the list of available munitions
221 //! \return Reference to the list of munition names
222 //!
223 //! Returns a list of names identifying the types of munitions this gun can use.
224 virtual const DtRwStringList& munitionList() const;
225
226 //! \brief Sets the list of available munitions
227 //! \param munitionList The list of munition names
228 //!
229 //! Sets the list of names identifying the types of munitions this gun can use.
230 virtual void setMunitionList(DtRwStringList& munitionList);
231
232 //! \brief Gets the maximum range
233 //! \return The maximum range in meters
234 //!
235 //! Returns the maximum possible range of the gun, beyond which projectiles
236 //! cannot travel. This limits the length of the chord used in intersection tests
237 //! for determining targets.
238 virtual DtReal maxRange() const;
239
240 //! \brief Sets the maximum range
241 //! \param range The maximum range in meters
242 //!
243 //! Sets the maximum possible range of the gun, beyond which projectiles
244 //! cannot travel. This limits the length of the chord used in intersection tests
245 //! for determining targets.
246 virtual void setMaxRange(DtReal range);
247
248protected:
249 //! \brief Index of the articulated part to which this gun is attached
251
252 //! \brief Speed of projectiles as they exit the gun's muzzle in meters per second
254
255 //! \brief Number of rounds that can be loaded in a single magazine
257
258 //! \brief Maximum firing rate of the gun in rounds per minute
260
261 //! \brief Offset vector from the entity's origin to the gun's muzzle
262 DtRwOffsetVector myMuzzleOffset;
263
264 //! \brief Time required to load a new magazine in seconds
265 DtRwReal myLoadTime;
266
267 //! \brief Time required to unload a magazine in seconds
268 DtRwReal myUnloadTime;
269
270 //! \brief Effective range of the gun for accurate targeting in meters
271 DtRwReal myRange;
272
273 //! \brief Name identifying the range configuration of this gun
274 DtRwString myRangeName;
275
276 //! \brief Number of rounds that must be fired before detonation occurs
277 //!
278 //! Used for special ammunition types that require multiple hits for detonation.
280
281 //! \brief List of names identifying the types of munitions this gun can use
282 DtRwStringList myMunitionList;
283
284 //! \brief Maximum possible range of the gun in meters
285 //!
286 //! The maximum range beyond which projectiles cannot travel. This limits the
287 //! length of the chord used in intersection tests for determining targets.
288 //! Parameter name: "max-range"
289 //! Default value: 2000 meters
290 DtRwReal myMaxRange;
291};
292} // namespace makVre
virtual int roundsPerMinute() const
Gets the firing rate.
DtRwString myRangeName
Name identifying the range configuration of this gun.
Definition vreGunActuatorDescriptor.h:274
DtVreGunActuatorDescriptor(const DtSymbolString &componentName, DtReaderWriterRegistry *parentRegistry=NULL)
Constructor with component name as symbol string.
virtual const DtVector & muzzleOffset() const
Gets the muzzle offset.
virtual void setAttachedPart(int part)
Sets the attached part index.
virtual void setRoundsPerDetonation(const int rpd)
Sets the number of rounds per detonation.
DtVreGunActuatorDescriptor()
Default constructor (not implemented)
DtVreGunActuatorDescriptor(const DtString &componentName, DtReaderWriterRegistry *parentRegistry=0)
Constructor with component name.
virtual int roundsPerMagazine() const
Gets the number of rounds per magazine.
DtRwInt myAttachedPart
Index of the articulated part to which this gun is attached.
Definition vreGunActuatorDescriptor.h:250
virtual void setRoundsPerMinute(const int roundsPerMinute)
Sets the firing rate.
virtual const DtString & rangeName() const
Gets the range name.
DtRwReal myRange
Effective range of the gun for accurate targeting in meters.
Definition vreGunActuatorDescriptor.h:271
virtual DtReal loadTime() const
Gets the loading time.
virtual ~DtVreGunActuatorDescriptor() override
Virtual destructor.
virtual DtReal unloadTime() const
Gets the unloading time.
DtRwReal myMaxRange
Maximum possible range of the gun in meters.
Definition vreGunActuatorDescriptor.h:290
virtual void setMuzzleSpeed(DtReal muzzleSpeed)
Sets the muzzle speed.
virtual const DtRwStringList & munitionList() const
Gets the list of available munitions.
static DtComponentDescriptor * creator()
Factory function to create a new instance of this descriptor.
virtual void setRoundsPerMagazine(int roundsPerMagazine)
Sets the number of rounds per magazine.
virtual void setRange(DtReal range)
Sets the effective range.
virtual void setUnloadTime(DtReal unloadTime)
Sets the unloading time.
virtual int roundsPerDetonation() const
Gets the number of rounds per detonation.
DtRwReal myRoundsPerMinute
Maximum firing rate of the gun in rounds per minute.
Definition vreGunActuatorDescriptor.h:259
DtRwOffsetVector myMuzzleOffset
Offset vector from the entity's origin to the gun's muzzle.
Definition vreGunActuatorDescriptor.h:262
DtRwStringList myMunitionList
List of names identifying the types of munitions this gun can use.
Definition vreGunActuatorDescriptor.h:282
DtVreGunActuatorDescriptor & operator=(const DtVreGunActuatorDescriptor &orig)
Assignment operator.
virtual DtReal muzzleSpeed() const
Gets the muzzle speed.
virtual int attachedPart() const
Gets the attached part index.
virtual void setRangeName(const DtString &rangeName)
Sets the range name.
virtual void setMuzzleOffset(const DtVector &muzzleOffset)
Sets the muzzle offset.
DtRwInt myRoundsPerMagazine
Number of rounds that can be loaded in a single magazine.
Definition vreGunActuatorDescriptor.h:256
virtual DtString type() const override
Gets the type identifier for this descriptor.
DtVreGunActuatorDescriptor(const DtVreGunActuatorDescriptor &orig, DtReaderWriterRegistry *parentRegistry=0)
Copy constructor.
virtual DtComponentDescriptor * clone(DtReaderWriterRegistry *parentRegistry=0) const override
Creates a clone of this descriptor.
virtual DtReal maxRange() const
Gets the maximum range.
virtual void setMaxRange(DtReal range)
Sets the maximum range.
DtRwReal myMuzzleSpeed
Speed of projectiles as they exit the gun's muzzle in meters per second.
Definition vreGunActuatorDescriptor.h:253
virtual DtReal range() const
Gets the effective range.
DtRwInt myRoundsPerDetonation
Number of rounds that must be fired before detonation occurs.
Definition vreGunActuatorDescriptor.h:279
virtual void setLoadTime(DtReal loadTime)
Sets the loading time.
DtRwReal myUnloadTime
Time required to unload a magazine in seconds.
Definition vreGunActuatorDescriptor.h:268
virtual void setMunitionList(DtRwStringList &munitionList)
Sets the list of available munitions.
DtRwReal myLoadTime
Time required to load a new magazine in seconds.
Definition vreGunActuatorDescriptor.h:265
Export macros for the VREngage Object Parameter library.
#define VREVRFOBJPARAM_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreGunActuatorDescriptorType[]
Type identifier string for the gun actuator descriptor.
Definition vreGunActuatorDescriptor.h:25