SceneContainer

Engine/source/scene/sceneContainer.h

Database for SceneObjects.

More...

Classes:

Basic database operations

findObjects(U32 mask, FindCallback callback, void * key)

Find all objects of the given type(s) and invoke the given callback for each of them.

findObjects(const Frustum & frustum, U32 mask, FindCallback , void * key)
findObjectList(U32 mask, Vector< SceneObject * > * outFound)

Find all objects of the given type(s) and add them to the given vector.

findObjectList(const Box3F & box, U32 mask, Vector< SceneObject * > * outFound)
findObjectList(const Frustum & frustum, U32 mask, Vector< SceneObject * > * outFound)
void(*
FindCallback )(SceneObject *object, void *key)

Line intersection

bool
castRay(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Test against collision geometry – fast.

bool
castRayRendered(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Test against rendered geometry – slow.

bool
collideBox(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info)
bool(*
CastRayCallback )(RayInfo *ri)

Poly list

bool
buildPolyList(PolyListContext context, const Box3F & box, U32 typeMask, AbstractPolyList * polylist)

Private Types

enum
CastRayType {
  CollisionGeometry 
  RenderedGeometry 
}

Private Attributes

Current sequence key.

bool

Container queries based on #mCurrSeqKey are are not re-entrant; this is used to detect when it happens.

Object searches to support console querying of the database. ONLY WORKS ON SERVER.

Vector that contains just the terrain objects in the container.

A vector that contains just the water and physical zone object types which is used to optimize searches.

Public Functions

bool

Add an object to the database.

Make sure that we're not just sticking the object right back where it came from.

Return a vector containing all terrain objects in this container.

Return a vector containing all the water and physical zone objects in this container.

initRadiusSearch(const Point3F & searchPoint, const F32 searchRadius, const U32 searchMask)
bool

Remove an object from the database.

Private Functions

bool
_castRay(U32 type, const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Base cast ray code.

_findSpecialObjects(const Vector< SceneObject * > & vector, const Box3F & box, U32 mask, FindCallback callback, void * key)

Private Static Functions

getBinRange(const F32 min, const F32 max, U32 & minBin, U32 & maxBin)

Detailed Description

Database for SceneObjects.

ScenceContainer implements a grid-based spatial subdivision for the contents of a scene.

Basic database operations

findObjects(U32 mask, FindCallback callback, void * key)

Find all objects of the given type(s) and invoke the given callback for each of them.

Parameters:

mask

Object type mask (

see:

SimObjectTypes).

Parameters:
callback

Pointer to function to invoke for each object.

key

User data to pass to the "key" argument of callback.

findObjects(const Box3F & box, U32 mask, FindCallback , void * key)

findObjects(const Frustum & frustum, U32 mask, FindCallback , void * key)

polyhedronFindObjects(const Polyhedron & polyhedron, U32 mask, FindCallback , void * key)

findObjectList(U32 mask, Vector< SceneObject * > * outFound)

Find all objects of the given type(s) and add them to the given vector.

Parameters:

mask

Object type mask (

see:

SimObjectTypes).

Parameters:
outFound

Vector to add found objects to.

findObjectList(const Box3F & box, U32 mask, Vector< SceneObject * > * outFound)

findObjectList(const Frustum & frustum, U32 mask, Vector< SceneObject * > * outFound)

typedef void(* FindCallback )(SceneObject *object, void *key)

Line intersection

castRay(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Test against collision geometry – fast.

castRayRendered(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Test against rendered geometry – slow.

collideBox(const Point3F & start, const Point3F & end, U32 mask, RayInfo * info)

typedef bool(* CastRayCallback )(RayInfo *ri)

Poly list

buildPolyList(PolyListContext context, const Box3F & box, U32 typeMask, AbstractPolyList * polylist)

Private Types

CastRayType

Enumerator

CollisionGeometry
RenderedGeometry

Private Attributes

SceneObjectRef * mBinArray 
S32 mCurrSearchPos 
U32 mCurrSeqKey 

Current sequence key.

Link mEnd 
SceneObjectRef * mFreeRefPool 
SceneObjectRef mOverflowBin 
Vector< SceneObjectRef * > mRefPoolBlocks 
bool mSearchInProgress 

Container queries based on #mCurrSeqKey are are not re-entrant; this is used to detect when it happens.

Vector< SimObjectPtr< SceneObject > * > mSearchList 

Object searches to support console querying of the database. ONLY WORKS ON SERVER.

Point3F mSearchReferencePoint 
Link mStart 
Vector< SceneObject * > mTerrains 

Vector that contains just the terrain objects in the container.

Vector< SceneObject * > mWaterAndZones 

A vector that contains just the water and physical zone object types which is used to optimize searches.

Private Static Attributes

const F32 csmBinSize 
const U32 csmNumBins 
const U32 csmRefPoolBlockSize 
const F32 csmTotalBinSize 

Public Functions

SceneContainer()

~SceneContainer()

addObject(SceneObject * object)

Add an object to the database.

Parameters:

object

A SceneObject.

addRefPoolBlock()

allocateObjectRef()

checkBins(SceneObject * object)

Make sure that we're not just sticking the object right back where it came from.

The overloaded insertInto is so we don't calculate the ranges twice.

containerSearchCurrDist()

containerSearchCurrRadiusDist()

containerSearchNext()

containerSearchNextObject()

freeObjectRef(SceneObjectRef * )

getRadiusSearchList()

getTerrains()

Return a vector containing all terrain objects in this container.

getWaterAndPhysicalZones()

Return a vector containing all the water and physical zone objects in this container.

initRadiusSearch(const Point3F & searchPoint, const F32 searchRadius, const U32 searchMask)

initTypeSearch(const U32 searchMask)

insertIntoBins(SceneObject * , U32 , U32 , U32 , U32 )

insertIntoBins(SceneObject * object)

removeFromBins(SceneObject * object)

removeObject(SceneObject * object)

Remove an object from the database.

Parameters:

object

A SceneObject.

Private Functions

_castRay(U32 type, const Point3F & start, const Point3F & end, U32 mask, RayInfo * info, CastRayCallback callback)

Base cast ray code.

_findSpecialObjects(const Vector< SceneObject * > & vector, const Box3F & box, U32 mask, FindCallback callback, void * key)

_findSpecialObjects(const Vector< SceneObject * > & vector, U32 mask, FindCallback , void * key)

cleanupSearchVectors()

Private Static Functions

getBinRange(const F32 min, const F32 max, U32 & minBin, U32 & maxBin)