mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
Improve SceneContainer testing code
This commit is contained in:
parent
32a5644d2e
commit
d278aab929
6 changed files with 1374 additions and 671 deletions
|
|
@ -417,13 +417,13 @@ bool SceneContainer::addObject(SceneObject* obj)
|
|||
|
||||
bool SceneContainer::removeObject(SceneObject* obj)
|
||||
{
|
||||
U32 existingIndex = obj->mContainerIndex;
|
||||
AssertFatal(obj->mContainer == this, "Trying to remove from wrong container.");
|
||||
obj->mContainerIndex = 0;
|
||||
obj->mContainer = NULL;
|
||||
|
||||
removeFromBins(obj);
|
||||
|
||||
U32 existingIndex = obj->mContainerIndex;
|
||||
Vector<SceneObject*>::iterator iter = mGlobalList.begin() + existingIndex;
|
||||
mGlobalList.erase_fast(iter);
|
||||
if (existingIndex < mGlobalList.size())
|
||||
|
|
@ -1453,9 +1453,10 @@ void SceneContainer::getBinRange( const F32 min, const F32 max, U32& minBin, U32
|
|||
AssertFatal(maxCoord >= 0.0 && maxCoord < SceneContainer::csmTotalAxisBinSize, "Bad maxCoord");
|
||||
|
||||
minBin = U32(minCoord / SceneContainer::csmBinSize);
|
||||
maxBin = U32(maxCoord / SceneContainer::csmBinSize);
|
||||
maxBin = (U32)mCeil(maxCoord / SceneContainer::csmBinSize);
|
||||
maxBin = maxBin >= SceneContainer::csmNumAxisBins ? SceneContainer::csmNumAxisBins-1 : maxBin;
|
||||
AssertFatal(minBin < SceneContainer::csmNumAxisBins, avar("Error, bad clipping(min)! (%g, %d)", maxCoord, minBin));
|
||||
AssertFatal(minBin < SceneContainer::csmNumAxisBins, avar("Error, bad clipping(max)! (%g, %d)", maxCoord, maxBin));
|
||||
AssertFatal(maxBin < SceneContainer::csmNumAxisBins, avar("Error, bad clipping(max)! (%g, %d)", maxCoord, maxBin));
|
||||
|
||||
// MSVC6 seems to be generating some bad floating point code around
|
||||
// here when full optimizations are on. The min != max test should
|
||||
|
|
|
|||
|
|
@ -745,6 +745,22 @@ public:
|
|||
outRange.maxCoord[1] = outMax;
|
||||
}
|
||||
|
||||
inline void dumpBin(U32 x, U32 y, Vector<SceneObject*> &list)
|
||||
{
|
||||
U32 insertX = x % csmNumAxisBins;
|
||||
U32 insertY = y * csmNumAxisBins;
|
||||
U32 binIDX = insertY + insertX;
|
||||
|
||||
list.clear();
|
||||
if (binIDX < csmTotalNumBins)
|
||||
{
|
||||
for (SceneObject* obj : mBinArray[binIDX])
|
||||
{
|
||||
list.push_back(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void getBinRange( const F32 min, const F32 max, U32& minBin, U32& maxBin );
|
||||
public:
|
||||
Vector<SimObjectPtr<SceneObject>*>& getRadiusSearchList() { return mSearchList; }
|
||||
|
|
|
|||
|
|
@ -160,6 +160,9 @@ SceneObject::SceneObject()
|
|||
mGameObjectAssetId = StringTable->insert("");
|
||||
|
||||
mDirtyGameObject = false;
|
||||
|
||||
mContainer = NULL;
|
||||
mContainerIndex = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -883,7 +883,9 @@ class SceneObject : public NetObject, public ProcessObject
|
|||
//const MatrixF& getLocalTransform() const;
|
||||
/// returns the position within parent SceneObject space (or world space if no parent)
|
||||
//Point3F getLocalPosition() const;
|
||||
|
||||
|
||||
inline U32 getRootContainerIndex() { return mContainerIndex; }
|
||||
inline const SceneBinListLookup getContainerLookupInfo() { return mContainerLookup; }
|
||||
|
||||
// virtual void onParentScaleChanged();
|
||||
// virtual void onParentTransformChanged();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue