From 7b8e035bd193a3c476f1e02269787affd233c69c Mon Sep 17 00:00:00 2001 From: David Williams Date: Tue, 29 Jan 2008 20:47:04 +0000 Subject: [PATCH] Refactoring - PolyVoxSceneManager no longer derives from SceneManager. --- include/PolyVoxSceneManager.h | 27 ++++----------------- source/PolyVoxSceneManager.cpp | 44 +++++----------------------------- 2 files changed, 11 insertions(+), 60 deletions(-) diff --git a/include/PolyVoxSceneManager.h b/include/PolyVoxSceneManager.h index 99ee02d3..ebc57016 100644 --- a/include/PolyVoxSceneManager.h +++ b/include/PolyVoxSceneManager.h @@ -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 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; diff --git a/source/PolyVoxSceneManager.cpp b/source/PolyVoxSceneManager.cpp index 5259bf1f..4f5f644b 100644 --- a/source/PolyVoxSceneManager.cpp +++ b/source/PolyVoxSceneManager.cpp @@ -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(uSideLength); float fHalfSideLength = fSideLength/2.0; @@ -888,5 +856,5 @@ namespace Ogre { if(m_axisNode) m_axisNode->setVisible(visible); - } + }*/ }