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

This class inherits from osg::Drawable, which allows us to hook into our indirect engine to render using indirect rendering. More...

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

Public Member Functions

 DtIndirectGeometry (bool terrainPatch, const DtIndirectFadeParameters &fadeParameters)
 CTOR. More...
 
virtual void setName (const std::string &name)
 set the name for the base class and the main thread job More...
 
virtual void setRegistrar (DtIndirectGeometryRegistrar *registrar)
 set the registrar More...
 
virtual
DtIndirectGeometryRegistrar
registrar ()
 provide access to this indirect geometries indirect registrar More...
 
virtual void setCullShaderConfig (const DtCullShaderConfig &cullShaderConfig)
 set the compute shader config More...
 
virtual const charclassName () const
 get the classes name in a char pointer. Used by OSG to identify objects of this class More...
 
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 inherited from osg::drawable will do the culling/lod'ing of the instances (via compute shaders) , and subsequent rendering of the instances More...
 
virtual unsigned int rebuildRegistrar (osg::RenderInfo &renderInfo) const
 draw imp helper function returns myLastRebuiltFrameNum More...
 
virtual void addInstance (const DtIndirectGeometryInstance &instance)
 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. More...
 
virtual void addInstance (int modelId, const osg::Matrixd &xForm)
 Add a simple instance of a model which only has lod and transform information used by CDB to add it's instances along with any other osgEarth features. More...
 
virtual void removeAllInstances (void)
 Remove all the instances. More...
 
virtual void accept (osg::NodeVisitor &nv)
 overridden: because we do certain processing (state set modification, etc) that needs to happen outside of the draw pass. More...
 
virtual void setParent (const osg::Group *parent)
 Typically a feature tile node/cdb group node. More...
 
virtual void setDebugDrawString (const std::string &drawString)
 Arbitrary string to 'tag' this geometry will print out this string if the drawImplemention is called and debugging is enabled. More...
 
virtual void setRegistrarInvalid (void)
 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. More...
 
virtual void releaseGLObjects (osg::State *state) const
 release all gl objects used by this indirect geometry More...
 
virtual void accept (osg::PrimitiveFunctor &functor) const
 override of Drawable function which allows the osg Statistics to work for Indirect Geometry More...
 
void setupIndirect (DtDe &de)
 Makes sure Indirect Geometry it ready to go, only callable from main thread. More...
 
virtual void setLocalOriginTransform (const osg::Matrixd &localOriginTransform)
 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 More...
 
virtual osg::Matrixd & localOriginTransform ()
 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 More...
 
virtual bool actuallyAddQueuedUpInstances (void)
 adds all instances that have been queued up by calling addInstanceActual with them as the parameter More...
 
virtual void launchMainThreadJobAndWait (DtDe &de, DtOsgRenderer &renderer)
 finish initialization of geometry More...
 
virtual boost::condition_variable & waitCondition ()
 returns a wait condition for use as a sync point between class and main thread job More...
 
virtual void updateGpuInstanceBuffers (osg::RenderInfo &renderInfo)
 helper function for job to call the culling and lod updater More...
 
virtual const osg::Geode * parentGeode (void) const
 internal. More...
 
virtual osg::Geode * parentGeode (void)
 

Protected Types

typedef osg::ref_ptr
< osgEarth::VirtualProgram > 
VirtualProgramRef
 
typedef std::map< std::string,
VirtualProgramRef
StringVpMap
 

Protected Member Functions

virtual ~DtIndirectGeometry ()
 purposely protected More...
 
virtual bool addInstanceActual (const DtIndirectGeometryInstance &instance)
 actually add the instances that were queued up via possibly multiple threads this happens as part of the culling call More...
 
virtual void setupShadersIfNecessary (DtDe &de)
 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 More...
 
virtual void setupDebugUniforms (DtDe &de)
 setup the uniforms needed to visualize debug information for indirect geometry lock myInternalsMutex before calling More...
 
virtual void installIndirectRenderingProgram (DtOsgShaderFilesCache *shaderFilesCache, const std::string &shaderFolderPath, osg::StateSet *ss, DtDe &de) const
 install the shaders needed to render using indirect rendering More...
 
virtual void installDefaultMaterial (osg::StateSet *ss)
 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 More...
 
virtual void slot_reloadShaders ()
 slot for handling when the shaders are reloaded More...
 
virtual void updateIndicesCount (const DtAggregateModelInfo &modelInfo)
 internal method to update num of triangles that this geometry will render in the worst case (all lods across all models across all instances) More...
 
virtual void createCullingAndLodIfNecessary (DtDe &de)
 create the culling and lod for this indirect geometry lock myInternalsMutex before calling More...
 
virtual void createManagersIfNecessary (DtDe &de)
 create the switch manager and the lod manager for this indirect geometry if it has not yet been created. More...
 
virtual void drawFromCommandBuffer (osg::RenderInfo &renderInfo) const
 
virtual void reloadShadersIfNecessary (void) const
 reload shaders for if necessary More...
 
virtual GLuint getOrCreateAndRecordVAO (osg::State *state) const
 internal methods to create and 'record' a vertex array object (VAO) using VAO enables us to combine multiple buffer binds into a single 'command' via 'recording' the VAO More...
 
virtual void recordVAO (GLuint vao) const
 

Static Protected Member Functions

static osgEarth::VirtualProgram * findCachedVirtualProgram (const std::string &vp_hash)
 quick caching of virtual programs to avoid parsing them constantly More...
 
static void cacheVirtualProgram (const std::string &vp_hash, osgEarth::VirtualProgram *virtualProgram)
 
static void clearVirtualProgramCache ()
 

Protected Attributes

osg::ref_ptr
< DtIndirectGeometryRegistrar
myRegistrar
 pointer to the (external) registrar More...
 
tbb::concurrent_queue
< DtIndirectGeometryInstance
myQueueInstancesToAdd
 addInstance may be called from multiple threads. Hence, concurrent queue More...
 
DtGpuCullingAndLodmyCullingAndLOD
 
MapIntToInt myModelIDsToInstances
 
std::string myDrawString
 
bool myIsTerrainPatch
 
DtIndirectEffectTexturesTemplate myEffectTexturesState
 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 More...
 
bool myReloadSlotConnected
 
boost::signals2::connection myConnection
 
osg::Matrixd myLocalOriginTransformMatrix
 
int myNumIndicesAcrossAllModels
 number of indices across all unique models across instances More...
 
bool myLastDebugIndirectColorOn
 
bool myLastMissingTextureColorOn
 
DtTerrainPatchObjectManagermyTerrainPatchObjectManager
 
DtGlVaoManagermyVaoManager
 
DtIndirectRenderingParameters myMutableIrParams
 
DtInstanceContainer myMutableInstanceContainer
 container for all the instances registered here More...
 
unsigned int myMutableLastFrameRebuilt
 
unsigned int myMutableLastFrameTexturesUpdated
 
DtIndirectSwitchManagermyMutableSwitchManager
 
DtIndirectLodManagermyMutableLodManager
 
DtCullShaderConfig myCullShaderConfig
 
bool myMutableShadersSetup
 
bool myMutableShouldReloadShaders
 FIXME should be a static but currently the cull shader is per indirect. More...
 
boost::condition_variable myWaitCondition
 
boost::mutex myWaitMutex
 
boost::mutex myInternalsMutex
 
osg::ref_ptr
< DtIndirectGeometryInitMainThreadJob
myMainThreadInitJob
 
osg::ref_ptr
< DtIndirectGeometryUpdateBuffersMainThreadJob
myMainThreadUpdateBuffersJob
 
DtIndirectFadeParameters myFadeParameters
 

Static Protected Attributes

static StringVpMap theVirtualProgramMap
 

Private Member Functions

 DtIndirectGeometry (const DtIndirectGeometry &other)
 Copy Constructor not implemented – Copy Not Allowed. More...
 
DtIndirectGeometryoperator= (const DtIndirectGeometry &other)
 Assignment Operator Not implemented � Assignment Not Allowed. More...
 

Friends

class DtIndirectGeometryInitMainThreadJob
 needed to give access to wait conditions and mutexes. More...
 

Detailed Description

This class inherits from 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

Member Typedef Documentation

typedef osg::ref_ptr<osgEarth::VirtualProgram> makVrv::DtIndirectGeometry::VirtualProgramRef
protected
typedef std::map<std::string, VirtualProgramRef> makVrv::DtIndirectGeometry::StringVpMap
protected

Constructor & Destructor Documentation

makVrv::DtIndirectGeometry::DtIndirectGeometry ( bool  terrainPatch,
const DtIndirectFadeParameters fadeParameters 
)

CTOR.

virtual makVrv::DtIndirectGeometry::~DtIndirectGeometry ( )
protectedvirtual

purposely protected

makVrv::DtIndirectGeometry::DtIndirectGeometry ( const DtIndirectGeometry other)
private

Copy Constructor not implemented – Copy Not Allowed.

Member Function Documentation

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

Assignment Operator Not implemented � Assignment Not Allowed.

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

set the name for the base class and the main thread job

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 void makVrv::DtIndirectGeometry::setCullShaderConfig ( const DtCullShaderConfig cullShaderConfig)
virtual

set the compute shader config

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 unsigned int makVrv::DtIndirectGeometry::rebuildRegistrar ( osg::RenderInfo &  renderInfo) const
virtual

draw imp helper function returns myLastRebuiltFrameNum

virtual void 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.

virtual void makVrv::DtIndirectGeometry::addInstance ( int  modelId,
const osg::Matrixd &  xForm 
)
virtual

Add a simple instance of a model which only has lod and transform information used by CDB to add it's instances along with any other osgEarth features.

virtual void makVrv::DtIndirectGeometry::removeAllInstances ( void  )
virtual

Remove all the instances.

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::setDebugDrawString ( const std::string &  drawString)
virtual

Arbitrary string to 'tag' this geometry will print out this string if the drawImplemention is called and debugging is enabled.

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
virtual

release all gl objects used by this indirect geometry

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

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

void makVrv::DtIndirectGeometry::setupIndirect ( DtDe de)

Makes sure Indirect Geometry it ready to go, only callable from main thread.

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
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 osg::Matrixd& makVrv::DtIndirectGeometry::localOriginTransform ( )
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 ( void  )
virtual

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

virtual void makVrv::DtIndirectGeometry::launchMainThreadJobAndWait ( DtDe de,
DtOsgRenderer renderer 
)
virtual

finish initialization of geometry

virtual boost::condition_variable& makVrv::DtIndirectGeometry::waitCondition ( )
virtual

returns a wait condition for use as a sync point between class and main thread job

virtual void makVrv::DtIndirectGeometry::updateGpuInstanceBuffers ( osg::RenderInfo &  renderInfo)
virtual

helper function for job to call the culling and lod updater

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 GLuint makVrv::DtIndirectGeometry::getOrCreateAndRecordVAO ( osg::State *  state) const
protectedvirtual

internal methods to create and 'record' a vertex array object (VAO) using VAO enables us to combine multiple buffer binds into a single 'command' via 'recording' the VAO

virtual void makVrv::DtIndirectGeometry::recordVAO ( GLuint  vao) const
protectedvirtual
virtual void makVrv::DtIndirectGeometry::setupShadersIfNecessary ( DtDe de)
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 ( DtDe de)
protectedvirtual

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

virtual void makVrv::DtIndirectGeometry::installIndirectRenderingProgram ( DtOsgShaderFilesCache shaderFilesCache,
const std::string &  shaderFolderPath,
osg::StateSet *  ss,
DtDe de 
) const
protectedvirtual

install the shaders needed to render using indirect rendering

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 DtAggregateModelInfo modelInfo)
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::createCullingAndLodIfNecessary ( DtDe de)
protectedvirtual

create the culling and lod for this indirect geometry lock myInternalsMutex before calling

virtual void makVrv::DtIndirectGeometry::createManagersIfNecessary ( DtDe de)
protectedvirtual

create the switch manager and the lod manager for this indirect geometry if it has not yet been created.

lock myInternalsMutex before calling

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

reload shaders for if necessary

static osgEarth::VirtualProgram* makVrv::DtIndirectGeometry::findCachedVirtualProgram ( const std::string &  vp_hash)
staticprotected

quick caching of virtual programs to avoid parsing them constantly

static void makVrv::DtIndirectGeometry::cacheVirtualProgram ( const std::string &  vp_hash,
osgEarth::VirtualProgram *  virtualProgram 
)
staticprotected
static void makVrv::DtIndirectGeometry::clearVirtualProgramCache ( )
staticprotected

Friends And Related Function Documentation

needed to give access to wait conditions and mutexes.

Member Data Documentation

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

DtGpuCullingAndLod* makVrv::DtIndirectGeometry::myCullingAndLOD
protected
MapIntToInt makVrv::DtIndirectGeometry::myModelIDsToInstances
protected
std::string makVrv::DtIndirectGeometry::myDrawString
protected
bool makVrv::DtIndirectGeometry::myIsTerrainPatch
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

bool makVrv::DtIndirectGeometry::myReloadSlotConnected
protected
boost::signals2::connection makVrv::DtIndirectGeometry::myConnection
protected
osg::Matrixd makVrv::DtIndirectGeometry::myLocalOriginTransformMatrix
protected
int makVrv::DtIndirectGeometry::myNumIndicesAcrossAllModels
protected

number of indices across all unique models across instances

bool makVrv::DtIndirectGeometry::myLastDebugIndirectColorOn
protected
bool makVrv::DtIndirectGeometry::myLastMissingTextureColorOn
protected
DtTerrainPatchObjectManager* makVrv::DtIndirectGeometry::myTerrainPatchObjectManager
protected
DtGlVaoManager* makVrv::DtIndirectGeometry::myVaoManager
protected
DtIndirectRenderingParameters makVrv::DtIndirectGeometry::myMutableIrParams
mutableprotected
DtInstanceContainer makVrv::DtIndirectGeometry::myMutableInstanceContainer
mutableprotected

container for all the instances registered here

unsigned int makVrv::DtIndirectGeometry::myMutableLastFrameRebuilt
mutableprotected
unsigned int makVrv::DtIndirectGeometry::myMutableLastFrameTexturesUpdated
mutableprotected
DtIndirectSwitchManager* makVrv::DtIndirectGeometry::myMutableSwitchManager
mutableprotected
DtIndirectLodManager* makVrv::DtIndirectGeometry::myMutableLodManager
mutableprotected
DtCullShaderConfig makVrv::DtIndirectGeometry::myCullShaderConfig
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::condition_variable makVrv::DtIndirectGeometry::myWaitCondition
protected
boost::mutex makVrv::DtIndirectGeometry::myWaitMutex
protected
StringVpMap makVrv::DtIndirectGeometry::theVirtualProgramMap
staticprotected
boost::mutex makVrv::DtIndirectGeometry::myInternalsMutex
protected
osg::ref_ptr<DtIndirectGeometryInitMainThreadJob> makVrv::DtIndirectGeometry::myMainThreadInitJob
protected
osg::ref_ptr<DtIndirectGeometryUpdateBuffersMainThreadJob> makVrv::DtIndirectGeometry::myMainThreadUpdateBuffersJob
protected
DtIndirectFadeParameters makVrv::DtIndirectGeometry::myFadeParameters
protected

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

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)