VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
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 Types

enum  IndirectStates { CullFaceOnState = 0, CullFaceOffState = 1, NumStates = 2 }

Public Member Functions

 DtIndirectGeometry (DtIndirectGeometryRegistrar *registrar, bool viewFrustumCulling, bool lodChecking, bool useInstanceCount)
 CTOR.
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
virtual void addInstance (const DtInstance_64 &instance)
 Add an 'instance' of a model.
virtual void removeAllInstances (void)
 Remove all the instances.
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.
virtual void setParent (const osg::Group *parent)
 Typically a feature tile node/cdb group node.
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.
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.
virtual void releaseGLObjects (osg::State *state) const

Protected Types

typedef boost::unordered_map
< unsigned int, GLuint > 
MapContextToVAO

Protected Member Functions

 DtIndirectGeometry ()
 purposely protected. disallow creation, without a registrar
virtual ~DtIndirectGeometry ()
 purposely protected
virtual void addInstanceActual (const DtInstance_64 &instance)
 actually add the instances that were queued up via possibly multiple threads this happens as part of the drawImplementation call (before the culling and subsequent drawing)
virtual bool actuallyAddQueuedUpInstances (void)
virtual void setVisibility (bool visibility)
 visibility
virtual GLuint getOrCreateAndRecordVAO (const osg::RenderInfo &renderInfo) 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
virtual void clearVAO (const osg::RenderInfo &renderInfo)
virtual void recordVAO (GLuint vao) const
virtual void slot_rebuild (const DtIndirectGeometryRegistrar::RebuildResult &result)
 the slot for when the registrar rebuilt its internal structures because we need to accordingly update the instances and/or model specs for these instances
virtual void setUpShadersIfNecessary (osgUtil::CullVisitor *cullVisitor)
 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)
virtual void installIndirectRenderingProgram (DtOsgShaderFilesCache *shaderFilesCache, const std::string &shaderFolderPath, osg::StateSet *ss) const
 install the shaders needed to render using indirect rendering
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

Protected Attributes

DtIndirectGeometryRegistrarmyRegistrar
 pointer to the (external) registrar
DtInstanceContainer myInstanceContainer
 container for all the instances registered here
tbb::concurrent_queue
< DtInstance_64
myQueueInstancesToAdd
 addInstance may be called from multiple threads. Hence, concurrent queue
MapContextToVAO myMutableMapContextToVAO
DtGpuCullingAndLodmyCullingAndLOD
DtIndirectRenderingParameters myMutableIrParams
MapIntToInt myModelIDsToInstances
osg::ref_ptr< osg::Uniform > myViewMatrix
osg::ref_ptr< osg::Uniform > myProjectionMatrix
std::string myDrawString
bool myMutableShadersSetup
DtIndirectGeometryStateManager myStateManager

Detailed Description

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

Typically, the DtIndirectGeometry is parented to the feature tile nodes and manages the indirect rendering of all the feature points in that tile

Member Typedef Documentation

typedef boost::unordered_map<unsigned int, GLuint> makVrv::DtIndirectGeometry::MapContextToVAO
protected

Member Enumeration Documentation

Enumerator:
CullFaceOnState 
CullFaceOffState 
NumStates 

Constructor & Destructor Documentation

makVrv::DtIndirectGeometry::DtIndirectGeometry ( DtIndirectGeometryRegistrar registrar,
bool  viewFrustumCulling,
bool  lodChecking,
bool  useInstanceCount 
)

CTOR.

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)
viewFrustumCullingdetermines whether the internal cull shader will do the view frustum culling
lodCheckingdetermines whether whether the internal cull shader will do the lod checking
useInstanceCountadjusts whether the cull shader will optimize for (mostly) unique models across instances (as is the case with cdb gs instances for example), in which case set the useInstanceCount = false or (mostly) shared models, in which case set the useInstanceCount = true

Remarks: Its still (probably) faster to run the cull shader, so that it may quickly generate the indirect command buffer by redistributing the (possibly) out of order instances in a fast, parallelized fashion , than to use the cpu to do this

makVrv::DtIndirectGeometry::DtIndirectGeometry ( )
protected

purposely protected. disallow creation, without a registrar

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

purposely protected

Member Function Documentation

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::addInstance ( const DtInstance_64 instance)
virtual

Add an 'instance' of a model.

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
virtual void makVrv::DtIndirectGeometry::addInstanceActual ( const DtInstance_64 instance)
protectedvirtual

actually add the instances that were queued up via possibly multiple threads this happens as part of the drawImplementation call (before the culling and subsequent drawing)

virtual bool makVrv::DtIndirectGeometry::actuallyAddQueuedUpInstances ( void  )
protectedvirtual
virtual void makVrv::DtIndirectGeometry::setVisibility ( bool  visibility)
protectedvirtual

visibility

virtual GLuint makVrv::DtIndirectGeometry::getOrCreateAndRecordVAO ( const osg::RenderInfo &  renderInfo) 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::clearVAO ( const osg::RenderInfo &  renderInfo)
protectedvirtual
virtual void makVrv::DtIndirectGeometry::recordVAO ( GLuint  vao) const
protectedvirtual
virtual void makVrv::DtIndirectGeometry::slot_rebuild ( const DtIndirectGeometryRegistrar::RebuildResult result)
protectedvirtual

the slot for when the registrar rebuilt its internal structures because we need to accordingly update the instances and/or model specs for these instances

virtual void makVrv::DtIndirectGeometry::setUpShadersIfNecessary ( osgUtil::CullVisitor *  cullVisitor)
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)

virtual void makVrv::DtIndirectGeometry::installIndirectRenderingProgram ( DtOsgShaderFilesCache shaderFilesCache,
const std::string &  shaderFolderPath,
osg::StateSet *  ss 
) 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

Member Data Documentation

DtIndirectGeometryRegistrar* makVrv::DtIndirectGeometry::myRegistrar
protected

pointer to the (external) registrar

DtInstanceContainer makVrv::DtIndirectGeometry::myInstanceContainer
protected

container for all the instances registered here

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

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

MapContextToVAO makVrv::DtIndirectGeometry::myMutableMapContextToVAO
mutableprotected
DtGpuCullingAndLod* makVrv::DtIndirectGeometry::myCullingAndLOD
protected
DtIndirectRenderingParameters makVrv::DtIndirectGeometry::myMutableIrParams
mutableprotected
MapIntToInt makVrv::DtIndirectGeometry::myModelIDsToInstances
protected
osg::ref_ptr<osg::Uniform> makVrv::DtIndirectGeometry::myViewMatrix
protected
osg::ref_ptr<osg::Uniform> makVrv::DtIndirectGeometry::myProjectionMatrix
protected
std::string makVrv::DtIndirectGeometry::myDrawString
protected
bool makVrv::DtIndirectGeometry::myMutableShadersSetup
mutableprotected
DtIndirectGeometryStateManager makVrv::DtIndirectGeometry::myStateManager
protected

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

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)