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
makVrv::DtBallisticDrawComponent Class Reference

Interface for the ballistic rendering draw pass.

Manages the VirtualProgram state, mesh geometry, and additive-blend GL state needed to issue instanced draw calls for visible projectiles. Instantiated via the DtBallisticDrawComponentCreator factory.

Public Member Functions

virtual ~DtBallisticDrawComponent ()
 
virtual void initialize ()
 
virtual void update (osg::RenderInfo &renderInfo)
 
virtual void apply (osg::RenderInfo &renderInfo)
 
virtual void drawBullets (DtGlBuffer *visibleSSBO, DtGlBuffer *indirectDrawSSBO)
 
virtual void drawDebug (osg::RenderInfo &renderInfo, DtGlBuffer *visibleSSBO, DtGlBuffer *indirectDrawSSBO, int debugMode)
 
virtual void releaseGLObjects (osg::State *state)
 
virtual bool shouldDraw (bool isShadowPass)
 
void unbindCullBuffers ()
 
void unbindDrawBuffers ()
 
virtual void slot_reloadShaders ()
 
void setComputeComponent (DtBallisticComputeComponent *computeComponent)
 

Public Attributes

friend DtBallisticDrawComponentCreator
 

Protected Member Functions

 DtBallisticDrawComponent (DtDe &de)
 

Protected Attributes

DtDe & myDe
 
DtSignalConnectionManager myConnections
 
const DtBallisticRunTimeSettings & myBallisticRunTimeSettings
 
osg::ref_ptr< osg::StateSet > myStateSet
 
DtIndirectShaderManager & myIndirectShaderManager
 
GLuint myMeshVao
 
GLuint myMeshVbo
 
GLuint myMeshEbo
 
int myMeshIndexCount
 
bool myVPInitialized
 
osg::ref_ptr< osg::StateSet > myDebugStateSet
 
bool myDebugVPInitialized
 
DtBallisticComputeComponent * myComputeComponent
 

Private Member Functions

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

Constructor & Destructor Documentation

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

Protected constructor; use the creator factory to instantiate.

Parameters
deSimulation environment.
virtual makVrv::DtBallisticDrawComponent::~DtBallisticDrawComponent ( )
virtual

Virtual destructor.

makVrv::DtBallisticDrawComponent::DtBallisticDrawComponent ( )
privatedelete

Default construction is not supported.

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

Copy construction is not supported.

Member Function Documentation

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

Copy assignment is not supported.

virtual void makVrv::DtBallisticDrawComponent::initialize ( )
virtual

One-time creation of the StateSet (blend, depth attributes) and bullet mesh.

Called from update() on the first frame. Subsequent calls are no-ops. Mirrors DtIndirectDefaultDrawComponent::initialize().

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

Ensures the VirtualProgram is initialized; no-op after the first call.

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

Applies the VirtualProgram StateSet and sets raw GL blend/depth state for bullet rendering.

virtual void makVrv::DtBallisticDrawComponent::drawBullets ( DtGlBuffer *  visibleSSBO,
DtGlBuffer *  indirectDrawSSBO 
)
virtual

Issues the indirect draw call for this camera's visible bullets.

The per-camera buffer bindings (SSBO 12, UBO 1) are set up by the caller via DtBallisticRendererUserData::bindForDraw() before this is called.

Parameters
visibleSSBOThe per-camera VisibleBulletLists SSBO.
indirectDrawSSBOThe per-camera IndirectDrawCommands SSBO.
virtual void makVrv::DtBallisticDrawComponent::drawDebug ( osg::RenderInfo &  renderInfo,
DtGlBuffer *  visibleSSBO,
DtGlBuffer *  indirectDrawSSBO,
int  debugMode 
)
virtual

Draws debug visualisation lines for active DtBallisticRunTimeSettings toggles.

Parameters
renderInfoOSG render info for state application.
visibleSSBOThe per-camera VisibleBulletLists SSBO.
indirectDrawSSBOThe per-camera IndirectDrawCommands SSBO.
debugMode0 = bounding boxes, 1 = velocity vectors.
virtual void makVrv::DtBallisticDrawComponent::releaseGLObjects ( osg::State *  state)
virtual

Releases all OpenGL objects associated with this component.

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

Returns true if this component should execute during shadow passes.

void makVrv::DtBallisticDrawComponent::unbindCullBuffers ( )

Unbinds all ballistic SSBO/UBO binding points via the compute component.

Called after the draw pass completes to restore clean indexed-buffer state. Also clears the active GL program via glUseProgram(0). Use only from non-draw paths (cull, compute, query).

void makVrv::DtBallisticDrawComponent::unbindDrawBuffers ( )

Unbinds SSBO/UBO binding points without clearing the GL program.

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

virtual void makVrv::DtBallisticDrawComponent::slot_reloadShaders ( )
virtual

Reloads the render shaders.

void makVrv::DtBallisticDrawComponent::setComputeComponent ( DtBallisticComputeComponent *  computeComponent)

Provides the compute component reference used to bind the BallisticCameraUbo at draw time.

Called once from DtBallisticComputeComponent constructor after the draw component is created.

Member Data Documentation

friend makVrv::DtBallisticDrawComponent::DtBallisticDrawComponentCreator
DtDe& makVrv::DtBallisticDrawComponent::myDe
protected

Reference to the simulation environment.

DtSignalConnectionManager makVrv::DtBallisticDrawComponent::myConnections
protected

Manages signal connections for shader reload notifications.

const DtBallisticRunTimeSettings& makVrv::DtBallisticDrawComponent::myBallisticRunTimeSettings
protected

Reference to the shared ballistic runtime settings.

osg::ref_ptr<osg::StateSet> makVrv::DtBallisticDrawComponent::myStateSet
protected

OSG state set carrying the render VirtualProgram.

DtIndirectShaderManager& makVrv::DtBallisticDrawComponent::myIndirectShaderManager
protected

Reference to the indirect shader manager used to load shaders.

GLuint makVrv::DtBallisticDrawComponent::myMeshVao
protected

OpenGL VAO for the bullet mesh.

GLuint makVrv::DtBallisticDrawComponent::myMeshVbo
protected

Interleaved position and normal VBO for the bullet mesh.

GLuint makVrv::DtBallisticDrawComponent::myMeshEbo
protected

Element index buffer for the bullet mesh.

int makVrv::DtBallisticDrawComponent::myMeshIndexCount
protected

Number of indices in the element buffer.

bool makVrv::DtBallisticDrawComponent::myVPInitialized
protected

True after the render VirtualProgram has been installed on myStateSet.

osg::ref_ptr<osg::StateSet> makVrv::DtBallisticDrawComponent::myDebugStateSet
protected

OSG state set carrying the debug VirtualProgram.

bool makVrv::DtBallisticDrawComponent::myDebugVPInitialized
protected

True after the debug VirtualProgram has been installed on myDebugStateSet.

DtBallisticComputeComponent* makVrv::DtBallisticDrawComponent::myComputeComponent
protected

Compute component providing the BallisticCameraUbo for binding at draw time.


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)