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.
Protected constructor; use the creator factory to instantiate.
- Parameters
-
| de | Simulation environment. |
| computeComponent | Shared compute component used for GPU dispatches. |
| virtual makVrv::DtBallisticGeometry::~DtBallisticGeometry |
( |
| ) |
|
|
protectedvirtual |
| makVrv::DtBallisticGeometry::DtBallisticGeometry |
( |
| ) |
|
|
privatedelete |
Default construction is not supported.
Copy construction is not supported.
Copy assignment is not supported.
| virtual void makVrv::DtBallisticGeometry::setName |
( |
const std::string & |
name | ) |
|
|
overridevirtual |
Sets the OSG node name.
- Parameters
-
| name | New name for the node. |
| virtual void makVrv::DtBallisticGeometry::setCellId |
( |
const Vector3_int & |
cellId | ) |
|
|
virtual |
Sets the spatial cell ID for this geometry.
- Parameters
-
| virtual const unsigned int makVrv::DtBallisticGeometry::id |
( |
void |
| ) |
const |
|
virtual |
Returns the unique integer ID of this geometry instance.
Sets the owning ballistic renderer.
- Parameters
-
| drawerNode | Pointer 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
-
| renderInfo | OSG render info for the current frame. |
| modelViewMatrix | Current model-view matrix. |
| visibleSSBO | Per-camera visible bullet list SSBO (owned by DtBallisticRendererUserData). |
| indirectSSBO | Per-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
-
| localOriginTransform | The 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
-
| camera | OSG camera for this view. |
| modelViewMatrix | Current model-view matrix. |
| frameStamp | Current OSG frame stamp. |
| userData | Per-camera user data owning the GPU buffers for this camera. |
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
-
| slot | Pool slot index (stable offset into SpawnBuffer/StateBuffer). |
| projectile | Non-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
-
| 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
-
| slot | Pool slot index to query. |
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.
| friend makVrv::DtBallisticGeometry::DtBallisticGeometryCreator |
| DtDe& makVrv::DtBallisticGeometry::myDe |
|
protected |
Reference to the simulation environment.
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.
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.
Unique integer ID for this geometry instance.
| osg::ref_ptr<osg::StateSet> makVrv::DtBallisticGeometry::myDrawStateSet |
|
protected |
OSG state set applied during the draw pass.
Shared draw component; non-owning pointer.
Non-owning pointer to the renderer that owns this geometry.
Reference to the shared ballistic runtime settings.
The documentation for this class was generated from the following file: