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

This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with DtIndirectGeometry -> the viewing parameters (view matrix, projection matrix, etc) -> the indirect registrar (so that it can generate gpu data for -> the models of the instances from the interim data accessible -> via the registrar It outputs are: -> Tndirect command buffer -> The count of the indirect commands -> The input instances shuffled around/culled/lod'ed reflecting -> their order within the indirect command buffer generated -> It will also (optionally) do culling and lod. More...

Public Member Functions

 DtGpuCullingAndLod (DtIndirectGeometryRegistrar *registrar, bool viewFrustumCulling, bool lodChecking, bool useInstanceCount)
 constructor
virtual ~DtGpuCullingAndLod ()
 destructor
virtual void doCullingAndLOD (const DtInstanceContainer &myInstances, const DtIndirectViewParameters &viewParameters, const DtIndirectRenderingParameters &irParams, const MapIntToInt &modelIdsToNumInstances, unsigned int contextID)
 do the culling and the lod
virtual void bind ()
 bind the the instances that were re-distributed/culled/lod'ed whilst generating the command buffer
virtual void unbind ()
 unbind the the instances that were re-distributed/culled/lod'ed whilst generating the command buffer
virtual void bindIndirectThings ()
 bind the indirect command buffer and the count buffer
virtual void unbindIndirectThings ()
 unbind the indirect command buffer and the count buffer
virtual bool useInstanceCount (void) const
 whether we are optimizing for shared models (useInstanceCount()=true) or unique models (useInstanceCount()=false), across instances
virtual int drawCount (void) const
 The number of draw commands generated.
virtual void setShadersFolderPath (const std::string &shaderFolderPath)
 set up the shader folder path (to enable us to load shaders, de is not accessible here)
virtual void setShadersFileCache (DtOsgShaderFilesCache *shaderFilesCache)
 set up the shader file cache (to enable us to load shaders, de is not accessible here)
virtual void releaseGLObjects (osg::State *state) const

Protected Member Functions

virtual void bindGpuOutputInstanceBuffer (void) const
 we need this advancing once per instance
virtual void unbindGpuOutputInstanceBuffer (void) const
virtual void createCullShaderAndProgramIfNecessary (void)
 The cull shader that does the culling/lod/indirect command buffer generation.
virtual void updateGpuTexturesBuffer (unsigned int contextID, const DtInstanceContainer &instances)
 The buffer containing the bindless textures' addresses of the model textures.
virtual void updateInstancesOffsetAndInstances (const DtInstanceContainer &instances, const MapIntToInt &modelIdsToNumInstances)
virtual void updateGpuInstancesBuffer (const DtInstanceContainer &instances, const Vector3_64 &vCameraPosition, bool cameraRelative)
 update the various buffers that are fed to the cull shader -> if new models came in -> if textures became available (they can be asynchronously available, e.g.
virtual void updateGpuGeometrySpecificationsBuffer (const int numGeometries, const DtInstanceContainer &instances)
virtual void updateGpuMaterialsBuffer (const int numGeometries, const DtInstanceContainer &instances)
virtual void updateGpuGeometryOffsetAndSizeBuffer (int &numGeometries, const DtInstanceContainer &instances)
virtual void updateGpuIndirectBuffer (const DtInstanceContainer &instances, int numStates)
virtual void clearInstanceCountIndirectBuffer (int numStates)
virtual void printDebugInstances ()
 Debugging.
virtual int printCountBufferCount ()
virtual void printDrawCommandsDetails (GLuint drawCount)
virtual void printInstancesDetails (GLuint drawCount)
virtual void printModelIdsToNumOfGeosDetails (GLuint drawCount)

Protected Attributes

const DtIndirectGeometryRegistrarmyRegistrar
DtGlBuffermyGpuInstancesBuffer
 The input instances for the GPU (generated/updated from the passed in instance container)
DtGlBuffermyGpuGeometrySpecificationsBuffer
 The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances.
DtGlBuffermyGpuGeometryOffsetAndSizeBuffer
 An internal indexing buffer that allows the cull shader to go from and intance to its GeometrySpecification in the Geometry Specification Buffer.
DtGlBuffermyGpuMaterialsBuffer
 The spec buffer containing Materials for all the models/lods of the passed in instances.
DtGlBuffermyGpuIndirectBuffer
 The indirect command buffer that will be generated.
DtGlBuffermyGpuCountBuffer
 the count buffer that will be generated
DtGlBuffermyGpuOutputInstanceBuffer
 The re-distributed/culled/lod'ed instances (a subset of the input instances)
GLuint myCullProgram
GLuint myCullShader
DtGlBuffermyGpuTexturesBuffer
MapIntToInt myModelIdToIndex
Vector3_64 myPreviousCameraPosition
int myMaxNumInstancesIndex
int myModelViewMatrixIndex
int myProjectionMatrixIndex
int myZoomMagnificationIndex
bool myViewFrustumCulling
bool myLODChecking
bool myUseInstanceCount
std::vector
< InstancesOffsetAndNumOfInstances
myInstancesOffsetAndNumInstances
DtGlBuffermyGpuInstancesOffsetAndNumInstances
int myMaxAtomicCounters
std::string myShaderFolderPath
DtOsgShaderFilesCachemyShaderFilesCache

Static Protected Attributes

static const bool myDebugInstancesAppended

Private Member Functions

 DtGpuCullingAndLod ()
 unimplemented default

Detailed Description

This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with DtIndirectGeometry -> the viewing parameters (view matrix, projection matrix, etc) -> the indirect registrar (so that it can generate gpu data for -> the models of the instances from the interim data accessible -> via the registrar It outputs are: -> Tndirect command buffer -> The count of the indirect commands -> The input instances shuffled around/culled/lod'ed reflecting -> their order within the indirect command buffer generated -> It will also (optionally) do culling and lod.

Constructor & Destructor Documentation

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

constructor

virtual makVrv::DtGpuCullingAndLod::~DtGpuCullingAndLod ( )
virtual

destructor

makVrv::DtGpuCullingAndLod::DtGpuCullingAndLod ( )
private

unimplemented default

Member Function Documentation

virtual void makVrv::DtGpuCullingAndLod::doCullingAndLOD ( const DtInstanceContainer myInstances,
const DtIndirectViewParameters viewParameters,
const DtIndirectRenderingParameters irParams,
const MapIntToInt modelIdsToNumInstances,
unsigned int  contextID 
)
virtual

do the culling and the lod

virtual void makVrv::DtGpuCullingAndLod::bind ( )
virtual

bind the the instances that were re-distributed/culled/lod'ed whilst generating the command buffer

virtual void makVrv::DtGpuCullingAndLod::unbind ( )
virtual

unbind the the instances that were re-distributed/culled/lod'ed whilst generating the command buffer

virtual void makVrv::DtGpuCullingAndLod::bindIndirectThings ( )
virtual

bind the indirect command buffer and the count buffer

virtual void makVrv::DtGpuCullingAndLod::unbindIndirectThings ( )
virtual

unbind the indirect command buffer and the count buffer

virtual bool makVrv::DtGpuCullingAndLod::useInstanceCount ( void  ) const
virtual

whether we are optimizing for shared models (useInstanceCount()=true) or unique models (useInstanceCount()=false), across instances

virtual int makVrv::DtGpuCullingAndLod::drawCount ( void  ) const
virtual

The number of draw commands generated.

Is a value between [0, DtIndirectGeoUtils::getMaxDrawCountNoCullingNoLod()], inclusive

virtual void makVrv::DtGpuCullingAndLod::setShadersFolderPath ( const std::string &  shaderFolderPath)
virtual

set up the shader folder path (to enable us to load shaders, de is not accessible here)

virtual void makVrv::DtGpuCullingAndLod::setShadersFileCache ( DtOsgShaderFilesCache shaderFilesCache)
virtual

set up the shader file cache (to enable us to load shaders, de is not accessible here)

virtual void makVrv::DtGpuCullingAndLod::releaseGLObjects ( osg::State *  state) const
virtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuInstancesBuffer ( const DtInstanceContainer instances,
const Vector3_64 vCameraPosition,
bool  cameraRelative 
)
protectedvirtual

update the various buffers that are fed to the cull shader -> if new models came in -> if textures became available (they can be asynchronously available, e.g.

via osg ico) -> if the number of instances changed

virtual void makVrv::DtGpuCullingAndLod::updateGpuGeometrySpecificationsBuffer ( const int  numGeometries,
const DtInstanceContainer instances 
)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuMaterialsBuffer ( const int  numGeometries,
const DtInstanceContainer instances 
)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuGeometryOffsetAndSizeBuffer ( int numGeometries,
const DtInstanceContainer instances 
)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuIndirectBuffer ( const DtInstanceContainer instances,
int  numStates 
)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::clearInstanceCountIndirectBuffer ( int  numStates)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::bindGpuOutputInstanceBuffer ( void  ) const
protectedvirtual

we need this advancing once per instance

virtual void makVrv::DtGpuCullingAndLod::unbindGpuOutputInstanceBuffer ( void  ) const
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::createCullShaderAndProgramIfNecessary ( void  )
protectedvirtual

The cull shader that does the culling/lod/indirect command buffer generation.

virtual void makVrv::DtGpuCullingAndLod::updateGpuTexturesBuffer ( unsigned int  contextID,
const DtInstanceContainer instances 
)
protectedvirtual

The buffer containing the bindless textures' addresses of the model textures.

virtual void makVrv::DtGpuCullingAndLod::printDebugInstances ( )
protectedvirtual

Debugging.

virtual int makVrv::DtGpuCullingAndLod::printCountBufferCount ( )
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::printDrawCommandsDetails ( GLuint  drawCount)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::printInstancesDetails ( GLuint  drawCount)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::printModelIdsToNumOfGeosDetails ( GLuint  drawCount)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateInstancesOffsetAndInstances ( const DtInstanceContainer instances,
const MapIntToInt modelIdsToNumInstances 
)
protectedvirtual

Member Data Documentation

const DtIndirectGeometryRegistrar* makVrv::DtGpuCullingAndLod::myRegistrar
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuInstancesBuffer
protected

The input instances for the GPU (generated/updated from the passed in instance container)

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuGeometrySpecificationsBuffer
protected

The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuGeometryOffsetAndSizeBuffer
protected

An internal indexing buffer that allows the cull shader to go from and intance to its GeometrySpecification in the Geometry Specification Buffer.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuMaterialsBuffer
protected

The spec buffer containing Materials for all the models/lods of the passed in instances.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuIndirectBuffer
protected

The indirect command buffer that will be generated.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuCountBuffer
protected

the count buffer that will be generated

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuOutputInstanceBuffer
protected

The re-distributed/culled/lod'ed instances (a subset of the input instances)

GLuint makVrv::DtGpuCullingAndLod::myCullProgram
mutableprotected
GLuint makVrv::DtGpuCullingAndLod::myCullShader
mutableprotected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuTexturesBuffer
protected
MapIntToInt makVrv::DtGpuCullingAndLod::myModelIdToIndex
protected
Vector3_64 makVrv::DtGpuCullingAndLod::myPreviousCameraPosition
protected
int makVrv::DtGpuCullingAndLod::myMaxNumInstancesIndex
protected
int makVrv::DtGpuCullingAndLod::myModelViewMatrixIndex
protected
int makVrv::DtGpuCullingAndLod::myProjectionMatrixIndex
protected
int makVrv::DtGpuCullingAndLod::myZoomMagnificationIndex
protected
bool makVrv::DtGpuCullingAndLod::myViewFrustumCulling
protected
bool makVrv::DtGpuCullingAndLod::myLODChecking
protected
bool makVrv::DtGpuCullingAndLod::myUseInstanceCount
protected
const bool makVrv::DtGpuCullingAndLod::myDebugInstancesAppended
staticprotected
std::vector<InstancesOffsetAndNumOfInstances> makVrv::DtGpuCullingAndLod::myInstancesOffsetAndNumInstances
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuInstancesOffsetAndNumInstances
protected
int makVrv::DtGpuCullingAndLod::myMaxAtomicCounters
protected
std::string makVrv::DtGpuCullingAndLod::myShaderFolderPath
protected
DtOsgShaderFilesCache* makVrv::DtGpuCullingAndLod::myShaderFilesCache
protected

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

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)