Refactoring - PolyVoxSceneManager no longer derives from SceneManager.
This commit is contained in:
		| @@ -44,24 +44,12 @@ namespace Ogre | |||||||
| 		SOBEL | 		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 | 	/// Voxel scene manager | ||||||
| 	class VOXEL_SCENE_MANAGER_API PolyVoxSceneManager : public SceneManager | 	class VOXEL_SCENE_MANAGER_API PolyVoxSceneManager | ||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 		//Constructors, etc | 		//Constructors, etc | ||||||
| 		PolyVoxSceneManager(const String& name); | 		PolyVoxSceneManager(); | ||||||
| 		~PolyVoxSceneManager(); | 		~PolyVoxSceneManager(); | ||||||
|  |  | ||||||
| 		//Getters | 		//Getters | ||||||
| @@ -91,13 +79,8 @@ namespace Ogre | |||||||
| 		bool containsPoint(Vector3 pos, float boundary); | 		bool containsPoint(Vector3 pos, float boundary); | ||||||
| 		bool containsPoint(IntVector3 pos, uint 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 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]; | ||||||
|  |  | ||||||
| @@ -110,8 +93,8 @@ namespace Ogre | |||||||
| 		void markVoxelChanged(uint x, uint y, uint z); | 		void markVoxelChanged(uint x, uint y, uint z); | ||||||
| 		void markRegionChanged(uint firstX, uint firstY, uint firstZ, uint lastX, uint lastY, uint lastZ); | 		void markRegionChanged(uint firstX, uint firstY, uint firstZ, uint lastX, uint lastY, uint lastZ); | ||||||
|  |  | ||||||
| 		void createAxis(uint uSideLength);		 | 		/*void createAxis(uint uSideLength);		 | ||||||
| 		SceneNode* m_axisNode; | 		SceneNode* m_axisNode;*/ | ||||||
|  |  | ||||||
|  |  | ||||||
| 		static uint fileNo; | 		static uint fileNo; | ||||||
|   | |||||||
| @@ -34,41 +34,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | |||||||
| namespace Ogre | 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::PolyVoxSceneManager(const String& name) | 	PolyVoxSceneManager::PolyVoxSceneManager() | ||||||
| 		: SceneManager(name) | 		:volumeData(0) | ||||||
| 		,volumeData(0) |  | ||||||
| 		,useNormalSmoothing(false) | 		,useNormalSmoothing(false) | ||||||
| 		,normalSmoothingFilterSize(1) | 		,normalSmoothingFilterSize(1) | ||||||
| 		,m_normalGenerationMethod(SOBEL) | 		,m_normalGenerationMethod(SOBEL) | ||||||
| 		,m_bHaveGeneratedMeshes(false) | 		,m_bHaveGeneratedMeshes(false) | ||||||
| 		,m_axisNode(0) |  | ||||||
| 	{	 | 	{	 | ||||||
| 		//sceneNodes.clear(); | 		//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) | 	bool PolyVoxSceneManager::loadScene(const String& filename) | ||||||
| 	{ | 	{ | ||||||
| 		volumeData = VolumeManager::getSingletonPtr()->load(filename + ".volume", "General"); | 		volumeData = VolumeManager::getSingletonPtr()->load(filename + ".volume", "General"); | ||||||
| @@ -99,10 +68,9 @@ namespace Ogre | |||||||
|  |  | ||||||
| 		setAllUpToDateFlagsTo(false); | 		setAllUpToDateFlagsTo(false); | ||||||
|  |  | ||||||
| 		getRootSceneNode()->removeAndDestroyAllChildren(); |  | ||||||
|  |  | ||||||
| 		createAxis(256); | 		//createAxis(256); | ||||||
| 		setAxisVisible(false); | 		//setAxisVisible(false); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -794,7 +762,7 @@ namespace Ogre | |||||||
| 		return volumeData->containsPoint(pos, boundary); | 		return volumeData->containsPoint(pos, boundary); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void PolyVoxSceneManager::createAxis(uint uSideLength) | 	/*void PolyVoxSceneManager::createAxis(uint uSideLength) | ||||||
| 	{ | 	{ | ||||||
| 		float fSideLength = static_cast<float>(uSideLength); | 		float fSideLength = static_cast<float>(uSideLength); | ||||||
| 		float fHalfSideLength = fSideLength/2.0; | 		float fHalfSideLength = fSideLength/2.0; | ||||||
| @@ -888,5 +856,5 @@ namespace Ogre | |||||||
| 	{ | 	{ | ||||||
| 		if(m_axisNode) | 		if(m_axisNode) | ||||||
| 			m_axisNode->setVisible(visible); | 			m_axisNode->setVisible(visible); | ||||||
| 	} | 	}*/ | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user