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 Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtIndirectGeometryGrid Class Reference

Manages a bunch of 'cells' for a given cell size (similar to a sparse octree) each cell has a.

See Also
DtIndirectEntityGeometry associated with it if it has at least one entity in it.
DtIndirectGeometryGridNode is the osg::Node derrived object which manages traversal and sets up the indirect geometries for cull/draw Each cell is the same size in world space and is an axis aligned cube (or rectangular prism if the cell size is not the same for all components) Contains a
DtIndirectModelsContainer object which contains the shared
DtIndirectRegistrar for keeping the unique model information. All
DtIndirectEntityGeometry object held by this grid use the same registrar in order to avoid duplication of the unique model data (verts/colors/textures/etc).

Classes

struct  InstanceTrackingStruct
 

Public Types

enum  InstanceTrackingType {
  INSTANCE_ADD_REGULAR, INSTANCE_REMOVE_REGULAR, INSTANCE_ADD_MOVE_NEW_CELL, INSTANCE_REMOVE_MOVE_OLD_CELL,
  INSTANCE_REMOVE_MOVE_CANCEL_NEW_CELL, INSTANCE_REMOVE_CELL_PAGED_OUT
}
 
using MapCellIdsToIndirectGeometry = tbb::concurrent_hash_map< Vector3_int, osg::ref_ptr< DtIndirectEntityGeometry >, DtIndirectCellHasher >
 
using MapCellIdsToDebugCellDrawables = std::unordered_map< Vector3_int, osg::ref_ptr< osg::Drawable >, DtIndirectCellHasher >
 
using InstanceTrackingRequestsVector = tbb::concurrent_vector< InstanceTrackingStruct >
 

Public Member Functions

virtual ~DtIndirectGeometryGrid ()
 
virtual DtIndirectEntityGeometryts_getOrCreateForCell (const Vector3_int &cellId, bool &created)
 
virtual const
DtIndirectEntityGeometry
findIndirectGeometryForCell (const Vector3_int &cellId) const
 
virtual bool ts_removeCell (const Vector3_int &cellId)
 
virtual Vector3_int cellIdFor (const Vector3_64 &position) const
 
virtual Vector3_64 cellCenter (const Vector3_int &cellId) const
 
virtual AxisAlignedBoundingBox_64 axisAlignedBoundingBox (const Vector3_int &cellId) const
 
virtual AxisAlignedBoundingBox_64 axisAlignedBoundingBoxWithPadding (const Vector3_int &cellId) const
 
virtual DtIndirectModelsContainermodelsContainer ()
 
virtual osg::ref_ptr< osg::Node > gridNode ()
 
virtual const
MapCellIdsToIndirectGeometry
mapCellIdsToIndirectGeometry (void) const
 
virtual const
MapCellIdsToDebugCellDrawables
mapCellIdsToDebugCellDrawables (void) const
 
virtual void concurrentAddInstanceTrackingRequest (const Vector3_int &cellId, int modelId, InstanceTrackingType type)
 
virtual void processInstanceTrackingRequests ()
 
virtual void trackInstances (const Vector3_int &cellId, int modelId, InstanceTrackingType type)
 
virtual const
DtIndirectLimitTextureStrategy
limitTextureStrategy (void) const
 
virtual
DtIndirectLimitTextureStrategy
limitTextureStrategy (void)
 
DtModelSetId modelSet (void) const
 
virtual osg::ref_ptr< osg::Node > gridRenderer ()
 
virtual std::string modelSetString (void) const
 
virtual void setCellSize (const Vector3_64 &cellSize)
 
virtual const Vector3_64cellSize (void) const
 
virtual void setCellPadding (const Vector3_64 &padding)
 
virtual const Vector3_64cellPadding (void) const
 

Public Attributes

friend DtIndirectGeometryGridCreator
 

Protected Member Functions

 DtIndirectGeometryGrid (DtDe &de, DtModelSetId modelSet)
 

Protected Attributes

DtDemyDe
 
osg::ref_ptr< osg::Node > myGridNode
 
osg::ref_ptr
< DtIndirectGeometryRenderer
myGridRenderer
 
MapCellIdsToIndirectGeometry myMapCellIdsToIndirectGeometry
 
boost::mutex myMapCellIdsToDebugCellDrawablesMutex
 
MapCellIdsToDebugCellDrawables myMapCellIdsToDebugCellDrawables
 
DtIndirectModelsContainermyModelsContainer
 
Vector3_64 myCellSize
 
Vector3_64 myCellPadding
 
boost::mutex myMapCellIdsToIndirectGeometryMutex
 
std::unordered_map
< Vector3_int,
std::unordered_map< int, int >
, DtIndirectCellHasher
myMapCellToModelInstances
 
std::unordered_map< int, intmyModelIdToNumInstances
 
DtIndirectLimitTextureStrategymyLimitTextureStrategy
 
const DtModelSetId myModelSet = DtModelSetId::Unspecified
 
AxisAlignedBoundingBox_64 myInfiniteBoundingBox
 
InstanceTrackingRequestsVector myInstanceTrackingRequests
 

Private Member Functions

 DtIndirectGeometryGrid ()=delete
 
 DtIndirectGeometryGrid (const DtIndirectGeometryGrid &other)=delete
 
DtIndirectGeometryGridoperator= (const DtIndirectGeometryGrid &other)=delete
 

Member Typedef Documentation

The map of a cell 'id' to its corresponding indirect geometry.

The map of a cell 'id' to its corresponding debug drawable.

Concurrent vector for storing indirect tracking info. As indirect geomtries can be created in multiple threads so can the tracking info Tracking requests are ticked in processInstanceTrackingRequests.

Member Enumeration Documentation

Enumerator
INSTANCE_ADD_REGULAR 
INSTANCE_REMOVE_REGULAR 
INSTANCE_ADD_MOVE_NEW_CELL 
INSTANCE_REMOVE_MOVE_OLD_CELL 
INSTANCE_REMOVE_MOVE_CANCEL_NEW_CELL 
INSTANCE_REMOVE_CELL_PAGED_OUT 

Constructor & Destructor Documentation

virtual makVrv::DtIndirectGeometryGrid::~DtIndirectGeometryGrid ( )
virtual

DTOR.

makVrv::DtIndirectGeometryGrid::DtIndirectGeometryGrid ( DtDe de,
DtModelSetId  modelSet 
)
protected

CTOR.

makVrv::DtIndirectGeometryGrid::DtIndirectGeometryGrid ( )
privatedelete

default constructor not implemented

makVrv::DtIndirectGeometryGrid::DtIndirectGeometryGrid ( const DtIndirectGeometryGrid other)
privatedelete

Copy Constructor not implemented – Copy Not Allowed.

Member Function Documentation

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

Assignment Operator Not implemented – Assignment Not Allowed.

virtual DtIndirectEntityGeometry* makVrv::DtIndirectGeometryGrid::ts_getOrCreateForCell ( const Vector3_int cellId,
bool created 
)
virtual

get an indirect geometry for this cell, or create one created parameter indicates whether this was created anew Called by the background update tickables which run in parallel so this function has a mutex in order to be thread safe

virtual const DtIndirectEntityGeometry* makVrv::DtIndirectGeometryGrid::findIndirectGeometryForCell ( const Vector3_int cellId) const
virtual

Attempt to find an indirect geometry for this cell Can return nullptr.

virtual bool makVrv::DtIndirectGeometryGrid::ts_removeCell ( const Vector3_int cellId)
virtual

remove a cell and indirect geometry for the given cell

virtual Vector3_int makVrv::DtIndirectGeometryGrid::cellIdFor ( const Vector3_64 position) const
virtual

get the cell id for a given position

virtual Vector3_64 makVrv::DtIndirectGeometryGrid::cellCenter ( const Vector3_int cellId) const
virtual

get the cell center of a given cell

virtual AxisAlignedBoundingBox_64 makVrv::DtIndirectGeometryGrid::axisAlignedBoundingBox ( const Vector3_int cellId) const
virtual

get AABB

virtual AxisAlignedBoundingBox_64 makVrv::DtIndirectGeometryGrid::axisAlignedBoundingBoxWithPadding ( const Vector3_int cellId) const
virtual

get AABB with padding

virtual DtIndirectModelsContainer* makVrv::DtIndirectGeometryGrid::modelsContainer ( )
virtual

get the internal models' container

virtual void makVrv::DtIndirectGeometryGrid::setCellSize ( const Vector3_64 cellSize)
virtual

set/get the cell size

virtual const Vector3_64& makVrv::DtIndirectGeometryGrid::cellSize ( void  ) const
virtual

set/get the cell size

virtual void makVrv::DtIndirectGeometryGrid::setCellPadding ( const Vector3_64 padding)
virtual

set/get the cell padding. If an entity position is out of a cell (as determined by cellIdFor(), then we can further determine if its still in the old cell expanded with this padding. This is useful for retaining the entity within an old cell, if they flip/flop on the edges of 2 cells (e.g. buoys)

virtual const Vector3_64& makVrv::DtIndirectGeometryGrid::cellPadding ( void  ) const
virtual

set/get the cell padding. If an entity position is out of a cell (as determined by cellIdFor(), then we can further determine if its still in the old cell expanded with this padding. This is useful for retaining the entity within an old cell, if they flip/flop on the edges of 2 cells (e.g. buoys)

virtual osg::ref_ptr<osg::Node> makVrv::DtIndirectGeometryGrid::gridNode ( )
virtual

get the underlying top level grid node that is the parent of the indirect geometries

virtual const MapCellIdsToIndirectGeometry& makVrv::DtIndirectGeometryGrid::mapCellIdsToIndirectGeometry ( void  ) const
virtual

get the map of cell ids to indirect geometries

virtual const MapCellIdsToDebugCellDrawables& makVrv::DtIndirectGeometryGrid::mapCellIdsToDebugCellDrawables ( void  ) const
virtual

get the map of cell ids to indirect geometries (const version)

virtual void makVrv::DtIndirectGeometryGrid::concurrentAddInstanceTrackingRequest ( const Vector3_int cellId,
int  modelId,
InstanceTrackingType  type 
)
virtual

Places a tracking request on InstanceTrackingRequestsVector. Thread safe.

virtual void makVrv::DtIndirectGeometryGrid::processInstanceTrackingRequests ( )
virtual

Iterates through myInstanceTrackingRequests calling trackInstances. Not thread safe.

virtual void makVrv::DtIndirectGeometryGrid::trackInstances ( const Vector3_int cellId,
int  modelId,
InstanceTrackingType  type 
)
virtual

track the model ids to num of instances for a cell

virtual const DtIndirectLimitTextureStrategy* makVrv::DtIndirectGeometryGrid::limitTextureStrategy ( void  ) const
virtual

access

virtual DtIndirectLimitTextureStrategy* makVrv::DtIndirectGeometryGrid::limitTextureStrategy ( void  )
virtual

access. non-const

DtModelSetId makVrv::DtIndirectGeometryGrid::modelSet ( void  ) const

model set that this grid is for

virtual osg::ref_ptr<osg::Node> makVrv::DtIndirectGeometryGrid::gridRenderer ( )
virtual

get the underlying top level grid renderer node that is used to draw the geometries

virtual std::string makVrv::DtIndirectGeometryGrid::modelSetString ( void  ) const
virtual

utility

Member Data Documentation

friend makVrv::DtIndirectGeometryGrid::DtIndirectGeometryGridCreator

only creator can created

DtDe& makVrv::DtIndirectGeometryGrid::myDe
protected

reference to DtDe

osg::ref_ptr<osg::Node> makVrv::DtIndirectGeometryGrid::myGridNode
protected
osg::ref_ptr<DtIndirectGeometryRenderer> makVrv::DtIndirectGeometryGrid::myGridRenderer
protected
MapCellIdsToIndirectGeometry makVrv::DtIndirectGeometryGrid::myMapCellIdsToIndirectGeometry
protected
boost::mutex makVrv::DtIndirectGeometryGrid::myMapCellIdsToDebugCellDrawablesMutex
protected
MapCellIdsToDebugCellDrawables makVrv::DtIndirectGeometryGrid::myMapCellIdsToDebugCellDrawables
protected
DtIndirectModelsContainer* makVrv::DtIndirectGeometryGrid::myModelsContainer
protected
Vector3_64 makVrv::DtIndirectGeometryGrid::myCellSize
protected

the cell size

Vector3_64 makVrv::DtIndirectGeometryGrid::myCellPadding
protected

the cell 'padding'

boost::mutex makVrv::DtIndirectGeometryGrid::myMapCellIdsToIndirectGeometryMutex
protected
std::unordered_map<Vector3_int, std::unordered_map<int, int>, DtIndirectCellHasher > makVrv::DtIndirectGeometryGrid::myMapCellToModelInstances
protected

map of a cell to a map of model ids to number of instances of those model ids, in the cell

std::unordered_map<int, int> makVrv::DtIndirectGeometryGrid::myModelIdToNumInstances
protected

map of model ids to number of instances of those model ids, for the entire grid

DtIndirectLimitTextureStrategy* makVrv::DtIndirectGeometryGrid::myLimitTextureStrategy
protected
const DtModelSetId makVrv::DtIndirectGeometryGrid::myModelSet = DtModelSetId::Unspecified
protected
AxisAlignedBoundingBox_64 makVrv::DtIndirectGeometryGrid::myInfiniteBoundingBox
protected
InstanceTrackingRequestsVector makVrv::DtIndirectGeometryGrid::myInstanceTrackingRequests
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)