VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtBallisticComputeComponent Class Reference

Interface for GPU compute operations driving the ballistic simulation pipeline.

Manages all compute shader dispatches (trajectory update, octree build, frustum cull, proximity queries) and the associated SSBO/UBO GPU buffers. Instantiated via the DtBallisticComputeComponentCreator factory.

Inheritance diagram for makVrv::DtBallisticComputeComponent:
Inheritance graph
[legend]

Public Types

enum  CullMode { CullMode::Octree, CullMode::BruteForce }
 
enum  QueryMode { QueryMode::Octree, QueryMode::BruteForce }
 
using SlotReleasedCallback = std::function< void(int slotIndex)>
 

Public Member Functions

virtual std::string buildShaderPreamble () const
 
virtual ~DtBallisticComputeComponent ()
 
virtual void slot_reloadShaders ()
 
virtual void slot_windSpeedChanged (float metersPerSecond)
 
virtual void slot_windDirectionChanged (float radians)
 
virtual void execute ()
 
virtual void update (osg::RenderInfo &renderInfo)
 
virtual void apply (osg::RenderInfo &renderInfo)
 
virtual void releaseGLObjects (osg::State *state)
 
virtual bool shouldDraw (bool isShadowPass)
 
virtual void drainReleasedSlots (SlotReleasedCallback callback)
 
virtual void setSimulationActive (bool active)
 
virtual void beginFrame ()
 
virtual void insertFrameFence ()
 
virtual void pollReadback ()
 
virtual void pollQueryReadback ()
 
virtual void writeSpawnData (int slotIndex, const BulletSpawn &spawn)
 
virtual uint32_t registerTracerDefinition (const DtTracerDefinition &def, const float otherData0[4])
 
virtual void unregisterTracerDefinition (uint32_t index)
 
virtual void setSlotActive (int slotIndex, uint32_t active)
 
virtual void deactivateSlot (int slotIndex)
 
virtual void updateEnvironment (float gravity, float windSpeed, float windDirection, float deltaTime, double currentTime)
 
virtual void dispatchTrajectoryUpdate ()
 
virtual void dispatchOctreeBuild ()
 
virtual void dispatchSoundQuery (DtOsgBallisticManager *mgr)
 
virtual void bindGlobalCullBuffers ()
 
virtual void bindGlobalDrawBuffers ()
 
virtual void drainSoundTriggers (std::function< void(const std::vector< std::vector< DtBallisticSoundTrigger >> &)> callback)
 
virtual void unbindCullBuffers ()
 
virtual void unbindDrawBuffers ()
 
virtual void initIndirectDrawCommands (GLuint indexCount)
 
virtual void setFrustumCullMode (CullMode mode)
 
virtual CullMode frustumCullMode () const
 
virtual void setProximityQueryMode (QueryMode mode)
 
virtual QueryMode proximityQueryMode () const
 
virtual void setGravity (float gravity)
 
virtual float gravity () const
 
virtual void setMaxQueryResults (int n)
 
virtual void dispatchFrustumCull ()
 
virtual void dispatchOctreeCull ()
 
virtual void dispatchGatherActiveFlags ()
 
virtual void bindProjectileBuffer (unsigned int bindingPoint)
 
virtual DtBallisticDrawComponent * drawComponent () const
 
virtual void debugDumpBuffers ()
 
virtual void debugDrawCullResults (DtGlBuffer *visibleSSBO)
 
virtual void debugDrawPositions ()
 
virtual void debugDumpCullBuffers (DtGlBuffer *visibleSSBO)
 
virtual void initializeBuffers ()
 
virtual void doReloadShaders ()
 
- Public Member Functions inherited from makVrv::DtGpuOperation
 DtGpuOperation (const std::string &name, DtDe &de)
 
virtual ~DtGpuOperation ()
 
virtual void execute (DtGpuArenaUploadState &uploadState)
 

Public Attributes

friend DtBallisticComputeComponentCreator
 

Static Public Attributes

static constexpr uint32_t MAX_BULLETS = 16384
 

Protected Member Functions

 DtBallisticComputeComponent (DtDe &de)
 
virtual void recomputeOctreeConstants ()
 

Protected Attributes

DtDe & myDe
 
DtSignalConnectionManager myConnections
 
float myGravity
 
float myWindSpeed
 
float myWindDirection
 
uint32_t myOctreeDepth
 
uint32_t myLeafCount
 
uint32_t myOctreeTotalNodes
 
uint32_t myInternalNodeCount
 
uint32_t myBulletsPerLeaf
 
const DtBallisticRunTimeSettings & myBallisticRunTimeSettings
 
bool myMutableShadersFailedToCompile
 
DtGlProgram * myTrajectoryProgram
 
DtGlProgram * myOctreeBoundsProgram
 
DtGlProgram * myOctreeStructureProgram
 
DtGlProgram * myOctreeInsertProgram
 
DtGlProgram * myActiveFlagProgram
 
DtGlProgram * myFrustumCullProgram
 
DtGlProgram * myOctreeMarkProgram
 
DtGlProgram * myOctreeLeafProgram
 
DtGlProgram * myProximityQueryProgram
 
DtGlProgram * myProximityQueryOctreeProgram
 
CullMode myCullMode
 
QueryMode myQueryMode
 
DtGlBuffer * myEnvironmentUBO
 
DtGlBuffer * mySpawnSSBO
 
DtGlBuffer * myStateSSBO
 
DtGlBuffer * myOctreeSSBO
 
DtGlBuffer * myOctreeBulletListSSBO
 
DtGlBuffer * myBoundsSSBO
 
DtGlBuffer * myNodeCounterSSBO
 
DtGlBuffer * myActiveFlagSSBO
 
DtGlBuffer * myOctreeNodeFlagsSSBO
 
DtGlBuffer * myTracerDefinitionSSBO = nullptr
 
std::vector< TracerDefinition > myTracerDefTable
 
std::vector< int32_t > myTracerDefRefCounts
 
std::vector< uint32_t > myFreeTracerSlots
 
DtGlBuffer * myReadbackBuffer [3]
 
GLsync myFenceSync [3]
 
int myFrameIndex
 
std::vector< uint64_t > myLifeTracker
 
uint64_t myGlobalFrameCount
 
uint64_t myReadbackFrameNumber [3]
 
std::vector< int > myPendingReleasedSlots
 
std::mutex myPendingReleasedSlotsMutex
 
DtGlBuffer * myQueryInputSSBO [3]
 
DtGlBuffer * myQueryResultSSBO [3]
 
DtGlBuffer * myQueryReadbackSSBO [3]
 
GLsync myQueryFence [3]
 
DtGlProgram * myQuerySortProgram
 
int myMaxQueryResults
 
bool myWarnedSoundProgramNull
 
std::vector< std::vector
< DtBallisticSoundTrigger > > 
myPendingSoundTriggers
 
std::mutex myPendingSoundTriggersMutex
 
std::atomic< bool > myPendingShaderReload
 
std::atomic< bool > mySimulationActive
 
int myActiveSlotCount
 
double myLastFrameTime
 
DtIndirectShaderManager & myIndirectShaderManager
 
bool myBuffersInitialized
 
DtBallisticDrawComponent * mySharedDrawComponent
 
GLuint myMeshIndexCount
 
- Protected Attributes inherited from makVrv::DtGpuOperation
DtDe & myDe
 
const std::string myName
 

Private Member Functions

 DtBallisticComputeComponent ()=delete
 
 DtBallisticComputeComponent (const DtBallisticComputeComponent &rhs)=delete
 
DtBallisticComputeComponent & operator= (const DtBallisticComputeComponent &rhs)=delete
 

Member Typedef Documentation

using makVrv::DtBallisticComputeComponent::SlotReleasedCallback = std::function<void(int slotIndex)>

Callback type invoked on the CPU thread for each pool slot the GPU has killed.

Member Enumeration Documentation

Selects whether octree or brute-force frustum culling is used.

Enumerator
Octree 
BruteForce 

Selects whether octree or brute-force proximity queries are used.

Enumerator
Octree 
BruteForce 

Constructor & Destructor Documentation

makVrv::DtBallisticComputeComponent::DtBallisticComputeComponent ( DtDe &  de)
protected

Protected constructor; use the creator factory to instantiate.

Parameters
deSimulation environment.
makVrv::DtBallisticComputeComponent::DtBallisticComputeComponent ( )
privatedelete

Default construction is not supported.

makVrv::DtBallisticComputeComponent::DtBallisticComputeComponent ( const DtBallisticComputeComponent &  rhs)
privatedelete

Copy construction is not supported.

virtual makVrv::DtBallisticComputeComponent::~DtBallisticComputeComponent ( )
virtual

Virtual destructor.

Member Function Documentation

virtual std::string makVrv::DtBallisticComputeComponent::buildShaderPreamble ( ) const
virtual

Builds the GLSL preamble prepended to every ballistic shader at load time.

Emits #version 460 core followed by #define directives for all pipeline constants, using MAX_BULLETS and myOctreeDepth.

DtBallisticComputeComponent& makVrv::DtBallisticComputeComponent::operator= ( const DtBallisticComputeComponent &  rhs)
privatedelete

Copy assignment is not supported.

virtual void makVrv::DtBallisticComputeComponent::slot_reloadShaders ( )
virtual

Schedules a shader reload on the next execute() frame; safe to call from any thread.

virtual void makVrv::DtBallisticComputeComponent::slot_windSpeedChanged ( float  metersPerSecond)
virtual

Handles a wind speed changed signal.

Parameters
metersPerSecondNew wind speed in meters per second.
virtual void makVrv::DtBallisticComputeComponent::slot_windDirectionChanged ( float  radians)
virtual

Handles a wind direction changed signal.

Parameters
radiansNew wind direction in radians (clockwise from north).
virtual void makVrv::DtBallisticComputeComponent::execute ( )
virtual

Performs all per-frame GPU compute dispatches; must be overridden by concrete subclasses.

Implements makVrv::DtGpuOperation.

virtual void makVrv::DtBallisticComputeComponent::update ( osg::RenderInfo &  renderInfo)
virtual

Updates GPU-visible state for the current frame.

virtual void makVrv::DtBallisticComputeComponent::apply ( osg::RenderInfo &  renderInfo)
virtual

Applies GPU state for the current frame.

virtual void makVrv::DtBallisticComputeComponent::releaseGLObjects ( osg::State *  state)
virtual

Releases all OpenGL objects associated with this component.

virtual bool makVrv::DtBallisticComputeComponent::shouldDraw ( bool  isShadowPass)
virtual

Returns true if this component should execute during shadow passes.

virtual void makVrv::DtBallisticComputeComponent::drainReleasedSlots ( SlotReleasedCallback  callback)
virtual

Drains the pending-release queue and invokes the callback for each released slot.

Must be called from the CPU/simulation thread to safely access DtOsgBallisticManager state.

Parameters
callbackInvoked once per released slot index.
virtual void makVrv::DtBallisticComputeComponent::setSimulationActive ( bool  active)
virtual

Called by DtOsgBallisticManager from the sim thread to enable or disable GPU dispatches.

When false, execute() releases any outstanding fences and returns immediately. The manager sets this to true when the first bullet is spawned and to false when the pool is empty and no burst rounds are pending.

virtual void makVrv::DtBallisticComputeComponent::beginFrame ( )
virtual

Advances the triple-buffer frame index and binds all persistent buffers.

Must be called once at the start of each GPU execute pass.

virtual void makVrv::DtBallisticComputeComponent::insertFrameFence ( )
virtual

Inserts a GL fence for the current frame's readback buffer slot.

Must be called after all dispatches and buffer copies for the current frame.

virtual void makVrv::DtBallisticComputeComponent::pollReadback ( )
virtual

Non-blocking poll of the oldest readback fence on the GPU thread.

When the fence signals, maps the readback buffer and enqueues newly-dead slot indices for delivery via drainReleasedSlots() on the CPU thread.

virtual void makVrv::DtBallisticComputeComponent::pollQueryReadback ( )
virtual

Non-blocking poll of the query fence; enqueues sound triggers for drainSoundTriggers().

Called once per execute() after pollReadback().

virtual void makVrv::DtBallisticComputeComponent::writeSpawnData ( int  slotIndex,
const BulletSpawn &  spawn 
)
virtual

Writes spawn data for one pool slot into the SpawnBuffer and marks it live.

Parameters
slotIndex0-based pool slot index.
spawnFully populated BulletSpawn structure.
virtual uint32_t makVrv::DtBallisticComputeComponent::registerTracerDefinition ( const DtTracerDefinition &  def,
const float  otherData0[4] 
)
virtual

Searches live slots in the CPU-side tracer type table for an identical configuration and returns its index, incrementing its reference count. If no match is found, recycles a free slot or appends a new entry. Must be called only from the simulation thread.

Parameters
defTracer definition to look up or register.
otherData0The 4-float array from sgObject::getPerObjectData(). Pass all zeros if SensorFX is not loaded or the pip has not been registered. The values are written into the GPU TracerDefinition struct at the tracer type slot, and the vertex shader reads them to write vpOutOtherData0 for per-tracer SensorFX material selection.
Returns
Index into the TracerDefinitionBuffer table.
virtual void makVrv::DtBallisticComputeComponent::unregisterTracerDefinition ( uint32_t  index)
virtual

Decrements the reference count for the given tracer definition slot.

When the count reaches zero the slot is zeroed and returned to the free list for reuse by a future registerTracerDefinition() call. Must be called only from the simulation thread.

Parameters
indexSlot index previously returned by registerTracerDefinition().
virtual void makVrv::DtBallisticComputeComponent::setSlotActive ( int  slotIndex,
uint32_t  active 
)
virtual

Writes the active flag for one StateBuffer slot.

Parameters
slotIndex0-based pool slot index.
active1 to mark alive, 0 to mark dead.
virtual void makVrv::DtBallisticComputeComponent::deactivateSlot ( int  slotIndex)
virtual

Atomically deactivates a pool slot on CPU-initiated removal.

Preferred over setSlotActive(slot, 0) when the CPU is explicitly killing a projectile, as it also prevents a redundant release callback on readback.

Parameters
slotIndex0-based pool slot index.
virtual void makVrv::DtBallisticComputeComponent::updateEnvironment ( float  gravity,
float  windSpeed,
float  windDirection,
float  deltaTime,
double  currentTime 
)
virtual

Updates the BallisticEnvironment UBO staging buffer.

Parameters
gravityGravity magnitude (m/s^2).
windSpeedWind speed (m/s).
windDirectionWind bearing (radians, clockwise from north).
deltaTimeFrame delta time in seconds.
currentTimeAbsolute simulation time in seconds.
virtual void makVrv::DtBallisticComputeComponent::dispatchTrajectoryUpdate ( )
virtual

Dispatches the trajectory update compute shader.

currentTime is read from the BallisticEnvironment UBO (set each execute()).

virtual void makVrv::DtBallisticComputeComponent::dispatchOctreeBuild ( )
virtual

Dispatches the two-pass octree build (bounds pass then insert pass).

virtual void makVrv::DtBallisticComputeComponent::dispatchSoundQuery ( DtOsgBallisticManager *  mgr)
virtual

Dispatches the sound proximity query and sort passes for this frame.

Parameters
mgrBallistic manager; provides observer position cache and sound settings access.
virtual void makVrv::DtBallisticComputeComponent::bindGlobalCullBuffers ( )
virtual

Re-binds the global SSBO/UBO targets consumed by cull shaders (SSBO 1,2,3,11 and UBO 0 only – not the per-camera SSBO 7, 13, UBO 1).

Called before each per-camera cull dispatch.

virtual void makVrv::DtBallisticComputeComponent::bindGlobalDrawBuffers ( )
virtual

Re-binds the global SSBO/UBO targets consumed by draw shaders (SSBO 1 only).

Per-camera buffer bindings (SSBO 12, UBO 1) are set up by DtBallisticRendererUserData::bindForDraw().

virtual void makVrv::DtBallisticComputeComponent::drainSoundTriggers ( std::function< void(const std::vector< std::vector< DtBallisticSoundTrigger >> &)>  callback)
virtual

Drain all pending sound trigger frame batches; invokes callback on the drained batch.

Must be called from the simulation tick thread in DtOsgBallisticManager::slot_postTick(). Each inner vector is one frame's raw GPU results; the proxy classifies and deduplicates them. Mirrors drainReleasedSlots() but for sound triggers.

Parameters
callbackInvoked with all pending per-frame batches.
virtual void makVrv::DtBallisticComputeComponent::unbindCullBuffers ( )
virtual

Unbinds all SSBO and UBO binding points used by the ballistic pipeline.

virtual void makVrv::DtBallisticComputeComponent::unbindDrawBuffers ( )
virtual

Unbinds all SSBO and UBO binding points without resetting the active GL program.

Called after the draw pass to restore clean indexed-buffer state while keeping the VirtualProgram's composed program active so OSG tracking stays consistent.

virtual void makVrv::DtBallisticComputeComponent::initIndirectDrawCommands ( GLuint  indexCount)
virtual

Stores the mesh index count for use in indirect draw command initialization.

Called once from DtBallisticDrawComponent::initialize() after the bullet mesh is created.

Parameters
indexCountNumber of indices in the bullet mesh element buffer.
virtual void makVrv::DtBallisticComputeComponent::setFrustumCullMode ( CullMode  mode)
virtual

Selects the frustum cull algorithm; takes effect on the next cull dispatch.

virtual CullMode makVrv::DtBallisticComputeComponent::frustumCullMode ( ) const
virtual

Returns the active frustum cull algorithm.

virtual void makVrv::DtBallisticComputeComponent::setProximityQueryMode ( QueryMode  mode)
virtual

Selects the proximity query algorithm; takes effect on the next query dispatch.

virtual QueryMode makVrv::DtBallisticComputeComponent::proximityQueryMode ( ) const
virtual

Returns the active proximity query algorithm.

virtual void makVrv::DtBallisticComputeComponent::setGravity ( float  gravity)
virtual

Sets the gravity magnitude applied to all projectiles (m/s^2).

virtual float makVrv::DtBallisticComputeComponent::gravity ( ) const
virtual

Returns the gravity magnitude (m/s^2).

virtual void makVrv::DtBallisticComputeComponent::setMaxQueryResults ( int  n)
virtual

Sets the maximum query results read back per frame.

Must be called before initializeBuffers() runs (i.e. before the first GPU execute pass). Values less than 1 are clamped to 1; values greater than the GPU sort workgroup size are clamped to that ceiling.

Parameters
nDesired maximum result count.
virtual void makVrv::DtBallisticComputeComponent::dispatchFrustumCull ( )
virtual

Dispatches the brute-force frustum cull shader for the current camera.

Per-camera UBO and visible/indirect SSBOs must already be bound via bindForCull() on the DtBallisticRendererUserData before calling this.

virtual void makVrv::DtBallisticComputeComponent::dispatchOctreeCull ( )
virtual

Dispatches the two-pass octree frustum cull for the current camera.

Per-camera UBO and visible/indirect SSBOs must already be bound via bindForCull() on the DtBallisticRendererUserData before calling this.

virtual void makVrv::DtBallisticComputeComponent::dispatchGatherActiveFlags ( )
virtual

Dispatches the gather-active-flags shader and copies results to the readback buffer.

virtual void makVrv::DtBallisticComputeComponent::bindProjectileBuffer ( unsigned int  bindingPoint)
virtual

Binds the SpawnBuffer SSBO to an arbitrary binding point.

Parameters
bindingPointTarget SSBO binding point.
virtual DtBallisticDrawComponent* makVrv::DtBallisticComputeComponent::drawComponent ( ) const
virtual

Returns the shared draw component.

virtual void makVrv::DtBallisticComputeComponent::debugDumpBuffers ( )
virtual

Debug readback: dumps active bullet state and buffer statistics to stdout.

For debug builds only. Calling this stalls the GPU pipeline.

virtual void makVrv::DtBallisticComputeComponent::debugDrawCullResults ( DtGlBuffer *  visibleSSBO)
virtual

Maps the GPU StateBuffer and the provided per-camera VisibleBulletLists SSBO to render a sphere per active bullet.

Green spheres passed the GPU frustum cull; red spheres were culled out. Active when DebugTrajectoryVis is set. Stalls the GPU pipeline – debug use only.

Parameters
visibleSSBOPer-camera visible bullet SSBO.
virtual void makVrv::DtBallisticComputeComponent::debugDrawPositions ( )
virtual

Maps the GPU StateBuffer to render a position-only sphere per active bullet.

All spheres are drawn in orange regardless of cull state. Called by DtBallisticDebugGeometry on every cull pass when DebugTrajectoryVis is set. When ShowTracers is also enabled for the same camera, debugDrawCullResults() is called afterwards (the ShowTracers DtChannelSpecificGroup is a later sibling in the model-set root) and overwrites the same DtDebugShapes name keys with cull-state-colored spheres. Stalls the GPU pipeline – debug use only.

virtual void makVrv::DtBallisticComputeComponent::debugDumpCullBuffers ( DtGlBuffer *  visibleSSBO)
virtual

Dumps visible bullet count and indices for the provided per-camera SSBO to stdout.

Stalls the GPU pipeline – debug use only.

Parameters
visibleSSBOPer-camera visible bullet SSBO.
virtual void makVrv::DtBallisticComputeComponent::initializeBuffers ( )
virtual

One-time creation of all GPU buffers (SSBOs, UBOs, readback buffers).

Called from execute() on the first frame. Subsequent calls are no-ops. Mirrors the separation used by DtBallisticDrawComponent::initialize().

virtual void makVrv::DtBallisticComputeComponent::doReloadShaders ( )
virtual

Performs the actual GL shader (re)initialization; must be called on the GL thread.

virtual void makVrv::DtBallisticComputeComponent::recomputeOctreeConstants ( )
protectedvirtual

Recomputes myLeafCount, myOctreeTotalNodes, myInternalNodeCount, and myBulletsPerLeaf from MAX_BULLETS and myOctreeDepth.

Member Data Documentation

constexpr uint32_t makVrv::DtBallisticComputeComponent::MAX_BULLETS = 16384
static

Maximum bullet pool slots in SpawnBuffer/StateBuffer. Injected into shaders via buildShaderPreamble().

friend makVrv::DtBallisticComputeComponent::DtBallisticComputeComponentCreator
DtDe& makVrv::DtBallisticComputeComponent::myDe
protected

Reference to the simulation environment.

DtSignalConnectionManager makVrv::DtBallisticComputeComponent::myConnections
protected

Manages signal connections for wind change notifications.

float makVrv::DtBallisticComputeComponent::myGravity
protected

Current gravity magnitude (m/s^2).

float makVrv::DtBallisticComputeComponent::myWindSpeed
protected

Current wind speed (m/s).

float makVrv::DtBallisticComputeComponent::myWindDirection
protected

Current wind direction (radians, clockwise from north).

uint32_t makVrv::DtBallisticComputeComponent::myOctreeDepth
protected

Current octree depth; all derived octree constants are recomputed when this changes.

uint32_t makVrv::DtBallisticComputeComponent::myLeafCount
protected

8^myOctreeDepth leaf nodes.

uint32_t makVrv::DtBallisticComputeComponent::myOctreeTotalNodes
protected

Total nodes in the uniform octree (breadth-first).

uint32_t makVrv::DtBallisticComputeComponent::myInternalNodeCount
protected

Internal (non-leaf) node count; used to size the node-flags SSBO.

uint32_t makVrv::DtBallisticComputeComponent::myBulletsPerLeaf
protected

Bullet slots per leaf = MAX_BULLETS / myLeafCount.

const DtBallisticRunTimeSettings& makVrv::DtBallisticComputeComponent::myBallisticRunTimeSettings
protected

Reference to the shared ballistic runtime settings.

bool makVrv::DtBallisticComputeComponent::myMutableShadersFailedToCompile
mutableprotected

True if the most recent shader compilation failed.

DtGlProgram* makVrv::DtBallisticComputeComponent::myTrajectoryProgram
protected

Compute program for trajectory integration.

DtGlProgram* makVrv::DtBallisticComputeComponent::myOctreeBoundsProgram
protected

Compute program for octree bounds calculation.

DtGlProgram* makVrv::DtBallisticComputeComponent::myOctreeStructureProgram
protected

Compute program for octree structure build.

DtGlProgram* makVrv::DtBallisticComputeComponent::myOctreeInsertProgram
protected

Compute program for octree bullet insertion.

DtGlProgram* makVrv::DtBallisticComputeComponent::myActiveFlagProgram
protected

Compute program for gathering active-flags.

DtGlProgram* makVrv::DtBallisticComputeComponent::myFrustumCullProgram
protected

Compute program for brute-force frustum cull.

DtGlProgram* makVrv::DtBallisticComputeComponent::myOctreeMarkProgram
protected

Compute program for octree internal-node frustum mark pass.

DtGlProgram* makVrv::DtBallisticComputeComponent::myOctreeLeafProgram
protected

Compute program for octree leaf frustum cull pass.

DtGlProgram* makVrv::DtBallisticComputeComponent::myProximityQueryProgram
protected

Compute program for brute-force proximity queries.

DtGlProgram* makVrv::DtBallisticComputeComponent::myProximityQueryOctreeProgram
protected

Compute program for octree-accelerated proximity queries.

CullMode makVrv::DtBallisticComputeComponent::myCullMode
protected

Active frustum cull algorithm.

QueryMode makVrv::DtBallisticComputeComponent::myQueryMode
protected

Active proximity query algorithm.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myEnvironmentUBO
protected

BallisticEnvironment UBO (gravity, wind, deltaTime, currentTime).

DtGlBuffer* makVrv::DtBallisticComputeComponent::mySpawnSSBO
protected

SpawnBuffer SSBO (immutable per-bullet spawn data).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myStateSSBO
protected

StateBuffer SSBO (GPU-updated per-bullet state).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myOctreeSSBO
protected

OctreeBuffer SSBO (octree node array).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myOctreeBulletListSSBO
protected

OctreeBulletLists SSBO (per-leaf bullet index arrays).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myBoundsSSBO
protected

BoundsBuffer SSBO (world AABB for octree root).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myNodeCounterSSBO
protected

NodeCounter SSBO (total node and bullet-list counts).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myActiveFlagSSBO
protected

Dense active-flag output buffer used for CPU readback.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myOctreeNodeFlagsSSBO
protected

OctreeNodeFlags SSBO (per-node frustum visibility from the mark pass).

DtGlBuffer* makVrv::DtBallisticComputeComponent::myTracerDefinitionSSBO = nullptr
protected

TracerDefinitionBuffer SSBO (per-type tracer visual/physical parameters).

std::vector<TracerDefinition> makVrv::DtBallisticComputeComponent::myTracerDefTable
protected

CPU-side table of registered tracer types; mirrored to myTracerDefinitionSSBO each frame.

std::vector<int32_t> makVrv::DtBallisticComputeComponent::myTracerDefRefCounts
protected

Reference count per entry in myTracerDefTable; zero means the slot is free and available for reuse.

std::vector<uint32_t> makVrv::DtBallisticComputeComponent::myFreeTracerSlots
protected

Indices of free slots in myTracerDefTable (reference count == 0), available for reuse.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myReadbackBuffer[3]
protected

Triple-buffered CPU-mappable readback buffers (one per frame slot).

GLsync makVrv::DtBallisticComputeComponent::myFenceSync[3]
protected

GL sync fence per triple-buffer slot.

int makVrv::DtBallisticComputeComponent::myFrameIndex
protected

Current triple-buffer frame slot (cycles 0, 1, 2).

std::vector<uint64_t> makVrv::DtBallisticComputeComponent::myLifeTracker
protected

Per-slot CPU liveness tracker; 0 = free, non-zero = frame number when spawned.

Stores the value of (myGlobalFrameCount + 1) at the time writeSpawnData() is called. pollReadback() only considers a slot dead when the readback frame >= the spawn frame, preventing false deaths from stale readback data that predates the spawn.

uint64_t makVrv::DtBallisticComputeComponent::myGlobalFrameCount
protected

Monotonically increasing frame counter, incremented once per execute().

uint64_t makVrv::DtBallisticComputeComponent::myReadbackFrameNumber[3]
protected

Records which global frame wrote each triple-buffer readback slot.

Set in execute() after dispatchGatherActiveFlags(); read in pollReadback() to compare against each slot's spawn frame.

std::vector<int> makVrv::DtBallisticComputeComponent::myPendingReleasedSlots
protected

Slot indices confirmed dead by GPU readback, pending CPU-thread processing.

std::mutex makVrv::DtBallisticComputeComponent::myPendingReleasedSlotsMutex
protected

Guards myPendingReleasedSlots for cross-thread access.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myQueryInputSSBO[3]
protected

Triple-buffer query input – one ProximityQuery per slot.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myQueryResultSSBO[3]
protected

Triple-buffer query compute results – VRAM; written by sort shader via SSBO.

DtGlBuffer* makVrv::DtBallisticComputeComponent::myQueryReadbackSSBO[3]
protected

Triple-buffer query readback – pinned RAM; populated by glCopyNamedBufferSubData; CPU maps this.

GLsync makVrv::DtBallisticComputeComponent::myQueryFence[3]
protected

GL sync fence per query triple-buffer slot; nullptr until first dispatch.

DtGlProgram* makVrv::DtBallisticComputeComponent::myQuerySortProgram
protected

Sort shader (sort_query_results.cs.glsl).

int makVrv::DtBallisticComputeComponent::myMaxQueryResults
protected

Maximum result entries to read back per frame; immutable after init.

bool makVrv::DtBallisticComputeComponent::myWarnedSoundProgramNull
mutableprotected

One-shot warning flag for dispatchSoundQuery() early-return conditions.

std::vector<std::vector<DtBallisticSoundTrigger> > makVrv::DtBallisticComputeComponent::myPendingSoundTriggers
protected

Pending raw sound trigger frame batches enqueued by pollQueryReadback(); drained each tick. Each inner vector is one frame's GPU proximity query results; classification is done by the proxy.

std::mutex makVrv::DtBallisticComputeComponent::myPendingSoundTriggersMutex
protected

Guards myPendingSoundTriggers for render/sim cross-thread access.

std::atomic<bool> makVrv::DtBallisticComputeComponent::myPendingShaderReload
protected

Set from any thread by slot_reloadShaders(); consumed on the GL thread at the top of execute().

std::atomic<bool> makVrv::DtBallisticComputeComponent::mySimulationActive
protected

True when the manager has active bullets or pending burst rounds. Written by the sim thread via setSimulationActive(); read by the GL thread in execute().

int makVrv::DtBallisticComputeComponent::myActiveSlotCount
protected

Number of slots currently non-zero in myLifeTracker.

Maintained by writeSpawnData() (+1), deactivateSlot() (-1 if slot was live), and pollReadback() (-1 per newly-dead slot). Used by the octree-overflow warning in execute() to avoid an O(MAX_BULLETS) count_if scan each frame.

double makVrv::DtBallisticComputeComponent::myLastFrameTime
protected

Simulation time of the previous execute() call, used to compute deltaTime.

DtIndirectShaderManager& makVrv::DtBallisticComputeComponent::myIndirectShaderManager
protected

Shared indirect shader manager for loading/caching compute shaders.

bool makVrv::DtBallisticComputeComponent::myBuffersInitialized
protected

True after initializeBuffers() has completed; reset by releaseGLObjects().

DtBallisticDrawComponent* makVrv::DtBallisticComputeComponent::mySharedDrawComponent
protected

Shared draw component; all ballistic geometries reference this single instance.

GLuint makVrv::DtBallisticComputeComponent::myMeshIndexCount
protected

Mesh index count set by initIndirectDrawCommands(); cached for reference.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)