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

Indirect geometry can have multiple models and their corresponding ids registered in it, via multiple threads. More...

Classes

struct  RebuildResult
 Structure for exactly what changed when the indirect geometry got rebuild. More...
class  RegisterModelLodOp

Public Types

typedef boost::signal< void(const
RebuildResult &result) > 
RebuildSignal
 Signal interested parties that our geometries/textures changed. The listeners are typically DtIndirectGeometry'ies.

Public Member Functions

 DtIndirectGeometryRegistrar (const DtIndirectTextureCollectionPolicy &textureCollectionPolicy)
 CTOR.
virtual ~DtIndirectGeometryRegistrar ()
 DTOR.
virtual void queueUpRegisterModelLod (int modelId, int lodId, const DtLodInfo &lodInfo, osg::ref_ptr< const osg::Node > model, const std::string &modelFileName)
virtual void rebuildIfNeeded (unsigned int contextID)
 invoked via the main thread by one (or multiple indirect geometries)
virtual int numModels (void) const
 number of models registered here
virtual int modelId (int index) const
 the actual model id of the model with index
virtual const
VectorGeometryLocations
getVectorGeometryLocations (int modelId) const
 vector of the 'specs' for the model
virtual bool hasVectorGeometryLocations (int modelId) const
 This being true indicates that the model with id modelId was in fact registered here.
virtual const VectorMaterialsgetVectorMaterials (int modelId) const
 get the materials for modelId
virtual const VectorOsgTexturesgetVectorOsgTextures (const int modelId) const
 vector of osg textures encountered within the model
virtual const
DtIndirectTextureCollectionPolicy
textureCollectionPolicy (void) const
 Access the texture collection policy.
virtual
DtIndirectTextureProcessor
textureProcessor ()
 Access the texture processor.
virtual void releaseGLObjects (osg::State *state) const
virtual void bindBuffers ()
 Used internally by DtIndirectGeometry to bind the Vertex/Index/Texture Buffers corresponding to the registrar.
virtual void unbindBuffers ()

Static Public Member Functions

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

Public Attributes

RebuildSignal mySignalRebuild
 DtIndirectGeometry'ies connect to this signal so that they can update their own internal book-keeping when the models/textures come in/change.

Protected Types

typedef tbb::concurrent_queue
< RegisterModelLodOp
QueueRegisterModelLodOps
typedef osg::ref_ptr
< osgEarth::VirtualProgram > 
VirtualProgramRef
typedef std::map< std::string,
VirtualProgramRef
StringVpMap

Protected Member Functions

virtual void registerModelLod (int modelId, int lodId, const DtLodInfo &lodInfo, osg::ref_ptr< const osg::Node > model, const std::string &modelFileName, VectorOsgTextures &newTexturesFound)
 actually register it in the main thread called from rebuildIfNeeded, which is in turn called from main thread
virtual void deleteGpuData () const
 delete the buffers that are on the GPU (the ones above)
virtual bool allTexturesReady (const int modelId, unsigned int contextID) const
 Textures are not loaded directly, but indirectly (and possibly incrementally) by osg.
virtual void bindVAO ()
 VAO helps us to bind all the buffers above using a single draw call.
virtual void unbindVAO ()

Protected Attributes

GLuint myVAO
DtGlBuffermyVertexAndAttributesBuffer
DtGlBuffermyIndexBuffer
DtAggregatedGeometrymyAggregatedGeometry
QueueRegisterModelLodOps myQueueRegisterModelLodOps
const
DtIndirectTextureCollectionPolicy
myTextureCollectionPolicy
DtIndirectTextureProcessor myTextureProcessor

Static Protected Attributes

static StringVpMap s_VirtualProgramMap

Private Member Functions

 DtIndirectGeometryRegistrar ()
 unimplemented default ctor

Detailed Description

Indirect geometry can have multiple models and their corresponding ids registered in it, via multiple threads.

When this happens, the geometry specs/bindless textures need to be updated/maintained in a form that DtIndirectGeometry can use and consume to further upload pertinent information to the GPU. This class manages the registration and the rebuild of the interim GPU data needed The registrar rebuild can be triggered by one (or more) DtIndirectGeometry'ies (when they get drawn). This is done when they are drawn because a context is present at that point (because we are generating GPU data here). This structure below indicates to the listeners of the IndirectGeoRegistrarRebuildResultSignal what exactly change The listeners themselves are typically also the other DtIndirectGeometry'ies which then update their respective gpu data, based on the interim data generated here The general use case of a 'registrar' is that the DtIndirectGeometryLayerManager creates a single registrar for a layer. This enables several DtIndirectGeometry instances within the layer to efficiently share the same registrar (and hence share the models/textures) CDB is a slightly different use case. In the case of Geo Typical layers, the use case is the same as the general use case. In the case of Geo Specific layers, it merits a single indirect geometry to be associated with a single registrar. This is wholly on account of the nature of the CDB data base itself Generally speaking, geospecific tiles (and hence indirect rendering geometries), hardly ever share models/textures, so creating a common registrar per layer is hugely wasteful as well as slow (given how IndirectRendering works). So one is created per tile/indirect geometry and this mapping maintained by the cdb pager Indirect Rendering works best when multiple models can be combined into a single Vertex Buffer, Index Buffer and the textures are in an array of bindless texture addresses. This allows us to fold what would be multiple binds of vertex buffers, index buffers & texture binds per instance, per model into a single indirect draw call for a tile The registrar allows us to register such models that the instances within the DtIndirectGeometry contain We have generalized the concept of a 'model' for this purpose. A 'model' is a top level node (coming from say reading an flt file) An lod is of a model is also a top level node (coming from say reading an flt file) For example, f the original file has 3 lods, then we need to 3 lods of that single model with the top level nodes for those 3 lods Several such models can be registered here

Member Typedef Documentation

typedef boost::signal< void(const RebuildResult& result) > makVrv::DtIndirectGeometryRegistrar::RebuildSignal

Signal interested parties that our geometries/textures changed. The listeners are typically DtIndirectGeometry'ies.

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

Constructor & Destructor Documentation

makVrv::DtIndirectGeometryRegistrar::DtIndirectGeometryRegistrar ( const DtIndirectTextureCollectionPolicy textureCollectionPolicy)

CTOR.

virtual makVrv::DtIndirectGeometryRegistrar::~DtIndirectGeometryRegistrar ( )
virtual

DTOR.

makVrv::DtIndirectGeometryRegistrar::DtIndirectGeometryRegistrar ( )
private

unimplemented default ctor

Member Function Documentation

virtual void makVrv::DtIndirectGeometryRegistrar::queueUpRegisterModelLod ( int  modelId,
int  lodId,
const DtLodInfo lodInfo,
osg::ref_ptr< const osg::Node >  model,
const std::string &  modelFileName 
)
virtual
virtual void makVrv::DtIndirectGeometryRegistrar::rebuildIfNeeded ( unsigned int  contextID)
virtual

invoked via the main thread by one (or multiple indirect geometries)

virtual int makVrv::DtIndirectGeometryRegistrar::numModels ( void  ) const
virtual

number of models registered here

virtual int makVrv::DtIndirectGeometryRegistrar::modelId ( int  index) const
virtual

the actual model id of the model with index

virtual const VectorGeometryLocations& makVrv::DtIndirectGeometryRegistrar::getVectorGeometryLocations ( int  modelId) const
virtual

vector of the 'specs' for the model

virtual bool makVrv::DtIndirectGeometryRegistrar::hasVectorGeometryLocations ( int  modelId) const
virtual

This being true indicates that the model with id modelId was in fact registered here.

virtual const VectorMaterials& makVrv::DtIndirectGeometryRegistrar::getVectorMaterials ( int  modelId) const
virtual

get the materials for modelId

virtual const VectorOsgTextures& makVrv::DtIndirectGeometryRegistrar::getVectorOsgTextures ( const int  modelId) const
virtual

vector of osg textures encountered within the model

virtual void makVrv::DtIndirectGeometryRegistrar::bindBuffers ( )
virtual

Used internally by DtIndirectGeometry to bind the Vertex/Index/Texture Buffers corresponding to the registrar.

The DtIndirectGeometry needs this for rendering because its instances refer to (a subset) of the models registered here

virtual void makVrv::DtIndirectGeometryRegistrar::unbindBuffers ( )
virtual
virtual const DtIndirectTextureCollectionPolicy& makVrv::DtIndirectGeometryRegistrar::textureCollectionPolicy ( void  ) const
virtual

Access the texture collection policy.

virtual DtIndirectTextureProcessor& makVrv::DtIndirectGeometryRegistrar::textureProcessor ( )
virtual

Access the texture processor.

virtual void makVrv::DtIndirectGeometryRegistrar::releaseGLObjects ( osg::State *  state) const
virtual
static osgEarth::VirtualProgram* makVrv::DtIndirectGeometryRegistrar::findCachedVirtualProgram ( const std::string &  vp_hash)
static

quick caching of virtual programs to avoid parsing them constantly

static void makVrv::DtIndirectGeometryRegistrar::cacheVirtualProgram ( const std::string &  vp_hash,
osgEarth::VirtualProgram *  virtualProgram 
)
static
virtual void makVrv::DtIndirectGeometryRegistrar::registerModelLod ( int  modelId,
int  lodId,
const DtLodInfo lodInfo,
osg::ref_ptr< const osg::Node >  model,
const std::string &  modelFileName,
VectorOsgTextures newTexturesFound 
)
protectedvirtual

actually register it in the main thread called from rebuildIfNeeded, which is in turn called from main thread

virtual void makVrv::DtIndirectGeometryRegistrar::deleteGpuData ( ) const
protectedvirtual

delete the buffers that are on the GPU (the ones above)

virtual void makVrv::DtIndirectGeometryRegistrar::bindVAO ( )
protectedvirtual

VAO helps us to bind all the buffers above using a single draw call.

virtual void makVrv::DtIndirectGeometryRegistrar::unbindVAO ( )
protectedvirtual
virtual bool makVrv::DtIndirectGeometryRegistrar::allTexturesReady ( const int  modelId,
unsigned int  contextID 
) const
protectedvirtual

Textures are not loaded directly, but indirectly (and possibly incrementally) by osg.

This call indicates whether all of them for a given model/context have in fact been correctly loaded for a given model id

Member Data Documentation

RebuildSignal makVrv::DtIndirectGeometryRegistrar::mySignalRebuild

DtIndirectGeometry'ies connect to this signal so that they can update their own internal book-keeping when the models/textures come in/change.

GLuint makVrv::DtIndirectGeometryRegistrar::myVAO
mutableprotected
DtGlBuffer* makVrv::DtIndirectGeometryRegistrar::myVertexAndAttributesBuffer
protected
DtGlBuffer* makVrv::DtIndirectGeometryRegistrar::myIndexBuffer
protected
DtAggregatedGeometry* makVrv::DtIndirectGeometryRegistrar::myAggregatedGeometry
protected
QueueRegisterModelLodOps makVrv::DtIndirectGeometryRegistrar::myQueueRegisterModelLodOps
protected
const DtIndirectTextureCollectionPolicy& makVrv::DtIndirectGeometryRegistrar::myTextureCollectionPolicy
protected
StringVpMap makVrv::DtIndirectGeometryRegistrar::s_VirtualProgramMap
staticprotected
DtIndirectTextureProcessor makVrv::DtIndirectGeometryRegistrar::myTextureProcessor
protected

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)