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

This class inherits from.

See Also
osg::Drawable, which allows us to hook into our indirect engine to render using indirect rendering. In the case of Features, the
DtIndirectGeometry is parented to the feature tile nodes and manages the indirect rendering of all the feature points in that tile. For paging databases it manages the indirect rendering of a complete tile. For terrain patches it manages the indirect rendering of the full patch. For entities the
DtIndirectGeometry is managed by a
DtIndirectGeometryGrid which has a
DtIndirectGeometry per geo cell. Contains some managers for processing the state (
DtIndirectSwitchManager,
DtIndirectDofManager,
DtIndirectLodManager,
DtIndirectUvOffsetManager,
DtIndirectPerInstanceDataManager) Uses a
DtGpuCulling object for processing the state of the entities and culling them to setup the command buffer for drawing. Finally
DtIndirectDrawComponent objects are used to draw the geometry based on the state
Inheritance diagram for makVrv::DtIndirectGeometry:
Inheritance graph
[legend]

Classes

struct  DebugInstanceSnapshotEntry
 
struct  DebugQueueHealthSnapshot
 
struct  TotalCounter
 

Public Member Functions

virtual void doShutdown ()
 
virtual void cancelShutdown ()
 
virtual bool isShutdown () const
 
virtual void setName (const std::string &name) override
 
virtual void setRenderer (DtIndirectGeometryRenderer *drawerNode)
 
virtual void setRegistrar (DtIndirectGeometryRegistrar *registrar)
 
virtual
DtIndirectGeometryRegistrar * 
registrar ()
 
virtual const char * className () const
 
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 
virtual void debugDrawImplementation (osg::RenderInfo &renderInfo, const osg::Matrixd &modelViewMatrix)
 
virtual int addInstance (const DtIndirectGeometryInstance &instance)
 
virtual int addInstance (int modelId, const osg::Matrixd &xForm, float modelScale, float modelRadius, int lightPointGroupId, bool trackLifeTime, const std::string &trackName, bool defaultVisibility=true)
 
virtual void accept (osg::NodeVisitor &nv)
 
virtual void setParent (const osg::Group *parent)
 
virtual void setRegistrarInvalid (void)
 
virtual void releaseGLObjects (osg::State *state) const override
 
virtual void accept (osg::PrimitiveFunctor &functor) const override
 
virtual void setupIndirectShaders ()
 
virtual void setLocalOriginTransform (const osg::Matrixd &localOriginTransform)
 
virtual const osg::Matrixd & localOriginTransform () const
 
virtual bool actuallyAddQueuedUpInstances (bool backgroundThreadLoadWaitForLock=false)
 
virtual void launchOneTimeInitOp ()
 
virtual void updateGpuBuffers (DtGpuArenaUploadState &uploadState)
 
virtual void setFadeParameters (const DtIndirectFadeParameters &fadeParameters)
 
virtual const
DtIndirectFadeParameters & 
fadeParameters (void) const
 
virtual void perCameraUpdateAndCull (const osg::Camera *camera, const osg::Matrix &modelViewMatrix, const osg::FrameStamp *frameStamp, const osg::Camera *viewCamera)
 
virtual double effectiveLodScaleFactor (const DtOsgCullVisitorParameters &params) const
 
virtual void fillViewParameters (DtIndirectViewParameters &destViewParameters, const osg::Matrix &modelViewMatrix, const osg::Camera *osgCamera) const
 
virtual void buildLodViewParameters (DtIndirectViewParameters &destLodViewParameters, const osg::Camera *viewCamera) const
 
virtual void fillAltitude3d (DtIndirectViewParameters &destViewParameters, const Vector3_64 &eye) const
 
virtual bool readyToRender (const int instanceIdInIndirect) const
 
virtual bool hasQueuedInstances (void) const
 
virtual bool allInstancesAreToBeDeleted () const
 
virtual bool instanceEverAdded (void) const
 
virtual int numValidInstances (void) const
 
virtual void setCellId (const Vector3_int &cellId)
 
virtual const Vector3_int & cellId (void) const
 
virtual const unsigned int id (void) const
 
virtual void update (const osg::FrameStamp *frameStamp)
 
virtual void debugOnlyInstanceSnapshot (std::vector< DebugInstanceSnapshotEntry > &outEntries) const
 
virtual bool debugOnlyGetInstanceTransforms (int instanceIdIndirect, osg::Matrixd &outWorldTransform, osg::Matrixd &outLocalTransform) const
 
virtual bool debugOnlyGetPerGeomInstances (int instanceIdIndirect, std::vector< PerGeomInstance > &outPerGeomInstances) const
 
virtual void debugOnlyQueueHealthSnapshot (DebugQueueHealthSnapshot &outSnapshot) const
 
virtual void submitOneTimeOpForFrame ()
 
virtual DtIndirectGeometrySubType subType () const
 
virtual void setInstanceOtherData0 (int instanceIdIndirect, const Vector4_32 &data)
 
virtual Vector4_32 instanceOtherData0 (int instanceIdIndirect) const
 
virtual const osg::Geode * parentGeode (void) const
 
virtual osg::Geode * parentGeode (void)
 

Static Public Member Functions

static int numIndirectGeometries (void)
 
static void initializeDtDeKeyedInstances (DtDe &de)
 
static int numUpdateGpuBuffersRanThisFrame ()
 
static void clearNumUpdateGpuBuffersRanThisFrame ()
 
static void setTrackObjects (bool val)
 
static bool trackObjects (void)
 

Public Attributes

friend DtIndirectGeometryCreator
 

Protected Types

typedef boost::unique_lock
< boost::shared_mutex > 
InstanceMutexWriteLock
 
typedef boost::shared_lock
< boost::shared_mutex > 
InstanceMutexReadLock
 
typedef std::unordered_map
< int, int > 
MapIndirectIdToInstanceContainerId
 

Protected Member Functions

 DtIndirectGeometry (DtDe &de, const DtCullShaderConfig &cullShaderConfig, const DtIndirectGeometrySubType &geometrySubType, bool managesIndividualInstances)
 
virtual ~DtIndirectGeometry ()
 
virtual void registerUpdateComponent ()
 
virtual void unregisterUpdateComponent () const
 
virtual bool addInstanceActual (const DtIndirectGeometryInstance &instance)
 
virtual void setupShadersIfNecessary ()
 
virtual void setupDebugUniforms ()
 
virtual void installDefaultMaterial (osg::StateSet *ss)
 
virtual void slot_reloadShaders ()
 
virtual void updateIndicesCount (const DtIndirectModelInfo &modelInfo, int instanceContainerIndex)
 
virtual void updateModelIdsToInstances (int modelId, int instanceId, bool add)
 
virtual void drawFromCommandBuffer (osg::RenderInfo &renderInfo, const DtIndirectViewParameters &viewParameters, const osg::Camera *camera, bool isLightBin, bool isDepthBin, bool isShadowPass, bool viaExternalRenderer) const
 
virtual void syncViewParametersToGpu (const DtIndirectViewParameters &viewParameters, osg::State *state) const
 
virtual void updateInstancePositionOrientationAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceSwitchesAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceSequencesAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceUvOffsetsAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceColorAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceOtherData0AddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceLightPointGroupIdActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceVisibilityLightPointMaxDistanceActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual bool updateInstanceDeletionBeforeAddedActual (const DtIndirectGeometryInstance &instance)
 
virtual void updateInstancesDofsAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void updateInstanceModelIdAddedActual (const DtIndirectGeometryInstance &instance, int outInstanceIndex)
 
virtual void reloadShadersIfNecessary (void) const
 
virtual void adjustDofConstraintsIfNecessary (osgSim::DOFTransform *clone)
 
virtual DtIndirectDrawComponent * drawComponent (int stateId) const
 
virtual bool hasLightPoints (void) const
 
virtual bool hasDepthOnly (void) const
 
virtual bool isDepthOnly (int stateId) const
 
virtual void nullOutDrawComponents (void)
 
virtual void initDrawComponents (void)
 
virtual void setPureSignalBasedUpdates (bool val)
 
virtual void initializeUbosIfNecessary (osg::RenderInfo &renderInfo) const
 
virtual void slot_coordinateSystemChanged ()
 
virtual void trackInstanceLifeTime (int instanceIdInIndirectGeometry, bool trackLifeTime, const std::string &trackName)
 
virtual std::pair< bool,
std::string > 
trackInfo (int instanceIdInIndirectGeometry) const
 
virtual void drawImplementation (osg::RenderInfo &renderInfo, const osg::Matrixd &modelViewMatrix, bool isLightBin, bool isDepthBin, bool isShadowPass) const
 
virtual bool isTerrainPatch (const DtIndirectGeometrySubType &geometrySubType) const
 
virtual bool disableExternalRenderForSensorFx (const osg::Camera *camera) const
 
virtual bool useExternalRenderer (const osg::Camera *camera) const
 
virtual std::string modelName (int instanceId) const
 
virtual DtIndirectDrawComponent * component (int component)
 

Protected Attributes

std::atomic< bool > myIsShutdown
 
std::mutex myShutdownQueueMutex
 
std::mutex myUpdateComponentMutex
 
std::atomic< bool > myUpdateComponentRegistered
 
osg::ref_ptr
< DtIndirectGeometryRegistrar > 
myRegistrar
 
tbb::concurrent_queue
< DtIndirectGeometryInstance > 
myQueueInstancesToAdd
 
DtGpuCulling * myGpuCulling
 
MapIntToInt myModelIDsToInstances
 
MapIntToInt myInstancesToModelIds
 
const DtIndirectGeometrySubType myGeometrySubType
 
const bool myIsTerrainPatch
 
const bool myManagesIndividualInstances
 
DtIndirectEffectTexturesTemplate myEffectTexturesState
 
unsigned int myNumTextCoordArrays
 
DtSignalConnectionManager myConnections
 
osg::Matrixd myLocalOriginTransformMatrix
 
int myNumIndicesAcrossAllModels
 
std::map< int, int > myInstanceContainerIdToNumIndices
 
DtIndirectVaoManager & myVaoManager
 
unsigned int myId
 
DtInstanceContainer myInstanceContainer
 
DtIndirectSwitchManager * mySwitchManager
 
DtIndirectDofManager * myDofManager
 
DtIndirectLodManager * myLodManager
 
DtIndirectUvOffsetManager * myUvOffsetManager
 
DtIndirectPerInstanceDataManager * myPerInstanceDataManager
 
bool myMutableShadersSetup
 
bool myMutableShouldReloadShaders
 
boost::shared_mutex myInstanceMutex
 
MapIndirectIdToInstanceContainerId myMapIndirectIdToInstanceContainerId
 
unsigned int myLastFrameUpdated
 
const osg::Camera * myLastCamera
 
DtIndirectFadeParameters myFadeParameters
 
std::atomic< int > myRunningInstanceId
 
DtIndirectDefaultDrawComponent * myDefaultDrawComponent
 
DtIndirectLightPointDrawComponent * myLightPointDrawComponent
 
DtIndirectDebugCullComponent * myIndirectDebugCullComponent
 
osg::ref_ptr< osg::StateSet > myDefaultDrawStateSet
 
osg::ref_ptr< osg::StateSet > myLightPointDrawStateSet
 
osg::ref_ptr< osg::StateSet > myDepthOnlyDrawStateSet
 
bool myMutableOutputInstancesBuffersChanged
 
DtGlBuffer * myGpuShaderUbo = nullptr
 
int myGpuShaderUboBinding = -1
 
DtIndirectShaderConstants * myShaderConstants = nullptr
 
DtOsgLightPointManager & myLightPointManager
 
DtDe & myDe
 
DtCoordinateSystem * myCoordinateSystem = nullptr
 
Vector3_int myCellId = { 0,0,0 }
 
std::unordered_map< int,
std::string > 
myInstancesBeingTracked
 
DtIndirectShaderManager & myIndirectShaderManager
 
const bool mySensorFxLoaded
 
unsigned int myOneTimeOpSubmittedForFrameNumber
 
DtIndirectGeometryRenderer * myIndirectGeometryRenderer = nullptr
 
std::unordered_map< int,
Vector4_32 > 
myMapInstanceToOtherData0
 
const DtIndirectRunTimeSettings & myIndirectRunTimeSettings
 
std::atomic< unsigned int > myDebugInstancesDroppedBogusModel
 
std::atomic< unsigned int > myDebugInstancesRequeuedModelNotFound {0}
 
std::atomic< unsigned int > myDebugAddInstanceActualFailures {0}
 
std::atomic< unsigned int > myDebugLastSuccessfulAddFrame {0}
 
std::atomic< unsigned int > myDebugAddAttemptEarlyOuts {0}
 

Static Protected Attributes

static bool theTrackObjects
 
static TotalCounter theTotalCounter
 
static int theNumUpdateGpuBuffersRanThisFrame
 

Private Member Functions

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

Friends

class DtIndirectGeometryRenderer
 
class DtIndirectGeometryRendererUserData
 

Member Typedef Documentation

typedef boost::unique_lock<boost::shared_mutex> makVrv::DtIndirectGeometry::InstanceMutexWriteLock
protected
typedef boost::shared_lock<boost::shared_mutex> makVrv::DtIndirectGeometry::InstanceMutexReadLock
protected

Map of instances' id in indirect geometry to their id in the instance container.

Constructor & Destructor Documentation

makVrv::DtIndirectGeometry::DtIndirectGeometry ( DtDe &  de,
const DtCullShaderConfig &  cullShaderConfig,
const DtIndirectGeometrySubType &  geometrySubType,
bool  managesIndividualInstances 
)
protected

purposely protected. only creator can create

Parameters
deThe display environment.
cullShaderConfigThe cull shader configuration.
geometrySubTypeThe geometry sub-type.
managesIndividualInstancesonly true for entities
virtual makVrv::DtIndirectGeometry::~DtIndirectGeometry ( )
protectedvirtual

purposely protected

makVrv::DtIndirectGeometry::DtIndirectGeometry ( )
privatedelete

not allowed

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

Copy Constructor not implemented – Copy Not Allowed.

Member Function Documentation

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

Assignment Operator Not implemented – Assignment Not Allowed.

virtual void makVrv::DtIndirectGeometry::doShutdown ( )
virtual

Shutdown the indirect geometry object. This must be called from the owner prior to de-referencing the object. This should be called intentionally to ensure proper lifetime destruction.

virtual void makVrv::DtIndirectGeometry::cancelShutdown ( )
virtual

Cancel a shutdown initiated by doShutdown. Used by the entity paging system: tickPaging sets the shutdown flag, then checks whether any instances were queued before the flag transition. If so, the page-out is aborted and this is called to make the geometry live again.

virtual bool makVrv::DtIndirectGeometry::isShutdown ( ) const
virtual

Check if the indirect geometry has been shutdown.

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

set the name for the base class, the culling

virtual void makVrv::DtIndirectGeometry::setRenderer ( DtIndirectGeometryRenderer *  drawerNode)
virtual

set external renderer (see DtIndirectGeometryRenderer)

virtual void makVrv::DtIndirectGeometry::setRegistrar ( DtIndirectGeometryRegistrar *  registrar)
virtual

set the registrar

Parameters
registrarThe indirect geometry registrar which will contain the 'specs' corresponding to models whose instances this DtIndirectGeometry rendered This is purposely separated out from DtIndirectGeometry, because several DtIndirectGeometry'ies may share the same models (for example cdb gt layers), in which case all DtIndirectGeometry'ies share the same registrar or use the 1 registrar per tile (as is the case with cdb gs layers) in which case one registrar is made per geometry(tile)
virtual DtIndirectGeometryRegistrar* makVrv::DtIndirectGeometry::registrar ( )
virtual

provide access to this indirect geometries indirect registrar

virtual const char* makVrv::DtIndirectGeometry::className ( ) const
virtual

get the classes name in a char pointer. Used by OSG to identify objects of this class

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

inherited from osg::drawable will do the culling/lod'ing of the instances (via compute shaders) , and subsequent rendering of the instances

virtual void makVrv::DtIndirectGeometry::debugDrawImplementation ( osg::RenderInfo &  renderInfo,
const osg::Matrixd &  modelViewMatrix 
)
virtual

called when debug indirect culling is active do debug drawing of bounding boxes of all geometries within each instance

virtual int makVrv::DtIndirectGeometry::addInstance ( const DtIndirectGeometryInstance &  instance)
virtual

Add an 'instance' of a model which has lod, transform, switch and node path information used by vrvOsg to add instances from: -paging databases and terrain patches -osgEarth features returns the instance id in the indirect geometry for the added instance.

virtual int makVrv::DtIndirectGeometry::addInstance ( int  modelId,
const osg::Matrixd &  xForm,
float  modelScale,
float  modelRadius,
int  lightPointGroupId,
bool  trackLifeTime,
const std::string &  trackName,
bool  defaultVisibility = true 
)
virtual

Add a simple instance of a model which only has lod and transform information used by vrvOsg to add instances from: -entity indirect path instances -CDB instances returns the instance id in the indirect geometry for the added instance.

virtual void makVrv::DtIndirectGeometry::setInstanceOtherData0 ( int  instanceIdIndirect,
const Vector4_32 &  data 
)
virtual

set/get the otherdata0 for a particular instance.

virtual Vector4_32 makVrv::DtIndirectGeometry::instanceOtherData0 ( int  instanceIdIndirect) const
virtual

set/get the otherdata0 for a particular instance.

virtual void makVrv::DtIndirectGeometry::accept ( osg::NodeVisitor &  nv)
virtual

overridden: because we do certain processing (state set modification, etc) that needs to happen outside of the draw pass. So, we check for and do this in the cull visitor pass

virtual void makVrv::DtIndirectGeometry::setParent ( const osg::Group *  parent)
virtual

Typically a feature tile node/cdb group node.

virtual void makVrv::DtIndirectGeometry::setRegistrarInvalid ( void  )
virtual

Indicate to us that our registrar is now invalid registrars are externally held, and the DtIndirectGeometry needs to know this because it may be deleted much after the registrar has been deleted, and possibly internally to osg.

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

release all gl objects used by this indirect geometry

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

override of Drawable function which allows the osg Statistics to work for Indirect Geometry

virtual void makVrv::DtIndirectGeometry::setupIndirectShaders ( )
virtual

Makes sure Indirect Geometry is ready to go, can be called from multiple threads (e.g. cdb) -draw components' effect textures' state is setup correctly -debug uniforms are set up correctly.

virtual const osg::Geode* makVrv::DtIndirectGeometry::parentGeode ( void  ) const
virtual

internal. Access the parent geode for this indirect geometry

virtual osg::Geode* makVrv::DtIndirectGeometry::parentGeode ( void  )
virtual

internal. Access the parent geode for this indirect geometry

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

set the matrix used to adjust the local origin of this indirect geometry this is used to fix precision issue that arise from having large numbers in the vertex buffers or in the instance transforms

virtual const osg::Matrixd& makVrv::DtIndirectGeometry::localOriginTransform ( ) const
virtual

get the matrix used to adjust the local origin of this indirect geometry this is used to fix precision issue that arise from having large numbers in the vertex buffers or in the instance transforms

virtual bool makVrv::DtIndirectGeometry::actuallyAddQueuedUpInstances ( bool  backgroundThreadLoadWaitForLock = false)
virtual

adds all instances that have been queued up by calling addInstanceActual with them as the parameter

virtual void makVrv::DtIndirectGeometry::launchOneTimeInitOp ( )
virtual

finish initialization of geometry

virtual void makVrv::DtIndirectGeometry::updateGpuBuffers ( DtGpuArenaUploadState &  uploadState)
virtual

update gpu buffers

Parameters
uploadState- tracks the upload stats for the GPU arena. (modified by this method)
virtual void makVrv::DtIndirectGeometry::setFadeParameters ( const DtIndirectFadeParameters &  fadeParameters)
virtual

set the fade parameters

virtual const DtIndirectFadeParameters& makVrv::DtIndirectGeometry::fadeParameters ( void  ) const
virtual

set the fade parameters

virtual void makVrv::DtIndirectGeometry::perCameraUpdateAndCull ( const osg::Camera *  camera,
const osg::Matrix &  modelViewMatrix,
const osg::FrameStamp *  frameStamp,
const osg::Camera *  viewCamera 
)
virtual

update any per camera data that is needed and then run the cull compute shader for this camera

virtual double makVrv::DtIndirectGeometry::effectiveLodScaleFactor ( const DtOsgCullVisitorParameters &  params) const
virtual

Select the appropriate LOD scale factor from the cull visitor parameters based on the geometry sub-type.

virtual void makVrv::DtIndirectGeometry::fillViewParameters ( DtIndirectViewParameters &  destViewParameters,
const osg::Matrix &  modelViewMatrix,
const osg::Camera *  osgCamera 
) const
virtual

calculate and fill the destination view parameters based on the model view, camera, and renderInfo

virtual void makVrv::DtIndirectGeometry::buildLodViewParameters ( DtIndirectViewParameters &  destLodViewParameters,
const osg::Camera *  viewCamera 
) const
virtual

Build LOD-specific view parameters from the main view camera so that secondary passes (shadow, reflection) select the same LOD as the visual pass.

virtual void makVrv::DtIndirectGeometry::fillAltitude3d ( DtIndirectViewParameters &  destViewParameters,
const Vector3_64 &  eye 
) const
virtual

This is used for ocean polygons' rejection It matches the altitude3d computation for the cull visitor It only is set if the indirect geometry has ocean polygons (this can be queried by seeing its value from the cull config)

virtual bool makVrv::DtIndirectGeometry::readyToRender ( const int  instanceIdInIndirect) const
virtual

can the instance be rendered this frame?

virtual bool makVrv::DtIndirectGeometry::hasQueuedInstances ( void  ) const
virtual

Does myQueueInstancesToAdd have any entries? Not thread safe - returns myQueueInstancesToAdd.unsafe_size()

virtual bool makVrv::DtIndirectGeometry::allInstancesAreToBeDeleted ( ) const
virtual
virtual bool makVrv::DtIndirectGeometry::instanceEverAdded ( void  ) const
virtual

was an instance ever added? not the same as numInstances() (implemented as pass through to the internal instance container)

virtual int makVrv::DtIndirectGeometry::numValidInstances ( void  ) const
virtual

the number of (valid) instances (implemented as pass through to the internal instance container)

virtual void makVrv::DtIndirectGeometry::setCellId ( const Vector3_int &  cellId)
virtual

Set a cell id This is used internally if indirect geometry is DtIndirectEntityGeometry Else, it is 0,0,0.

virtual const Vector3_int& makVrv::DtIndirectGeometry::cellId ( void  ) const
virtual

get a cell id This is used internally if indirect geometry is DtIndirectEntityGeometry Else, it is 0,0,0

virtual const unsigned int makVrv::DtIndirectGeometry::id ( void  ) const
virtual

Get the id.

virtual void makVrv::DtIndirectGeometry::update ( const osg::FrameStamp *  frameStamp)
virtual

called from the DtIndirectGeometryUpdateSystem to run update on managers that need to run during the update traversal. warning: this can be called async The dof manager needs to update so that the dof transforms are updated in time for the post update to update the observer if it is attached to a part.

virtual void makVrv::DtIndirectGeometry::debugOnlyInstanceSnapshot ( std::vector< DebugInstanceSnapshotEntry > &  outEntries) const
virtual

Debug-only. Fill a snapshot of all valid instances.

Each entry contains: the instance id in the indirect geometry, the instance id in the instance container, and the model id. Takes the instance read lock and copies the data by value.

Warning
This method exists solely to support DtIndirectGeometryDebugging. It is not intended for, and must not be used by, any runtime rendering or simulation code path.
Parameters
outEntriesFilled with one entry per valid instance.
virtual bool makVrv::DtIndirectGeometry::debugOnlyGetInstanceTransforms ( int  instanceIdIndirect,
osg::Matrixd &  outWorldTransform,
osg::Matrixd &  outLocalTransform 
) const
virtual

Debug-only. Get the world and local transforms of an instance.

The local transform is the top-level instance transform from the dof manager (relative to this geometry's local origin). The world transform is the local transform combined with the local origin transform.

Warning
This method exists solely to support DtIndirectGeometryDebugging. It is not intended for, and must not be used by, any runtime rendering or simulation code path.
Parameters
instanceIdIndirectThe instance id in the indirect geometry.
outWorldTransformFilled with the world transform on success.
outLocalTransformFilled with the local transform on success.
Returns
true if the instance was found and the transforms filled.
virtual bool makVrv::DtIndirectGeometry::debugOnlyGetPerGeomInstances ( int  instanceIdIndirect,
std::vector< PerGeomInstance > &  outPerGeomInstances 
) const
virtual

Debug-only. Get copies of the PerGeomInstance objects for an instance.

Looks up the instance's block in the instance container and copies the PerGeomInstance entries by value.

Warning
This method exists solely to support DtIndirectGeometryDebugging. It is not intended for, and must not be used by, any runtime rendering or simulation code path.
Parameters
instanceIdIndirectThe instance id in the indirect geometry.
outPerGeomInstancesFilled with copies of the instance's entries.
Returns
true if the instance was found.
virtual void makVrv::DtIndirectGeometry::debugOnlyQueueHealthSnapshot ( DebugQueueHealthSnapshot &  outSnapshot) const
virtual

Debug-only. Fill a snapshot of the queue health counters.

Lock free; reads atomics and the queue's unsafe_size(). Values are approximate under concurrency and intended for trend and stuck detection only.

Warning
This method exists solely to support DtIndirectGeometryDebugging. It is not intended for, and must not be used by, any runtime rendering or simulation code path.
Parameters
outSnapshotFilled with the current counter values.

Reimplemented in makVrv::DtIndirectEntityGeometry.

static void makVrv::DtIndirectGeometry::setTrackObjects ( bool  val)
static

debug log level output is provided when objects construct/deleted

static bool makVrv::DtIndirectGeometry::trackObjects ( void  )
static

debug log level output is provided when objects construct/deleted

static int makVrv::DtIndirectGeometry::numIndirectGeometries ( void  )
static

total currently

static void makVrv::DtIndirectGeometry::initializeDtDeKeyedInstances ( DtDe &  de)
static

DtIndirectGeometry has a bunch of components that are references (creators, higher level managers, etc) These are keyed on DtDe and hence call ::instance of those. These implementations are not thread safe. They call findInstance and then registerInstance (if instance was not found) with no higher up locking guarding both functions. When a bunch of DtIndirectGeometries are made from multiple threads, the call to ::instance to any one of these can cause thread safety issues. So, call this function, once from outside (e.g. DtOsgRenderer::postInitialize), so all these are initialized properly and subsequent calls inside ::instance always hit only DtDe.findInstance and return the pointer in question. This was found recently in cdb for a particular database. It's only happenstance that we did not run into this before.

static int makVrv::DtIndirectGeometry::numUpdateGpuBuffersRanThisFrame ( )
static

used by auto tests to determine if any ran this frame

static void makVrv::DtIndirectGeometry::clearNumUpdateGpuBuffersRanThisFrame ( )
static

used by auto tests to determine if any ran this frame needs to be called per tick/frame at the start of the frame

virtual void makVrv::DtIndirectGeometry::submitOneTimeOpForFrame ( )
virtual

Submits a one time operation to the gpu arena that will run prior to cull. The operation performs updates to feed/sync staging data to gpu buffers.

virtual DtIndirectGeometrySubType makVrv::DtIndirectGeometry::subType ( ) const
virtual

Get the subtype of this indirect geometry.

virtual void makVrv::DtIndirectGeometry::registerUpdateComponent ( )
protectedvirtual

register this indirect geometry with the DtIndirectGeometryUpdateSystem The system will provide updates to this node: it will call update() This is only called from the main thread during update traversal

virtual void makVrv::DtIndirectGeometry::unregisterUpdateComponent ( ) const
protectedvirtual

unregister this indirect geometry with the DtIndirectGeometryUpdateSystem This can be called from any thread

virtual bool makVrv::DtIndirectGeometry::addInstanceActual ( const DtIndirectGeometryInstance &  instance)
protectedvirtual

actually add the instances that were queued up via possibly multiple threads this happens as part of the culling call

virtual void makVrv::DtIndirectGeometry::setupShadersIfNecessary ( )
protectedvirtual

to initialize the shader files cache, because DtIndirectGeometry doesn't have direct access to DtDe yet (it could; but that would break the cdb plugin) lock myInternalsMutex before calling

virtual void makVrv::DtIndirectGeometry::setupDebugUniforms ( )
protectedvirtual

setup the uniforms needed to visualize debug information for indirect geometry lock myInternalsMutex before calling

virtual void makVrv::DtIndirectGeometry::installDefaultMaterial ( osg::StateSet *  ss)
protectedvirtual

install a default material on ourselves, so that there's no state leakage with regards ubos/osg::material because we are using materials encoded into an ssbo for indirect rendering

virtual void makVrv::DtIndirectGeometry::slot_reloadShaders ( )
protectedvirtual

slot for handling when the shaders are reloaded

virtual void makVrv::DtIndirectGeometry::updateIndicesCount ( const DtIndirectModelInfo &  modelInfo,
int  instanceContainerIndex 
)
protectedvirtual

internal method to update num of triangles that this geometry will render in the worst case (all lods across all models across all instances)

virtual void makVrv::DtIndirectGeometry::updateModelIdsToInstances ( int  modelId,
int  instanceId,
bool  add 
)
protectedvirtual

increment the number of instance for the model id (called internally when an instance is added)

virtual void makVrv::DtIndirectGeometry::drawFromCommandBuffer ( osg::RenderInfo &  renderInfo,
const DtIndirectViewParameters &  viewParameters,
const osg::Camera *  camera,
bool  isLightBin,
bool  isDepthBin,
bool  isShadowPass,
bool  viaExternalRenderer 
) const
protectedvirtual

setup and draw a command buffer

virtual void makVrv::DtIndirectGeometry::syncViewParametersToGpu ( const DtIndirectViewParameters &  viewParameters,
osg::State *  state 
) const
protectedvirtual

ensures the given view paramters are synced to the shader ubo.

virtual void makVrv::DtIndirectGeometry::updateInstancePositionOrientationAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

added actual functions are called when the instance is added to update the state that has been already set for that instance and pass it down to the managers.

update an instances position and orientation

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceSwitchesAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

update an instance's switches

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceSequencesAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

update an instance's sequences

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceUvOffsetsAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set all the uv offsets that have been saved off from before the instance was added.

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceColorAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set color that has been saved off before the instance was added

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceOtherData0AddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set otherdata0 that has been saved off before the instance was added

virtual void makVrv::DtIndirectGeometry::updateInstanceLightPointGroupIdActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set light point group id that has been saved off before the instance was added

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceVisibilityLightPointMaxDistanceActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set visibility, light point max distance and other data 1 that has been saved off before the instance was added

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual bool makVrv::DtIndirectGeometry::updateInstanceDeletionBeforeAddedActual ( const DtIndirectGeometryInstance &  instance)
protectedvirtual

check to see if this instance was marked for deletion before it was added

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstancesDofsAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

update an instance's dofs states

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::updateInstanceModelIdAddedActual ( const DtIndirectGeometryInstance &  instance,
int  outInstanceIndex 
)
protectedvirtual

set model id that has been saved off before the instance was added

Reimplemented in makVrv::DtIndirectEntityGeometry.

virtual void makVrv::DtIndirectGeometry::reloadShadersIfNecessary ( void  ) const
protectedvirtual

reload the shaders if necessary (marks a flag and they are reloaded before the next draw.

virtual void makVrv::DtIndirectGeometry::adjustDofConstraintsIfNecessary ( osgSim::DOFTransform *  clone)
protectedvirtual

adjust dof constraints, if needed

virtual DtIndirectDrawComponent* makVrv::DtIndirectGeometry::drawComponent ( int  stateId) const
protectedvirtual

get the indirect draw component for a particular state

virtual bool makVrv::DtIndirectGeometry::hasLightPoints ( void  ) const
protectedvirtual

similar to the drawComponent above, but checks for the existence of GL_POINTS (light points) primitives

virtual bool makVrv::DtIndirectGeometry::hasDepthOnly ( void  ) const
protectedvirtual

whether has depth only components

virtual bool makVrv::DtIndirectGeometry::isDepthOnly ( int  stateId) const
protectedvirtual

whether is depth only

virtual void makVrv::DtIndirectGeometry::nullOutDrawComponents ( void  )
protectedvirtual

delete the draw components

virtual void makVrv::DtIndirectGeometry::initDrawComponents ( void  )
protectedvirtual

initialize the draw components

virtual void makVrv::DtIndirectGeometry::setPureSignalBasedUpdates ( bool  val)
protectedvirtual

indicate whether this manager's switches get updated per frame via looking at the actual switches/multi-switches or directly using signals This is only true for entities

virtual void makVrv::DtIndirectGeometry::initializeUbosIfNecessary ( osg::RenderInfo &  renderInfo) const
protectedvirtual

init the ubo if necessary

virtual void makVrv::DtIndirectGeometry::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

virtual void makVrv::DtIndirectGeometry::trackInstanceLifeTime ( int  instanceIdInIndirectGeometry,
bool  trackLifeTime,
const std::string &  trackName 
)
protectedvirtual

whether to track instance lifetime (for debugging)

virtual std::pair<bool, std::string> makVrv::DtIndirectGeometry::trackInfo ( int  instanceIdInIndirectGeometry) const
protectedvirtual

whether to track instance lifetime (for debugging)

virtual void makVrv::DtIndirectGeometry::drawImplementation ( osg::RenderInfo &  renderInfo,
const osg::Matrixd &  modelViewMatrix,
bool  isLightBin,
bool  isDepthBin,
bool  isShadowPass 
) const
protectedvirtual

internal

virtual bool makVrv::DtIndirectGeometry::isTerrainPatch ( const DtIndirectGeometrySubType &  geometrySubType) const
protectedvirtual

whether is terrain patch

virtual bool makVrv::DtIndirectGeometry::disableExternalRenderForSensorFx ( const osg::Camera *  camera) const
protectedvirtual

disable external renderer for IGT_TERRAIN_CONTENT_OSGEARTH_LAYER types, if in non-visual mode disable sensor fx for map node indirected content see: https://jira.mak.com/browse/VRV-4519

virtual bool makVrv::DtIndirectGeometry::useExternalRenderer ( const osg::Camera *  camera) const
protectedvirtual

whether to use external renderer. will see if renderer is set, and whether settings say so, and the result of the check disableExternalRenderForSensorFx

virtual std::string makVrv::DtIndirectGeometry::modelName ( int  instanceId) const
protectedvirtual

model name for an instance id in the indirect geometry

virtual DtIndirectDrawComponent* makVrv::DtIndirectGeometry::component ( int  component)
protectedvirtual

0 means regular, 1 means light

Friends And Related Function Documentation

friend class DtIndirectGeometryRenderer
friend

Member Data Documentation

friend makVrv::DtIndirectGeometry::DtIndirectGeometryCreator
std::atomic<bool> makVrv::DtIndirectGeometry::myIsShutdown
mutableprotected
std::mutex makVrv::DtIndirectGeometry::myShutdownQueueMutex
mutableprotected

Serializes queue pushes in addInstance against the shutdown flag transition in doShutdown. Guarantees that after doShutdown returns, no further instances can be queued: a producer either pushed before the flag was set (visible to the caller of doShutdown via hasQueuedInstances) or observes the flag and gets -1 back, in which case it must re-fetch the cell from the grid. This mutex is performant because it is uncontended except during the rare add-vs-page-out race that it is intended to handle.

std::mutex makVrv::DtIndirectGeometry::myUpdateComponentMutex
mutableprotected
std::atomic<bool> makVrv::DtIndirectGeometry::myUpdateComponentRegistered
mutableprotected
osg::ref_ptr<DtIndirectGeometryRegistrar> makVrv::DtIndirectGeometry::myRegistrar
protected

pointer to the (external) registrar

tbb::concurrent_queue<DtIndirectGeometryInstance> makVrv::DtIndirectGeometry::myQueueInstancesToAdd
protected

addInstance may be called from multiple threads. Hence, concurrent queue

std::atomic<unsigned int> makVrv::DtIndirectGeometry::myDebugInstancesDroppedBogusModel
mutableprotected

Debug-only queue health counters. See debugOnlyQueueHealthSnapshot. Updated from actuallyAddQueuedUpInstances (any thread); read by DtIndirectGeometryDebugging. Relaxed ordering is sufficient.

std::atomic<unsigned int> makVrv::DtIndirectGeometry::myDebugInstancesRequeuedModelNotFound {0}
mutableprotected

Debug-only queue health counters. See debugOnlyQueueHealthSnapshot. Updated from actuallyAddQueuedUpInstances (any thread); read by DtIndirectGeometryDebugging. Relaxed ordering is sufficient.

std::atomic<unsigned int> makVrv::DtIndirectGeometry::myDebugAddInstanceActualFailures {0}
mutableprotected

Debug-only queue health counters. See debugOnlyQueueHealthSnapshot. Updated from actuallyAddQueuedUpInstances (any thread); read by DtIndirectGeometryDebugging. Relaxed ordering is sufficient.

std::atomic<unsigned int> makVrv::DtIndirectGeometry::myDebugLastSuccessfulAddFrame {0}
mutableprotected

Debug-only queue health counters. See debugOnlyQueueHealthSnapshot. Updated from actuallyAddQueuedUpInstances (any thread); read by DtIndirectGeometryDebugging. Relaxed ordering is sufficient.

std::atomic<unsigned int> makVrv::DtIndirectGeometry::myDebugAddAttemptEarlyOuts {0}
mutableprotected

Debug-only queue health counters. See debugOnlyQueueHealthSnapshot. Updated from actuallyAddQueuedUpInstances (any thread); read by DtIndirectGeometryDebugging. Relaxed ordering is sufficient.

DtGpuCulling* makVrv::DtIndirectGeometry::myGpuCulling
protected
MapIntToInt makVrv::DtIndirectGeometry::myModelIDsToInstances
protected
MapIntToInt makVrv::DtIndirectGeometry::myInstancesToModelIds
protected
const DtIndirectGeometrySubType makVrv::DtIndirectGeometry::myGeometrySubType
protected
const bool makVrv::DtIndirectGeometry::myIsTerrainPatch
protected
const bool makVrv::DtIndirectGeometry::myManagesIndividualInstances
protected
DtIndirectEffectTexturesTemplate makVrv::DtIndirectGeometry::myEffectTexturesState
protected

the accumulated effect textures' state which represents the superset of all effect textures cumulatively used by the models of the instances of this Indirect geometry

unsigned int makVrv::DtIndirectGeometry::myNumTextCoordArrays
protected
DtSignalConnectionManager makVrv::DtIndirectGeometry::myConnections
protected
osg::Matrixd makVrv::DtIndirectGeometry::myLocalOriginTransformMatrix
protected
int makVrv::DtIndirectGeometry::myNumIndicesAcrossAllModels
protected

number of indices across all unique models across instances

std::map<int, int> makVrv::DtIndirectGeometry::myInstanceContainerIdToNumIndices
protected
DtIndirectVaoManager& makVrv::DtIndirectGeometry::myVaoManager
protected

This is de-referenced here for speed.

unsigned int makVrv::DtIndirectGeometry::myId
protected

a unique id for the geometry

DtInstanceContainer makVrv::DtIndirectGeometry::myInstanceContainer
protected

container for all the instances registered here

DtIndirectSwitchManager* makVrv::DtIndirectGeometry::mySwitchManager
protected
DtIndirectDofManager* makVrv::DtIndirectGeometry::myDofManager
protected
DtIndirectLodManager* makVrv::DtIndirectGeometry::myLodManager
protected
DtIndirectUvOffsetManager* makVrv::DtIndirectGeometry::myUvOffsetManager
protected
DtIndirectPerInstanceDataManager* makVrv::DtIndirectGeometry::myPerInstanceDataManager
protected
bool makVrv::DtIndirectGeometry::myMutableShadersSetup
mutableprotected
bool makVrv::DtIndirectGeometry::myMutableShouldReloadShaders
mutableprotected

FIXME should be a static but currently the cull shader is per indirect.

boost::shared_mutex makVrv::DtIndirectGeometry::myInstanceMutex
mutableprotected
MapIndirectIdToInstanceContainerId makVrv::DtIndirectGeometry::myMapIndirectIdToInstanceContainerId
protected
unsigned int makVrv::DtIndirectGeometry::myLastFrameUpdated
protected
const osg::Camera* makVrv::DtIndirectGeometry::myLastCamera
protected
DtIndirectFadeParameters makVrv::DtIndirectGeometry::myFadeParameters
protected
std::atomic<int> makVrv::DtIndirectGeometry::myRunningInstanceId
protected
DtIndirectDefaultDrawComponent* makVrv::DtIndirectGeometry::myDefaultDrawComponent
protected
DtIndirectLightPointDrawComponent* makVrv::DtIndirectGeometry::myLightPointDrawComponent
protected
DtIndirectDebugCullComponent* makVrv::DtIndirectGeometry::myIndirectDebugCullComponent
protected
osg::ref_ptr<osg::StateSet> makVrv::DtIndirectGeometry::myDefaultDrawStateSet
protected
osg::ref_ptr<osg::StateSet> makVrv::DtIndirectGeometry::myLightPointDrawStateSet
protected
osg::ref_ptr<osg::StateSet> makVrv::DtIndirectGeometry::myDepthOnlyDrawStateSet
protected
bool makVrv::DtIndirectGeometry::myMutableOutputInstancesBuffersChanged
mutableprotected

Internal variable that tracks whether the output instance buffers via the culling got changed (resized, gpu address changed, etc). This indicates whether the vao needs to be re-generated.

DtGlBuffer* makVrv::DtIndirectGeometry::myGpuShaderUbo = nullptr
protected
int makVrv::DtIndirectGeometry::myGpuShaderUboBinding = -1
mutableprotected
DtIndirectShaderConstants* makVrv::DtIndirectGeometry::myShaderConstants = nullptr
protected
DtOsgLightPointManager& makVrv::DtIndirectGeometry::myLightPointManager
protected
DtDe& makVrv::DtIndirectGeometry::myDe
protected
DtCoordinateSystem* makVrv::DtIndirectGeometry::myCoordinateSystem = nullptr
protected

local clone of the system wide coordinate system. for thread safety.

Vector3_int makVrv::DtIndirectGeometry::myCellId = { 0,0,0 }
protected
std::unordered_map<int, std::string> makVrv::DtIndirectGeometry::myInstancesBeingTracked
protected
DtIndirectShaderManager& makVrv::DtIndirectGeometry::myIndirectShaderManager
protected
const bool makVrv::DtIndirectGeometry::mySensorFxLoaded
protected
unsigned int makVrv::DtIndirectGeometry::myOneTimeOpSubmittedForFrameNumber
protected

The frame number when the one time op was processed Only used when multiple one time ops are required for buffer updates across frames.

bool makVrv::DtIndirectGeometry::theTrackObjects
staticprotected
TotalCounter makVrv::DtIndirectGeometry::theTotalCounter
staticprotected
DtIndirectGeometryRenderer* makVrv::DtIndirectGeometry::myIndirectGeometryRenderer = nullptr
protected
std::unordered_map<int, Vector4_32> makVrv::DtIndirectGeometry::myMapInstanceToOtherData0
protected

Maps an instance id to the other data0 for that instance.

const DtIndirectRunTimeSettings& makVrv::DtIndirectGeometry::myIndirectRunTimeSettings
protected
int makVrv::DtIndirectGeometry::theNumUpdateGpuBuffersRanThisFrame
staticprotected

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)