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

OSG Drawable that drives per-camera GPU cull and draw for a ballistic spatial cell.

Owns a spatial cell assignment and delegates GPU compute (cull) and draw calls to the shared DtBallisticComputeComponent and DtBallisticDrawComponent.

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

Public Member Functions

virtual void setName (const std::string &name) override
 
virtual void setCellId (const Vector3_int &cellId)
 
virtual const unsigned int id (void) const
 
virtual void setRenderer (DtBallisticRenderer *drawerNode)
 
virtual const char * className () const
 
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 
virtual void debugDrawImplementation (osg::RenderInfo &renderInfo, const osg::Matrixd &modelViewMatrix, DtGlBuffer *visibleSSBO, DtGlBuffer *indirectSSBO)
 
virtual void accept (osg::NodeVisitor &nv)
 
void shutdown ()
 
virtual void releaseGLObjects (osg::State *state) const override
 
virtual void accept (osg::PrimitiveFunctor &functor) const override
 
virtual void setLocalOriginTransform (const osg::Matrixd &localOriginTransform)
 
virtual void perCameraUpdateAndCull (const osg::Camera *camera, const osg::Matrix &modelViewMatrix, const osg::FrameStamp *frameStamp, DtBallisticRendererUserData *userData)
 
virtual void addProjectile (int slot, DtBallisticProjectile *projectile)
 
virtual void removeProjectile (int slot)
 
int projectileCount () const
 
bool hasSlot (int slot) const
 
DtBallisticDrawComponent * drawComponent () const
 

Public Attributes

friend DtBallisticGeometryCreator
 

Protected Member Functions

 DtBallisticGeometry (DtDe &de, DtBallisticComputeComponent &computeComponent)
 
virtual ~DtBallisticGeometry ()
 
virtual void drawImplementation (osg::RenderInfo &renderInfo, const osg::Matrixd &modelViewMatrix, bool isLightBin, bool isDepthBin, bool isShadowPass, DtGlBuffer *visibleSSBO, DtGlBuffer *indirectSSBO) const
 

Protected Attributes

DtDe & myDe
 
DtBallisticComputeComponent * myComputeComponent
 
std::unordered_map< int,
DtBallisticProjectile * > 
myActiveSlots
 
std::atomic< int > myProjectileCount
 
osg::Matrixd myLocalOriginTransformMatrix
 
unsigned int myId
 
Vector3_int myCellId
 
osg::ref_ptr< osg::StateSet > myDrawStateSet
 
DtBallisticDrawComponent * myDrawComponent
 
DtBallisticRenderer * myBallisticRenderer
 
const DtBallisticRunTimeSettings & myBallisticRunTimeSettings
 

Private Member Functions

 DtBallisticGeometry ()=delete
 
 DtBallisticGeometry (const DtBallisticGeometry &other)=delete
 
DtBallisticGeometry & operator= (const DtBallisticGeometry &other)=delete
 

Friends

class DtBallisticRendererUserData
 

Constructor & Destructor Documentation

makVrv::DtBallisticGeometry::DtBallisticGeometry ( DtDe &  de,
DtBallisticComputeComponent &  computeComponent 
)
protected

Protected constructor; use the creator factory to instantiate.

Parameters
deSimulation environment.
computeComponentShared compute component used for GPU dispatches.
virtual makVrv::DtBallisticGeometry::~DtBallisticGeometry ( )
protectedvirtual

Virtual destructor.

makVrv::DtBallisticGeometry::DtBallisticGeometry ( )
privatedelete

Default construction is not supported.

makVrv::DtBallisticGeometry::DtBallisticGeometry ( const DtBallisticGeometry &  other)
privatedelete

Copy construction is not supported.

Member Function Documentation

DtBallisticGeometry& makVrv::DtBallisticGeometry::operator= ( const DtBallisticGeometry &  other)
privatedelete

Copy assignment is not supported.

virtual void makVrv::DtBallisticGeometry::setName ( const std::string &  name)
overridevirtual

Sets the OSG node name.

Parameters
nameNew name for the node.
virtual void makVrv::DtBallisticGeometry::setCellId ( const Vector3_int &  cellId)
virtual

Sets the spatial cell ID for this geometry.

Parameters
cellIdGrid cell coordinates assigned by DtBallisticSpatialGrid.
virtual const unsigned int makVrv::DtBallisticGeometry::id ( void  ) const
virtual

Returns the unique integer ID of this geometry instance.

virtual void makVrv::DtBallisticGeometry::setRenderer ( DtBallisticRenderer *  drawerNode)
virtual

Sets the owning ballistic renderer.

Parameters
drawerNodePointer to the renderer that manages this geometry.
virtual const char* makVrv::DtBallisticGeometry::className ( ) const
virtual

Returns the OSG class name string for this type.

virtual void makVrv::DtBallisticGeometry::drawImplementation ( osg::RenderInfo &  renderInfo) const
virtual

Performs per-camera GPU cull dispatches and issues the instanced draw call.

virtual void makVrv::DtBallisticGeometry::debugDrawImplementation ( osg::RenderInfo &  renderInfo,
const osg::Matrixd &  modelViewMatrix,
DtGlBuffer *  visibleSSBO,
DtGlBuffer *  indirectSSBO 
)
virtual

Draws debug visualisation (bounding boxes or velocity vectors) for all active bullets.

Parameters
renderInfoOSG render info for the current frame.
modelViewMatrixCurrent model-view matrix.
visibleSSBOPer-camera visible bullet list SSBO (owned by DtBallisticRendererUserData).
indirectSSBOPer-camera indirect draw command SSBO.
virtual void makVrv::DtBallisticGeometry::accept ( osg::NodeVisitor &  nv)
virtual

Overrides osg::Drawable::accept() to perform pre-draw state setup during the cull pass.

void makVrv::DtBallisticGeometry::shutdown ( )

Severs this cell's back-reference to the shared compute component before that component is released on a display-config reload.

The cell is owned by DtBallisticSpatialGrid (osg::ref_ptr) and the OSG scene graph may keep it alive after the owning manager deletes the compute component. Nulling the pointer here makes the cull and draw paths safe no-ops for the remainder of this cell's lifetime, preventing a dereference through freed memory during the next cull traversal. This mirrors DtBallisticDebugGeometry::shutdown() and DtBallisticSpatialGridNode::shutdown().

virtual void makVrv::DtBallisticGeometry::releaseGLObjects ( osg::State *  state) const
overridevirtual

Releases all OpenGL objects associated with this geometry.

virtual void makVrv::DtBallisticGeometry::accept ( osg::PrimitiveFunctor &  functor) const
overridevirtual

Overrides osg::Drawable::accept() for primitive functor support.

virtual void makVrv::DtBallisticGeometry::setLocalOriginTransform ( const osg::Matrixd &  localOriginTransform)
virtual

Sets the local-origin transform used to anchor this geometry in world space.

Parameters
localOriginTransformThe new local-origin matrix.
virtual void makVrv::DtBallisticGeometry::perCameraUpdateAndCull ( const osg::Camera *  camera,
const osg::Matrix &  modelViewMatrix,
const osg::FrameStamp *  frameStamp,
DtBallisticRendererUserData *  userData 
)
virtual

Updates per-camera data and dispatches the frustum-cull compute pass.

Parameters
cameraOSG camera for this view.
modelViewMatrixCurrent model-view matrix.
frameStampCurrent OSG frame stamp.
userDataPer-camera user data owning the GPU buffers for this camera.
virtual void makVrv::DtBallisticGeometry::addProjectile ( int  slot,
DtBallisticProjectile *  projectile 
)
virtual

Registers a projectile slot as belonging to this geometry cell.

Called once per spawned round. The projectile pointer is non-owning; lifetime is managed by DtBallisticProjectilePool.

Parameters
slotPool slot index (stable offset into SpawnBuffer/StateBuffer).
projectileNon-owning pointer to the projectile occupying this slot.
virtual void makVrv::DtBallisticGeometry::removeProjectile ( int  slot)
virtual

Removes a projectile slot from this geometry cell.

Safe to call for a slot not currently registered (no-op). Called on both the CPU-kill path (removeProjectiles) and the GPU-expiry drain path.

Parameters
slotPool slot index previously passed to addProjectile().
int makVrv::DtBallisticGeometry::projectileCount ( ) const

Returns the number of projectile slots currently registered to this cell.

bool makVrv::DtBallisticGeometry::hasSlot ( int  slot) const

Returns true if the given pool slot is registered to this cell.

Used by the manager to route GPU-expiry and CPU-kill notifications to the correct geometry without iterating all cells.

Parameters
slotPool slot index to query.
DtBallisticDrawComponent* makVrv::DtBallisticGeometry::drawComponent ( ) const

Returns the shared draw component.

virtual void makVrv::DtBallisticGeometry::drawImplementation ( osg::RenderInfo &  renderInfo,
const osg::Matrixd &  modelViewMatrix,
bool  isLightBin,
bool  isDepthBin,
bool  isShadowPass,
DtGlBuffer *  visibleSSBO,
DtGlBuffer *  indirectSSBO 
) const
protectedvirtual

Internal draw implementation for a specific render pass.

Friends And Related Function Documentation

friend class DtBallisticRendererUserData
friend

Member Data Documentation

friend makVrv::DtBallisticGeometry::DtBallisticGeometryCreator
DtDe& makVrv::DtBallisticGeometry::myDe
protected

Reference to the simulation environment.

DtBallisticComputeComponent* makVrv::DtBallisticGeometry::myComputeComponent
protected

Shared compute component used for GPU dispatches; non-owning and set to null by shutdown() after the component is released on a display-config reload.

std::unordered_map<int, DtBallisticProjectile*> makVrv::DtBallisticGeometry::myActiveSlots
protected

Map of active pool slot indices to their projectile pointers for this cell. Non-owning pointers; lifetime is managed by DtBallisticProjectilePool. Written exclusively from the main thread.

std::atomic<int> makVrv::DtBallisticGeometry::myProjectileCount
protected

Cached count of myActiveSlots.size(); written from the main thread, read from render threads. std::atomic ensures visibility without a lock.

osg::Matrixd makVrv::DtBallisticGeometry::myLocalOriginTransformMatrix
protected

Local-origin transform matrix anchoring this geometry in world space.

unsigned int makVrv::DtBallisticGeometry::myId
protected

Unique integer ID for this geometry instance.

Vector3_int makVrv::DtBallisticGeometry::myCellId
protected

Spatial cell ID assigned by DtBallisticSpatialGrid.

osg::ref_ptr<osg::StateSet> makVrv::DtBallisticGeometry::myDrawStateSet
protected

OSG state set applied during the draw pass.

DtBallisticDrawComponent* makVrv::DtBallisticGeometry::myDrawComponent
protected

Shared draw component; non-owning pointer.

DtBallisticRenderer* makVrv::DtBallisticGeometry::myBallisticRenderer
protected

Non-owning pointer to the renderer that owns this geometry.

const DtBallisticRunTimeSettings& makVrv::DtBallisticGeometry::myBallisticRunTimeSettings
protected

Reference to the shared ballistic runtime settings.


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)