Start of some refactoring work...
This commit is contained in:
		| @@ -8,7 +8,8 @@ SET(SRC_FILES | |||||||
| 	source/MaterialMapManager.cpp | 	source/MaterialMapManager.cpp | ||||||
| 	source/MaterialMapSerializer.cpp | 	source/MaterialMapSerializer.cpp | ||||||
| 	source/PolyVoxSceneManager.cpp | 	source/PolyVoxSceneManager.cpp | ||||||
|         source/Surface.cpp |         source/SurfacePatch.cpp | ||||||
|  |         source/SurfacePatchRenderable.cpp | ||||||
| 	source/Volume.cpp | 	source/Volume.cpp | ||||||
| 	source/VolumeIterator.cpp | 	source/VolumeIterator.cpp | ||||||
| 	source/VolumeManager.cpp | 	source/VolumeManager.cpp | ||||||
| @@ -25,10 +26,12 @@ SET(INC_FILES | |||||||
| 	include/MaterialMapManager.h | 	include/MaterialMapManager.h | ||||||
| 	include/MaterialMapSerializer.h | 	include/MaterialMapSerializer.h | ||||||
|         include/PolyVoxSceneManager.h |         include/PolyVoxSceneManager.h | ||||||
|         include/Surface.h |         include/SurfaceEdge.h | ||||||
|         include/Triangle.h |         include/SurfacePatch.h | ||||||
|  |         include/SurfacePatchRenderable.h | ||||||
|  |         include/SurfaceTriangle.h | ||||||
|  |         include/SurfaceVertex.h | ||||||
| 	include/TypeDef.h | 	include/TypeDef.h | ||||||
| 	include/Vertex.h |  | ||||||
| 	include/Volume.h | 	include/Volume.h | ||||||
| 	include/VolumeIterator.h | 	include/VolumeIterator.h | ||||||
| 	include/VolumeManager.h | 	include/VolumeManager.h | ||||||
|   | |||||||
| @@ -24,11 +24,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | |||||||
|  |  | ||||||
| #include "Constants.h" | #include "Constants.h" | ||||||
| #include "MaterialMap.h" | #include "MaterialMap.h" | ||||||
| #include "Surface.h" | #include "SurfacePatchRenderable.h" | ||||||
| #include "Triangle.h" | #include "SurfaceTriangle.h" | ||||||
| #include "TypeDef.h" | #include "TypeDef.h" | ||||||
| #include "Volume.h" | #include "Volume.h" | ||||||
| #include "Vertex.h" | #include "SurfaceVertex.h" | ||||||
|  |  | ||||||
| #include <set> | #include <set> | ||||||
|  |  | ||||||
| @@ -80,9 +80,9 @@ namespace Ogre | |||||||
| 		 | 		 | ||||||
| 		void generateLevelVolume(void); | 		void generateLevelVolume(void); | ||||||
|  |  | ||||||
| 		void generateMeshDataForRegion(uint regionX, uint regionY, uint regionZ, std::vector< std::vector<Vertex> >& vertexData, std::vector< std::vector<Triangle> >& indexData) const; | 		void generateMeshDataForRegion(uint regionX, uint regionY, uint regionZ, std::vector< std::vector<SurfaceVertex> >& vertexData, std::vector< std::vector<SurfaceTriangle> >& indexData) const; | ||||||
| 		void mergeVertices6(std::vector< std::vector<Vertex> >& vertexData, std::vector< std::vector<Triangle> >& indexData) const; | 		void mergeVertices6(std::vector< std::vector<SurfaceVertex> >& vertexData, std::vector< std::vector<SurfaceTriangle> >& indexData) const; | ||||||
| 		bool verticesArePlanar3(uint uCurrentVertex, std::set<uint> setConnectedVertices, std::vector<Vertex>& vertexData) const; | 		bool verticesArePlanar3(uint uCurrentVertex, std::set<uint> setConnectedVertices, std::vector<SurfaceVertex>& vertexData) const; | ||||||
|  |  | ||||||
| 		void doRegionGrowing(uint xStart, uint yStart, uint zStart, uchar value); | 		void doRegionGrowing(uint xStart, uint yStart, uint zStart, uchar value); | ||||||
|  |  | ||||||
| @@ -96,7 +96,7 @@ namespace Ogre | |||||||
| 		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]; | ||||||
|  |  | ||||||
| 		std::map<uchar,Surface*> m_mapSurfaces[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS]; | 		std::map<uchar,SurfacePatchRenderable*> m_mapSurfaces[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS]; | ||||||
|  |  | ||||||
| 		void igniteVoxel(UIntVector3 voxelToIgnite); | 		void igniteVoxel(UIntVector3 voxelToIgnite); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,29 +0,0 @@ | |||||||
| #ifndef __SURFACE_H__ |  | ||||||
| #define __SURFACE_H__ |  | ||||||
|  |  | ||||||
| #include "Ogre.h" |  | ||||||
| #include <vector> |  | ||||||
|  |  | ||||||
| #include "Triangle.h" |  | ||||||
| #include "Vertex.h" |  | ||||||
|  |  | ||||||
| namespace Ogre |  | ||||||
| { |  | ||||||
| 	class Surface : public SimpleRenderable |  | ||||||
| 	{ |  | ||||||
| 	public: |  | ||||||
| 	   Surface(const String& material = "BaseWhiteNoLighting"); |  | ||||||
| 	   ~Surface(void); |  | ||||||
|  |  | ||||||
| 	   void setGeometry(std::vector<Vertex> verticesToSet, std::vector<Triangle> indicesToSet); |  | ||||||
|  |  | ||||||
| 	   Real getSquaredViewDepth(const Camera *cam) const; |  | ||||||
| 	   Real getBoundingRadius(void) const; |  | ||||||
| 	protected: |  | ||||||
| 	   //void getWorldTransforms(Matrix4 *xform) const; |  | ||||||
| 	   const Quaternion &getWorldOrientation(void) const; |  | ||||||
| 	   const Vector3 &getWorldPosition(void) const; |  | ||||||
| 	};	 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #endif /* __SURFACE_H__ */ |  | ||||||
							
								
								
									
										0
									
								
								include/SurfaceEdge.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								include/SurfaceEdge.h
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								include/SurfacePatch.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								include/SurfacePatch.h
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										29
									
								
								include/SurfacePatchRenderable.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								include/SurfacePatchRenderable.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | #ifndef __SurfacePatchRenderable_H__ | ||||||
|  | #define __SurfacePatchRenderable_H__ | ||||||
|  |  | ||||||
|  | #include "Ogre.h" | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "SurfaceTriangle.h" | ||||||
|  | #include "SurfaceVertex.h" | ||||||
|  |  | ||||||
|  | namespace Ogre | ||||||
|  | { | ||||||
|  | 	class SurfacePatchRenderable : public SimpleRenderable | ||||||
|  | 	{ | ||||||
|  | 	public: | ||||||
|  | 	   SurfacePatchRenderable(const String& material = "BaseWhiteNoLighting"); | ||||||
|  | 	   ~SurfacePatchRenderable(void); | ||||||
|  |  | ||||||
|  | 	   void setGeometry(std::vector<SurfaceVertex> verticesToSet, std::vector<SurfaceTriangle> indicesToSet); | ||||||
|  |  | ||||||
|  | 	   Real getSquaredViewDepth(const Camera *cam) const; | ||||||
|  | 	   Real getBoundingRadius(void) const; | ||||||
|  | 	protected: | ||||||
|  | 	   //void getWorldTransforms(Matrix4 *xform) const; | ||||||
|  | 	   const Quaternion &getWorldOrientation(void) const; | ||||||
|  | 	   const Vector3 &getWorldPosition(void) const; | ||||||
|  | 	};	 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif /* __SurfacePatchRenderable_H__ */ | ||||||
| @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software | |||||||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
| ******************************************************************************/ | ******************************************************************************/ | ||||||
| 
 | 
 | ||||||
| #ifndef __Triangle_H__ | #ifndef __SurfaceTriangle_H__ | ||||||
| #define __Triangle_H__ | #define __SurfaceTriangle_H__ | ||||||
| 
 | 
 | ||||||
| #include "OgrePrerequisites.h" | #include "OgrePrerequisites.h" | ||||||
| 
 | 
 | ||||||
| @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | |||||||
| 
 | 
 | ||||||
| namespace Ogre | namespace Ogre | ||||||
| { | { | ||||||
| 	class Triangle | 	class SurfaceTriangle | ||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 
 | 
 | ||||||
| @@ -35,14 +35,14 @@ namespace Ogre | |||||||
| 		ulong v1; | 		ulong v1; | ||||||
| 		ulong v2; | 		ulong v2; | ||||||
| 
 | 
 | ||||||
| 		Triangle() | 		SurfaceTriangle() | ||||||
| 			:v0(0) | 			:v0(0) | ||||||
| 			,v1(0) | 			,v1(0) | ||||||
| 			,v2(0) | 			,v2(0) | ||||||
| 		{ | 		{ | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		Triangle(uint v0ToSet, uint v1ToSet, uint v2ToSet) | 		SurfaceTriangle(uint v0ToSet, uint v1ToSet, uint v2ToSet) | ||||||
| 			:v0(v0ToSet) | 			:v0(v0ToSet) | ||||||
| 			,v1(v1ToSet) | 			,v1(v1ToSet) | ||||||
| 			,v2(v2ToSet) | 			,v2(v2ToSet) | ||||||
| @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software | |||||||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
| ******************************************************************************/ | ******************************************************************************/ | ||||||
| 
 | 
 | ||||||
| #ifndef __Vertex_H__ | #ifndef __SurfaceVertex_H__ | ||||||
| #define __Vertex_H__ | #define __SurfaceVertex_H__ | ||||||
| 
 | 
 | ||||||
| #include "OgrePrerequisites.h" | #include "OgrePrerequisites.h" | ||||||
| 
 | 
 | ||||||
| @@ -26,19 +26,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | |||||||
| 
 | 
 | ||||||
| namespace Ogre | namespace Ogre | ||||||
| { | { | ||||||
| 	class Vertex | 	class SurfaceVertex | ||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 		Vector3 position; | 		Vector3 position; | ||||||
| 		Vector3 normal; | 		Vector3 normal; | ||||||
| 		float alpha; | 		float alpha; | ||||||
| 
 | 
 | ||||||
| 		Vertex(Vector3 positionToSet) | 		SurfaceVertex(Vector3 positionToSet) | ||||||
| 			:position(positionToSet) | 			:position(positionToSet) | ||||||
| 		{ | 		{ | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		Vertex(Vector3 positionToSet, Vector3 normalToSet) | 		SurfaceVertex(Vector3 positionToSet, Vector3 normalToSet) | ||||||
| 			:position(positionToSet) | 			:position(positionToSet) | ||||||
| 			,normal(normalToSet) | 			,normal(normalToSet) | ||||||
| 		{ | 		{ | ||||||
| @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | |||||||
|  |  | ||||||
| #include "MarchingCubesTables.h" | #include "MarchingCubesTables.h" | ||||||
| #include "MaterialMapManager.h" | #include "MaterialMapManager.h" | ||||||
| #include "Vertex.h" | #include "SurfaceVertex.h" | ||||||
| #include "PolyVoxSceneManager.h" | #include "PolyVoxSceneManager.h" | ||||||
| #include "VolumeIterator.h" | #include "VolumeIterator.h" | ||||||
| #include "VolumeManager.h" | #include "VolumeManager.h" | ||||||
| @@ -143,7 +143,7 @@ namespace Ogre | |||||||
| 				{					 | 				{					 | ||||||
| 					surfaceUpToDate[blockX][blockY][blockZ] = false; | 					surfaceUpToDate[blockX][blockY][blockZ] = false; | ||||||
|  |  | ||||||
| 					for(std::map<uchar,Surface*>::iterator iterSurfaces = m_mapSurfaces[blockX][blockY][blockZ].begin(); iterSurfaces != m_mapSurfaces[blockX][blockY][blockZ].end(); ++iterSurfaces) | 					for(std::map<uchar,SurfacePatchRenderable*>::iterator iterSurfaces = m_mapSurfaces[blockX][blockY][blockZ].begin(); iterSurfaces != m_mapSurfaces[blockX][blockY][blockZ].end(); ++iterSurfaces) | ||||||
| 					{ | 					{ | ||||||
| 						delete iterSurfaces->second; | 						delete iterSurfaces->second; | ||||||
| 					} | 					} | ||||||
| @@ -332,8 +332,8 @@ namespace Ogre | |||||||
| 						if(surfaceUpToDate[regionX][regionY][regionZ] == false) | 						if(surfaceUpToDate[regionX][regionY][regionZ] == false) | ||||||
| 						{ | 						{ | ||||||
| 							//Generate the surface | 							//Generate the surface | ||||||
| 							std::vector< std::vector<Vertex> > vertexData; | 							std::vector< std::vector<SurfaceVertex> > vertexData; | ||||||
| 							std::vector< std::vector< Triangle> > indexData; | 							std::vector< std::vector<SurfaceTriangle> > indexData; | ||||||
| 							generateMeshDataForRegion(regionX,regionY,regionZ,vertexData,indexData); | 							generateMeshDataForRegion(regionX,regionY,regionZ,vertexData,indexData); | ||||||
|  |  | ||||||
| 							//If a SceneNode doesn't exist in this position then create one. | 							//If a SceneNode doesn't exist in this position then create one. | ||||||
| @@ -357,11 +357,11 @@ namespace Ogre | |||||||
| 								{ | 								{ | ||||||
| 									continue; | 									continue; | ||||||
| 								} | 								} | ||||||
| 								std::map<uchar,Surface*>::iterator iterSurface = m_mapSurfaces[regionX][regionY][regionZ].find(meshCt); | 								std::map<uchar,SurfacePatchRenderable*>::iterator iterSurface = m_mapSurfaces[regionX][regionY][regionZ].find(meshCt); | ||||||
| 								if(iterSurface == m_mapSurfaces[regionX][regionY][regionZ].end()) | 								if(iterSurface == m_mapSurfaces[regionX][regionY][regionZ].end()) | ||||||
| 								{ | 								{ | ||||||
| 									//We have to create the surface | 									//We have to create the surface | ||||||
| 									Surface* surface = new Surface(materialMap->getMaterialAtIndex(meshCt)); | 									SurfacePatchRenderable* surface = new SurfacePatchRenderable(materialMap->getMaterialAtIndex(meshCt)); | ||||||
| 									surface->setGeometry(vertexData[meshCt],indexData[meshCt]); | 									surface->setGeometry(vertexData[meshCt],indexData[meshCt]); | ||||||
|  |  | ||||||
| 									m_mapSurfaces[regionX][regionY][regionZ].insert(std::make_pair(meshCt,surface)); | 									m_mapSurfaces[regionX][regionY][regionZ].insert(std::make_pair(meshCt,surface)); | ||||||
| @@ -532,7 +532,7 @@ namespace Ogre | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void PolyVoxSceneManager::generateMeshDataForRegion(const uint regionX, const uint regionY, const uint regionZ, std::vector< std::vector<Vertex> >& vertexData, std::vector< std::vector<Triangle> >& indexData) const | 	void PolyVoxSceneManager::generateMeshDataForRegion(const uint regionX, const uint regionY, const uint regionZ, std::vector< std::vector<SurfaceVertex> >& vertexData, std::vector< std::vector<SurfaceTriangle> >& indexData) const | ||||||
| 	{	 | 	{	 | ||||||
| 		//LogManager::getSingleton().logMessage("Generating Mesh Data"); | 		//LogManager::getSingleton().logMessage("Generating Mesh Data"); | ||||||
| 		/*LogManager::getSingleton().logMessage("HERE"); | 		/*LogManager::getSingleton().logMessage("HERE"); | ||||||
| @@ -753,7 +753,7 @@ namespace Ogre | |||||||
| 				unsigned int vertexScaledY; | 				unsigned int vertexScaledY; | ||||||
| 				unsigned int vertexScaledZ; | 				unsigned int vertexScaledZ; | ||||||
|  |  | ||||||
| 				Triangle triangle; //Triangle to be created... | 				SurfaceTriangle triangle; //Triangle to be created... | ||||||
|  |  | ||||||
| 				for(std::set<uchar>::iterator materialsIter = materials.begin(); materialsIter != materials.end(); ++materialsIter) | 				for(std::set<uchar>::iterator materialsIter = materials.begin(); materialsIter != materials.end(); ++materialsIter) | ||||||
| 				{ | 				{ | ||||||
| @@ -771,12 +771,12 @@ namespace Ogre | |||||||
| 					if((index == -1)) | 					if((index == -1)) | ||||||
| 					{ | 					{ | ||||||
| 						//Add the vertex | 						//Add the vertex | ||||||
| 						Vertex vertex(vertex0); | 						SurfaceVertex vertex(vertex0); | ||||||
| 						if(material0 == material) | 						if(material0 == material) | ||||||
| 							vertex.alpha = 1.0; | 							vertex.alpha = 1.0; | ||||||
| 						else | 						else | ||||||
| 							vertex.alpha = 0.0; | 							vertex.alpha = 0.0; | ||||||
| 						vertexData[material].push_back(Vertex(vertex)); | 						vertexData[material].push_back(vertex); | ||||||
| 						triangle.v0 = vertexData[material].size()-1; | 						triangle.v0 = vertexData[material].size()-1; | ||||||
| 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | ||||||
| 					} | 					} | ||||||
| @@ -798,12 +798,12 @@ namespace Ogre | |||||||
| 					if((index == -1)) | 					if((index == -1)) | ||||||
| 					{ | 					{ | ||||||
| 						//Add the vertex | 						//Add the vertex | ||||||
| 						Vertex vertex(vertex1); | 						SurfaceVertex vertex(vertex1); | ||||||
| 						if(material1 == material) | 						if(material1 == material) | ||||||
| 							vertex.alpha = 1.0; | 							vertex.alpha = 1.0; | ||||||
| 						else | 						else | ||||||
| 							vertex.alpha = 0.0; | 							vertex.alpha = 0.0; | ||||||
| 						vertexData[material].push_back(Vertex(vertex)); | 						vertexData[material].push_back(vertex); | ||||||
| 						triangle.v1 = vertexData[material].size()-1; | 						triangle.v1 = vertexData[material].size()-1; | ||||||
| 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | ||||||
| 					} | 					} | ||||||
| @@ -825,12 +825,12 @@ namespace Ogre | |||||||
| 					if((index == -1)) | 					if((index == -1)) | ||||||
| 					{ | 					{ | ||||||
| 						//Add the vertex | 						//Add the vertex | ||||||
| 						Vertex vertex(vertex2); | 						SurfaceVertex vertex(vertex2); | ||||||
| 						if(material2 == material) | 						if(material2 == material) | ||||||
| 							vertex.alpha = 1.0; | 							vertex.alpha = 1.0; | ||||||
| 						else | 						else | ||||||
| 							vertex.alpha = 0.0; | 							vertex.alpha = 0.0; | ||||||
| 						vertexData[material].push_back(Vertex(vertex)); | 						vertexData[material].push_back(vertex); | ||||||
| 						triangle.v2 = vertexData[material].size()-1; | 						triangle.v2 = vertexData[material].size()-1; | ||||||
| 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | 						vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1; | ||||||
| 					} | 					} | ||||||
| @@ -948,7 +948,7 @@ namespace Ogre | |||||||
| 		//Ogre::LogManager::getSingleton().logMessage("After merge:  vertices = " + Ogre::StringConverter::toString(vertexData[4].size()) + ", triangles = " + Ogre::StringConverter::toString(indexData[4].size()/3)); | 		//Ogre::LogManager::getSingleton().logMessage("After merge:  vertices = " + Ogre::StringConverter::toString(vertexData[4].size()) + ", triangles = " + Ogre::StringConverter::toString(indexData[4].size()/3)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void PolyVoxSceneManager::mergeVertices6(std::vector< std::vector<Vertex> >& vertexData, std::vector< std::vector<Triangle> >& indexData) const | 	void PolyVoxSceneManager::mergeVertices6(std::vector< std::vector<SurfaceVertex> >& vertexData, std::vector< std::vector<SurfaceTriangle> >& indexData) const | ||||||
| 	{ | 	{ | ||||||
| 		for(uint material = 1; material < 256; ++material) | 		for(uint material = 1; material < 256; ++material) | ||||||
| 		{ | 		{ | ||||||
| @@ -1041,8 +1041,8 @@ namespace Ogre | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			//Delete degenerate triangles | 			//Delete degenerate triangles | ||||||
| 			std::vector<Vertex> resultingVertexData; | 			std::vector<SurfaceVertex> resultingVertexData; | ||||||
| 			std::vector<Triangle> resultingIndexData; | 			std::vector<SurfaceTriangle> resultingIndexData; | ||||||
| 			for(uint triCt = 0; triCt < indexData[material].size(); triCt++) | 			for(uint triCt = 0; triCt < indexData[material].size(); triCt++) | ||||||
| 			{ | 			{ | ||||||
| 				if((indexData[material][triCt].v0 != indexData[material][triCt].v1) || (indexData[material][triCt].v1 != indexData[material][triCt].v2)) | 				if((indexData[material][triCt].v0 != indexData[material][triCt].v1) || (indexData[material][triCt].v1 != indexData[material][triCt].v2)) | ||||||
| @@ -1053,7 +1053,7 @@ namespace Ogre | |||||||
| 					resultingVertexData.push_back(vertexData[material][indexData[material][triCt].v1]); | 					resultingVertexData.push_back(vertexData[material][indexData[material][triCt].v1]); | ||||||
| 					resultingVertexData.push_back(vertexData[material][indexData[material][triCt].v2]); | 					resultingVertexData.push_back(vertexData[material][indexData[material][triCt].v2]); | ||||||
|  |  | ||||||
| 					Triangle triangle(pos, pos+1, pos+2); | 					SurfaceTriangle triangle(pos, pos+1, pos+2); | ||||||
| 					resultingIndexData.push_back(triangle); | 					resultingIndexData.push_back(triangle); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| @@ -1062,7 +1062,7 @@ namespace Ogre | |||||||
| 		}			 | 		}			 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	bool PolyVoxSceneManager::verticesArePlanar3(uint uCurrentVertex, std::set<uint> setConnectedVertices, std::vector<Vertex>& vertexData) const | 	bool PolyVoxSceneManager::verticesArePlanar3(uint uCurrentVertex, std::set<uint> setConnectedVertices, std::vector<SurfaceVertex>& vertexData) const | ||||||
| 	{ | 	{ | ||||||
| 		//FIXME - specially handle the case where they are all the same. | 		//FIXME - specially handle the case where they are all the same. | ||||||
| 		//This is happening a lot after many vertices have been moved round? | 		//This is happening a lot after many vertices have been moved round? | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								source/SurfacePatch.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								source/SurfacePatch.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -1,10 +1,10 @@ | |||||||
| #include "Surface.h" | #include "SurfacePatchRenderable.h" | ||||||
| 
 | 
 | ||||||
| #include "OgreVertexIndexData.h" | #include "OgreVertexIndexData.h" | ||||||
| 
 | 
 | ||||||
| namespace Ogre | namespace Ogre | ||||||
| { | { | ||||||
| 	Surface::Surface(const String& material) | 	SurfacePatchRenderable::SurfacePatchRenderable(const String& material) | ||||||
| 	{ | 	{ | ||||||
| 	   mRenderOp.vertexData = new VertexData(); | 	   mRenderOp.vertexData = new VertexData(); | ||||||
| 	   mRenderOp.indexData = new IndexData(); | 	   mRenderOp.indexData = new IndexData(); | ||||||
| @@ -12,13 +12,13 @@ namespace Ogre | |||||||
| 	   this->setMaterial(material); | 	   this->setMaterial(material); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	Surface::~Surface(void) | 	SurfacePatchRenderable::~SurfacePatchRenderable(void) | ||||||
| 	{ | 	{ | ||||||
| 	   delete mRenderOp.vertexData; | 	   delete mRenderOp.vertexData; | ||||||
| 	   delete mRenderOp.indexData; | 	   delete mRenderOp.indexData; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void Surface::setGeometry(std::vector<Vertex> verticesToSet, std::vector<Triangle> indicesToSet) | 	void SurfacePatchRenderable::setGeometry(std::vector<SurfaceVertex> verticesToSet, std::vector<SurfaceTriangle> indicesToSet) | ||||||
| 	{ | 	{ | ||||||
| 				 | 				 | ||||||
| 		//LogManager::getSingleton().logMessage("In setGeometry()");
 | 		//LogManager::getSingleton().logMessage("In setGeometry()");
 | ||||||
| @@ -115,7 +115,7 @@ namespace Ogre | |||||||
| 	   ibuf->unlock(); | 	   ibuf->unlock(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	Real Surface::getSquaredViewDepth(const Camera *cam) const | 	Real SurfacePatchRenderable::getSquaredViewDepth(const Camera *cam) const | ||||||
| 	{ | 	{ | ||||||
| 	   Vector3 vMin, vMax, vMid, vDist; | 	   Vector3 vMin, vMax, vMid, vDist; | ||||||
| 	   vMin = mBox.getMinimum(); | 	   vMin = mBox.getMinimum(); | ||||||
| @@ -126,7 +126,7 @@ namespace Ogre | |||||||
| 	   return vDist.squaredLength(); | 	   return vDist.squaredLength(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	Real Surface::getBoundingRadius(void) const | 	Real SurfacePatchRenderable::getBoundingRadius(void) const | ||||||
| 	{ | 	{ | ||||||
| 		return Math::Sqrt((std::max)(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength())); | 		return Math::Sqrt((std::max)(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength())); | ||||||
| 	   //return mRadius;
 | 	   //return mRadius;
 | ||||||
| @@ -138,12 +138,12 @@ namespace Ogre | |||||||
| 	   *xform = Matrix4::IDENTITY; | 	   *xform = Matrix4::IDENTITY; | ||||||
| 	} | 	} | ||||||
| 	*/ | 	*/ | ||||||
| 	const Quaternion &Surface::getWorldOrientation(void) const | 	const Quaternion &SurfacePatchRenderable::getWorldOrientation(void) const | ||||||
| 	{ | 	{ | ||||||
| 	   return Quaternion::IDENTITY; | 	   return Quaternion::IDENTITY; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	const Vector3 &Surface::getWorldPosition(void) const | 	const Vector3 &SurfacePatchRenderable::getWorldPosition(void) const | ||||||
| 	{ | 	{ | ||||||
| 	   return Vector3::ZERO; | 	   return Vector3::ZERO; | ||||||
| 	} | 	} | ||||||
		Reference in New Issue
	
	Block a user