Refactoring - PolyVoxSceneManager no longer derives from SceneManager.

This commit is contained in:
David Williams 2008-01-29 20:47:04 +00:00
parent a093b57ae4
commit 7b8e035bd1
2 changed files with 11 additions and 60 deletions

View File

@ -44,24 +44,12 @@ namespace Ogre
SOBEL
};
/// Factory for default scene manager
class VOXEL_SCENE_MANAGER_API PolyVoxSceneManagerFactory : public SceneManagerFactory
{
public:
/// Factory type name
static const String FACTORY_TYPE_NAME;
SceneManager* createInstance(const String& instanceName);
void destroyInstance(SceneManager* instance);
protected:
void initMetaData(void) const;
};
/// Voxel scene manager
class VOXEL_SCENE_MANAGER_API PolyVoxSceneManager : public SceneManager
class VOXEL_SCENE_MANAGER_API PolyVoxSceneManager
{
public:
//Constructors, etc
PolyVoxSceneManager(const String& name);
PolyVoxSceneManager();
~PolyVoxSceneManager();
//Getters
@ -91,13 +79,8 @@ namespace Ogre
bool containsPoint(Vector3 pos, float boundary);
bool containsPoint(IntVector3 pos, uint boundary);
void setAxisVisible(bool visible);
//void setAxisVisible(bool visible);
//SceneNode* makeSureSceneNodeExists(bool bShouldExist, const String strSceneNodeName);
//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 regionIsHomogenous[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
@ -110,8 +93,8 @@ namespace Ogre
void markVoxelChanged(uint x, uint y, uint z);
void markRegionChanged(uint firstX, uint firstY, uint firstZ, uint lastX, uint lastY, uint lastZ);
void createAxis(uint uSideLength);
SceneNode* m_axisNode;
/*void createAxis(uint uSideLength);
SceneNode* m_axisNode;*/
static uint fileNo;

View File

@ -34,41 +34,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace Ogre
{
//////////////////////////////////////////////////////////////////////////
// PolyVoxSceneManagerFactory
//////////////////////////////////////////////////////////////////////////
const String PolyVoxSceneManagerFactory::FACTORY_TYPE_NAME = "PolyVoxSceneManager";
SceneManager* PolyVoxSceneManagerFactory::createInstance(
const String& instanceName)
{
return new PolyVoxSceneManager(instanceName);
}
void PolyVoxSceneManagerFactory::destroyInstance(SceneManager* instance)
{
delete instance;
}
void PolyVoxSceneManagerFactory::initMetaData(void) const
{
mMetaData.typeName = FACTORY_TYPE_NAME;
mMetaData.description = "A voxel based scene manager";
mMetaData.sceneTypeMask = ST_GENERIC;
mMetaData.worldGeometrySupported = false;
}
//////////////////////////////////////////////////////////////////////////
// PolyVoxSceneManager
//////////////////////////////////////////////////////////////////////////
PolyVoxSceneManager::PolyVoxSceneManager(const String& name)
: SceneManager(name)
,volumeData(0)
PolyVoxSceneManager::PolyVoxSceneManager()
:volumeData(0)
,useNormalSmoothing(false)
,normalSmoothingFilterSize(1)
,m_normalGenerationMethod(SOBEL)
,m_bHaveGeneratedMeshes(false)
,m_axisNode(0)
{
//sceneNodes.clear();
}
@ -77,11 +51,6 @@ namespace Ogre
{
}
const String& PolyVoxSceneManager::getTypeName(void) const
{
return PolyVoxSceneManagerFactory::FACTORY_TYPE_NAME;
}
bool PolyVoxSceneManager::loadScene(const String& filename)
{
volumeData = VolumeManager::getSingletonPtr()->load(filename + ".volume", "General");
@ -99,10 +68,9 @@ namespace Ogre
setAllUpToDateFlagsTo(false);
getRootSceneNode()->removeAndDestroyAllChildren();
createAxis(256);
setAxisVisible(false);
//createAxis(256);
//setAxisVisible(false);
@ -794,7 +762,7 @@ namespace Ogre
return volumeData->containsPoint(pos, boundary);
}
void PolyVoxSceneManager::createAxis(uint uSideLength)
/*void PolyVoxSceneManager::createAxis(uint uSideLength)
{
float fSideLength = static_cast<float>(uSideLength);
float fHalfSideLength = fSideLength/2.0;
@ -888,5 +856,5 @@ namespace Ogre
{
if(m_axisNode)
m_axisNode->setVisible(visible);
}
}*/
}