26 #include <tbb/concurrent_hash_map.h>
27 #include <tbb/concurrent_unordered_map.h>
33 #include <unordered_map>
47 class DtBallisticProjectilePool;
48 class DtBallisticProjectile;
49 class DtBallisticGeometry;
50 class DtBallisticRunTimeSettings;
51 class DtBallisticComputeComponent;
65 static const std::string& theClassName();
75 void setSoundQueryMaxResults(
int n);
83 static void registerInstance(
DtDe& de);
105 virtual void tick(
void)
override;
117 virtual void slot_atcGlobalModelEnableChanged();
120 virtual void slot_releaseResources();
123 virtual void slot_postTick();
126 virtual void slot_postInit();
131 virtual void slot_currentObserverChanged(
DtObserver* observer);
135 virtual void slot_windSpeedChanged(
float metersPerSecond);
139 virtual void slot_windDirectionChanged(
float radians);
147 void setDefaultProjectileLifetime(
double seconds);
151 virtual double defaultProjectileLifetime()
const;
175 osg::Node* ballisticRenderNode()
const;
184 void registerPipPerObjectData(
const std::string& pipFilename,
const osg::Vec4& perObjectData);
188 int tracerEffectEntryCount()
const;
258 virtual void computeDirectionVectors(DtVector position, DtVector& east, DtVector& north, DtVector& up);
291 virtual void reset();
294 void setupRootNodes();
297 virtual void updateStats();
302 virtual void setAlpha2Coverage(osg::Node* node,
bool on);
BallisticGeometryMap myBallisticGeometryMap
Map of geometry cell index to active ballistic geometry. Supports concurrent traversal; removal is si...
Definition: DtOsgBallisticManager.h:349
DtVector myObserverWorldPosition
Cached observer world-space position, updated each simulation tick.
Definition: DtOsgBallisticManager.h:393
osg::ref_ptr< DtBallisticDebugGeometry > myDebugGeometry
Always-on debug geometry node that draws position-only green spheres for all active projectiles when ...
Definition: DtOsgBallisticManager.h:375
std::unordered_map< std::string, osg::Vec4 > myPipFilenameToPerObjectData
Maps pip filename to the SensorFX per-object data vec4.
Definition: DtOsgBallisticManager.h:365
bool myActive
Whether this slot is currently in use.
Definition: DtOsgBallisticManager.h:243
uint64_t myId
Identifier matching the associated burst handle.
Definition: DtOsgBallisticManager.h:213
tbb::concurrent_unordered_map< unsigned int, DtBallisticGeometry * > BallisticGeometryMap
Type definition for the ballistic geometry map, which maps unique integer IDs to geometry instances...
Definition: DtOsgBallisticManager.h:62
osg::ref_ptr< osg::Group > myDebugGroup
Owning group that parents myDebugGeometry under the model-set roots. Held as a member (not a local) s...
Definition: DtOsgBallisticManager.h:381
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:36
Contains the makVrv::DtBallisticDebugGeometry class declaration.
DtBallisticBurstHandle myBurstHandle
Handle to the associated burst sequence.
Definition: DtOsgBallisticManager.h:231
Tracks the live state of a single projectile slot.
Definition: DtOsgBallisticManager.h:235
double myTimeAccum
Accumulated seconds toward the next round.
Definition: DtOsgBallisticManager.h:216
vrvCore singleton base class for the ballistic manager.
Definition: DtBallisticManager.h:27
bool myObserverPositionValid
True when myObserverWorldPosition holds a valid observer position.
Definition: DtOsgBallisticManager.h:396
int32_t myTracerTypeIndex
Tracer definition slot index registered for this burst; -1 if none.
Definition: DtOsgBallisticManager.h:220
std::mutex myObserverPositionMutex
Mutex protecting myObserverWorldPosition and myObserverPositionValid.
Definition: DtOsgBallisticManager.h:390
Parameters describing a ballistic burst to be spawned.
Definition: DtBallisticManager.h:38
Parameters for a single projectile burst fired via DtOsgBallisticManager.
Definition: DtBallisticFireRequest.h:26
DtString mySourceId
Source ID string used to detect hash collisions.
Definition: DtOsgBallisticManager.h:230
OSG Drawable that drives per-camera GPU cull and draw for a ballistic spatial cell.
Definition: DtBallisticGeometry.h:58
double myDefaultProjectileLifetime
Fallback projectile lifetime in seconds.
Definition: DtOsgBallisticManager.h:362
int myRoundsFired
Number of rounds already spawned.
Definition: DtOsgBallisticManager.h:215
DtObserver * myCurrentObserver
Active observer, updated via DtInputDriverSignaler::signal_currentObserverChanged. Accessed only from the simulation thread; no additional mutex required.
Definition: DtOsgBallisticManager.h:387
float myWindDirection
Current wind direction in radians.
Definition: DtOsgBallisticManager.h:331
boost::signalslib::connection myPostInitializeConnection
Connection for the post-init signal; disconnected when slot_postInit() fires.
Definition: DtOsgBallisticManager.h:333
DtUniqueID myUniqueId
Unique identifier for the firing event.
Definition: DtOsgBallisticManager.h:229
Contains makVrv::DtBallisticBurstHandle class.
Contains the DtBallisticSoundProxy class declaration.
Internal record tracking one in-flight burst sequence.
Definition: DtOsgBallisticManager.h:208
int32_t myTracerTypeIndex
Tracer definition slot index registered for this instance; -1 if none.
Definition: DtOsgBallisticManager.h:232
DtBallisticComputeComponent * myComputeComponent
Shared compute component responsible for all trajectory computation.
Definition: DtOsgBallisticManager.h:342
A facade for a DtObserverObject.
Definition: DtObserver.h:38
std::map< int, ActiveProjectileInfo > myActiveProjectileMap
Map of slot index to projectile state.
Definition: DtOsgBallisticManager.h:247
DtSignalConnectionManager myConnections
Manages signal/slot lifetime connections.
Definition: DtOsgBallisticManager.h:329
Pure data and signal container that decouples DtOsgBallisticManager from the audio subsystem...
Definition: DtBallisticSoundProxy.h:41
Contains makVrv::DtBallisticSpatialGrid class.
DtBallisticFireRequest myRequest
Original fire parameters.
Definition: DtOsgBallisticManager.h:214
std::deque< DtBallisticBurstRecord > myBurstRecords
Active bursts with rounds still pending. NOT thread-safe: accessed only from the simulation thread (t...
Definition: DtOsgBallisticManager.h:359
CPU-side pool slot descriptor for a single GPU-simulated bullet.
Definition: DtBallisticProjectile.h:23
Contains the DtBallisticManager class declaration.
DtBallisticSpatialGrid * myGrid
Spatial grid routing per-camera cull, draw, and proximity queries.
Definition: DtOsgBallisticManager.h:345
bool observerPositionValid() const
Returns true if the cached observer position is valid (observer exists).
Definition: DtOsgBallisticManager.h:325
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Represents a single effect-system registration for a ballistic tracer effect variant.
Definition: DtTracerEffectEntry.h:27
Contains makVrv::DtTracerEffectEntry class.
Spatial grid that owns and manages DtBallisticGeometry cells.
Definition: DtBallisticSpatialGrid.h:50
DtBallisticGeometry * myGeometry
Non-owning pointer to the cell geometry that owns this burst's slots.
Definition: DtOsgBallisticManager.h:219
float myWindSpeed
Current wind speed in metres per second.
Definition: DtOsgBallisticManager.h:330
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
double myLastTickTime
Simulation time at the last tick, or -1 if not yet ticked.
Definition: DtOsgBallisticManager.h:361
Interface for GPU compute operations driving the ballistic simulation pipeline.
Definition: DtBallisticComputeComponent.h:71
Contains makVrv::DtBallisticFireRequest class.
Internal record tracking all active projectiles for a unique firing event.
Definition: DtOsgBallisticManager.h:224
std::unique_ptr< DtBallisticProjectilePool > myProjectilePool
Shared pool that supplies GPU slots for all active projectiles.
Definition: DtOsgBallisticManager.h:339
DtVector observerWorldPosition() const
Returns the cached observer world-space position.
Definition: DtOsgBallisticManager.h:320
boost::signalslib::signal< void(osg::Node *)> signal_ballisticRenderNodeToBeRemoved
Signal emitted from reset() before the ballistic grid renderer node is removed from the scene graph a...
Definition: DtOsgBallisticManager.h:162
Base class to provide boost signal/slot management.
std::unordered_map< std::string, std::unique_ptr< DtTracerEffectEntry > > myTracerEffectEntries
One DtTracerEffectEntry per unique non-empty pip filename encountered during createProjectiles(). Keyed by pip filename string.
Definition: DtOsgBallisticManager.h:369
MapUniqueIdsToBallisticProjectileInstances myMapUniqueIdsToBallisticProjectileInstances
Definition: DtOsgBallisticManager.h:353
Singleton holding runtime-tweakable settings for the ballistic system.
Definition: DtBallisticRunTimeSettings.h:43
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
std::mutex & observerPositionMutex()
Returns the mutex guarding the cached observer world-space position.
Definition: DtOsgBallisticManager.h:315
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
DtBallisticProjectile * myProjectile
Pointer to the projectile, or null.
Definition: DtOsgBallisticManager.h:244
Identifies a single burst sequence so callers can cancel pending (not-yet-spawned) rounds...
Definition: DtBallisticBurstHandle.h:24
double myInterval
Seconds between consecutive rounds.
Definition: DtOsgBallisticManager.h:217
boost::signalslib::signal< void(osg::Node *)> signal_ballisticRenderNodeAdded
Signal emitted from setupRootNodes() after the ballistic grid renderer node has been added to the sce...
Definition: DtOsgBallisticManager.h:157
Ballistic manager that owns the projectile pool, compute component, and spatial grid.
Definition: DtOsgBallisticManager.h:58
DtBallisticSoundProxy mySoundProxy
Sound coupling proxy: query settings, index resolver, and trigger signal.
Definition: DtOsgBallisticManager.h:383
bool myCancelled
When true, no further rounds will be spawned.
Definition: DtOsgBallisticManager.h:218
const DtBallisticRunTimeSettings & myBallisticRunTimeSettings
Reference to the active ballistic runtime settings.
Definition: DtOsgBallisticManager.h:336
Identifies the source entity associated with a ballistic burst.
Definition: DtBallisticManager.h:31
boost::signalslib::signal< void(DtTracerEffectEntry &)> signal_tracerEffectEntryToBeRemoved
Signal emitted from reset() before each DtTracerEffectEntry is destroyed. JrmSensorModule connects to...
Definition: DtOsgBallisticManager.h:171
boost::signalslib::signal< void(DtTracerEffectEntry &)> signal_tracerEffectEntryAdded
Signal emitted from fire() the first time a new pip filename is encountered. JrmSensorModule connects...
Definition: DtOsgBallisticManager.h:167
tbb::concurrent_hash_map< DtUniqueID, DtBallisticProjectileInstance > MapUniqueIdsToBallisticProjectileInstances
Map of unique firing-event identifiers to their projectile instance records.
Definition: DtOsgBallisticManager.h:352