mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 13:25:36 +00:00
Optimize container bin lookups
This commit is contained in:
parent
c6047b24eb
commit
596d13f9a4
12 changed files with 1100 additions and 708 deletions
|
|
@ -52,10 +52,6 @@
|
|||
#include "T3D/gameBase/processList.h"
|
||||
#endif
|
||||
|
||||
#ifndef _SCENECONTAINER_H_
|
||||
#include "scene/sceneContainer.h"
|
||||
#endif
|
||||
|
||||
#ifndef _GFXDEVICE_H_
|
||||
#include "gfx/gfxDevice.h"
|
||||
#endif
|
||||
|
|
@ -74,6 +70,11 @@
|
|||
#include "T3D/assets/GameObjectAsset.h"
|
||||
#endif
|
||||
|
||||
#ifndef _SCENEQUERY_UTIL_H_
|
||||
#include "scene/sceneQueryUtil.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SceneManager;
|
||||
class SceneRenderState;
|
||||
class SceneTraversalState;
|
||||
|
|
@ -87,7 +88,7 @@ class SFXAmbience;
|
|||
|
||||
struct ObjectRenderInst;
|
||||
struct Move;
|
||||
|
||||
struct SceneRayHelper;
|
||||
|
||||
/// A 3D object.
|
||||
///
|
||||
|
|
@ -112,7 +113,7 @@ struct Move;
|
|||
///
|
||||
/// @see http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3217
|
||||
/// for a copy of Melv's example.
|
||||
class SceneObject : public NetObject, private SceneContainer::Link, public ProcessObject
|
||||
class SceneObject : public NetObject, public ProcessObject
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -123,6 +124,7 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
|
|||
friend class SceneZoneSpaceManager;
|
||||
friend class SceneCullingState; // _getZoneRefHead
|
||||
friend class SceneObjectLink; // mSceneObjectLinks
|
||||
friend struct SceneRayHelper;
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -223,10 +225,22 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
|
|||
/// @{
|
||||
|
||||
/// Bidirectional link between a zone manager and its objects.
|
||||
struct ZoneRef : public SceneObjectRefBase< ZoneRef >
|
||||
struct ZoneRef
|
||||
{
|
||||
/// ID of zone.
|
||||
U32 zone;
|
||||
|
||||
/// Object that is referenced in the link.
|
||||
SceneObject* object;
|
||||
|
||||
/// Next link in chain of container.
|
||||
ZoneRef* nextInBin;
|
||||
|
||||
/// Previous link in chain of container.
|
||||
ZoneRef* prevInBin;
|
||||
|
||||
/// Next link in chain that is associated with #object.
|
||||
ZoneRef* nextInObj;
|
||||
};
|
||||
|
||||
/// Iterator over the zones that the object is assigned to.
|
||||
|
|
@ -360,17 +374,15 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
|
|||
/// Container database that the object is assigned to.
|
||||
SceneContainer* mContainer;
|
||||
|
||||
/// Assigned container index
|
||||
U32 mContainerIndex;
|
||||
|
||||
/// Lookup Info
|
||||
SceneBinListLookup mContainerLookup;
|
||||
|
||||
/// SceneContainer sequence key.
|
||||
U32 mContainerSeqKey;
|
||||
|
||||
///
|
||||
SceneObjectRef* mBinRefHead;
|
||||
|
||||
U32 mBinMinX;
|
||||
U32 mBinMaxX;
|
||||
U32 mBinMinY;
|
||||
U32 mBinMaxY;
|
||||
|
||||
/// Returns the container sequence key.
|
||||
U32 getContainerSeqKey() const { return mContainerSeqKey; }
|
||||
|
||||
|
|
@ -464,7 +476,7 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
|
|||
virtual void enableCollision();
|
||||
|
||||
/// Returns true if collisions are enabled
|
||||
bool isCollisionEnabled() const { return mCollisionCount == 0; }
|
||||
inline bool isCollisionEnabled() const { return mCollisionCount == 0; }
|
||||
|
||||
/// This gets called when an object collides with this object.
|
||||
/// @param object Object colliding with this object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue