Cleaning up _findVisibleObjects.
This commit is contained in:
parent
e368926b5f
commit
247535f471
@ -95,7 +95,7 @@ namespace Ogre
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::map<UIntVector3, SceneNode*> sceneNodes;
|
//std::map<UIntVector3, SceneNode*> sceneNodes;
|
||||||
bool surfaceUpToDate[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
bool surfaceUpToDate[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
bool regionIsHomogenous[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
bool regionIsHomogenous[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace Ogre
|
|||||||
,m_bHaveGeneratedMeshes(false)
|
,m_bHaveGeneratedMeshes(false)
|
||||||
,m_axisNode(0)
|
,m_axisNode(0)
|
||||||
{
|
{
|
||||||
sceneNodes.clear();
|
//sceneNodes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
PolyVoxSceneManager::~PolyVoxSceneManager()
|
PolyVoxSceneManager::~PolyVoxSceneManager()
|
||||||
@ -139,32 +139,38 @@ namespace Ogre
|
|||||||
std::string location("");
|
std::string location("");
|
||||||
location = location + "(" + iterRegionGeometry->m_v3dRegionPosition.x + "," + iterRegionGeometry->m_v3dRegionPosition.y + "," + iterRegionGeometry->m_v3dRegionPosition.z + ")";
|
location = location + "(" + iterRegionGeometry->m_v3dRegionPosition.x + "," + iterRegionGeometry->m_v3dRegionPosition.y + "," + iterRegionGeometry->m_v3dRegionPosition.z + ")";
|
||||||
|
|
||||||
//Generate the surface
|
//Get the surface
|
||||||
IndexedSurfacePatch* singleMaterialPatch = iterRegionGeometry->m_patchSingleMaterial;
|
IndexedSurfacePatch* singleMaterialPatch = iterRegionGeometry->m_patchSingleMaterial;
|
||||||
IndexedSurfacePatch* multiMaterialPatch = iterRegionGeometry->m_patchMultiMaterial;
|
IndexedSurfacePatch* multiMaterialPatch = iterRegionGeometry->m_patchMultiMaterial;
|
||||||
|
|
||||||
if((singleMaterialPatch->m_vecVertices.size() == 0) && (singleMaterialPatch->m_vecTriangleIndices.size() == 0))
|
if((singleMaterialPatch->m_vecVertices.size() == 0) && (singleMaterialPatch->m_vecTriangleIndices.size() == 0))
|
||||||
{
|
{
|
||||||
//No geometry exists. We can delete the scene node if it exists
|
try
|
||||||
std::map<UIntVector3, SceneNode*>::iterator iterSceneNode = sceneNodes.find(iterRegionGeometry->m_v3dRegionPosition);
|
{
|
||||||
if(iterSceneNode != sceneNodes.end())
|
getRootSceneNode()->removeAndDestroyChild(location);
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
{
|
{
|
||||||
getRootSceneNode()->removeChild(location);
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If a SceneNode doesn't exist in this position then create one.
|
//If a SceneNode doesn't exist in this position then create one.
|
||||||
std::map<UIntVector3, SceneNode*>::iterator iterSceneNode = sceneNodes.find(iterRegionGeometry->m_v3dRegionPosition);
|
|
||||||
SceneNode* sceneNode;
|
SceneNode* sceneNode;
|
||||||
if(iterSceneNode == sceneNodes.end())
|
try
|
||||||
|
{
|
||||||
|
sceneNode = dynamic_cast<SceneNode*>(getRootSceneNode()->getChild(location));
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
sceneNode = 0;
|
||||||
|
}
|
||||||
|
if(sceneNode == 0)
|
||||||
{
|
{
|
||||||
sceneNode = getRootSceneNode()->createChildSceneNode(location, Vector3(iterRegionGeometry->m_v3dRegionPosition.x*OGRE_REGION_SIDE_LENGTH,iterRegionGeometry->m_v3dRegionPosition.y*OGRE_REGION_SIDE_LENGTH,iterRegionGeometry->m_v3dRegionPosition.z*OGRE_REGION_SIDE_LENGTH));
|
sceneNode = getRootSceneNode()->createChildSceneNode(location, Vector3(iterRegionGeometry->m_v3dRegionPosition.x*OGRE_REGION_SIDE_LENGTH,iterRegionGeometry->m_v3dRegionPosition.y*OGRE_REGION_SIDE_LENGTH,iterRegionGeometry->m_v3dRegionPosition.z*OGRE_REGION_SIDE_LENGTH));
|
||||||
sceneNodes.insert(std::make_pair(iterRegionGeometry->m_v3dRegionPosition, sceneNode));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sceneNode = iterSceneNode->second;
|
|
||||||
sceneNode->detachAllObjects();
|
sceneNode->detachAllObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user