Removing more old stuff from the Mesh class.
This commit is contained in:
		| @@ -190,8 +190,8 @@ namespace PolyVox | ||||
| 				for(typename std::list<Quad>::iterator quadIter = listQuads.begin(); quadIter != iterEnd; quadIter++) | ||||
| 				{ | ||||
| 					Quad& quad = *quadIter;				 | ||||
| 					m_meshCurrent->addTriangleCubic(quad.vertices[0], quad.vertices[1],quad.vertices[2]); | ||||
| 					m_meshCurrent->addTriangleCubic(quad.vertices[0], quad.vertices[2],quad.vertices[3]); | ||||
| 					m_meshCurrent->addTriangle(quad.vertices[0], quad.vertices[1],quad.vertices[2]); | ||||
| 					m_meshCurrent->addTriangle(quad.vertices[0], quad.vertices[2],quad.vertices[3]); | ||||
| 				}			 | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
| @@ -52,28 +52,21 @@ namespace PolyVox | ||||
|  | ||||
| 		typedef _VertexType VertexType; | ||||
|  | ||||
| 	   Mesh(); | ||||
| 	   ~Mesh();	    | ||||
| 		Mesh(); | ||||
| 		~Mesh();	    | ||||
|  | ||||
| 	   const std::vector<uint32_t>& getIndices(void) const; | ||||
| 	   uint32_t getNoOfIndices(void) const; | ||||
| 	   uint32_t getNoOfNonUniformTrianges(void) const; | ||||
| 	   uint32_t getNoOfUniformTrianges(void) const; | ||||
| 	   uint32_t getNoOfVertices(void) const;	    | ||||
| 	   std::vector<VertexType>& getRawVertexData(void); //FIXME - this should be removed | ||||
| 	   const std::vector<VertexType>& getVertices(void) const; | ||||
| 		const std::vector<uint32_t>& getIndices(void) const; | ||||
| 		uint32_t getNoOfIndices(void) const; | ||||
| 		uint32_t getNoOfVertices(void) const; | ||||
| 		const std::vector<VertexType>& getVertices(void) const; | ||||
|  | ||||
| 	   void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2); | ||||
| 	   void addTriangleCubic(uint32_t index0, uint32_t index1, uint32_t index2); | ||||
| 	   uint32_t addVertex(const VertexType& vertex); | ||||
| 	   void clear(void); | ||||
| 	   bool isEmpty(void) const; | ||||
| 		void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2); | ||||
| 		uint32_t addVertex(const VertexType& vertex); | ||||
| 		void clear(void); | ||||
| 		bool isEmpty(void) const; | ||||
| 		void removeUnusedVertices(void); | ||||
|  | ||||
| 	   int noOfDegenerateTris(void); | ||||
| 	   void removeDegenerateTris(void); | ||||
| 	   void removeUnusedVertices(void); | ||||
|  | ||||
| 	   Region m_Region; | ||||
| 		Region m_Region; | ||||
| 	 | ||||
| 	public:		 | ||||
| 		std::vector<uint32_t> m_vecTriangleIndices; | ||||
|   | ||||
| @@ -43,39 +43,6 @@ namespace PolyVox | ||||
| 	uint32_t Mesh<VertexType>::getNoOfIndices(void) const | ||||
| 	{ | ||||
| 		return m_vecTriangleIndices.size(); | ||||
| 	}	 | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	uint32_t Mesh<VertexType>::getNoOfNonUniformTrianges(void) const | ||||
| 	{ | ||||
| 		uint32_t result = 0; | ||||
| 		for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3) | ||||
| 		{ | ||||
| 			if((m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+1]].getMaterial()) | ||||
| 			&& (m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+2]].getMaterial())) | ||||
| 			{ | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				result++; | ||||
| 			} | ||||
| 		} | ||||
| 		return result; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	uint32_t Mesh<VertexType>::getNoOfUniformTrianges(void) const | ||||
| 	{ | ||||
| 		uint32_t result = 0; | ||||
| 		for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3) | ||||
| 		{ | ||||
| 			if((m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+1]].getMaterial()) | ||||
| 			&& (m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+2]].getMaterial())) | ||||
| 			{ | ||||
| 				result++; | ||||
| 			} | ||||
| 		} | ||||
| 		return result; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| @@ -84,12 +51,6 @@ namespace PolyVox | ||||
| 		return m_vecVertices.size(); | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	std::vector<VertexType>& Mesh<VertexType>::getRawVertexData(void) | ||||
| 	{ | ||||
| 		return m_vecVertices; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	const std::vector<VertexType>& Mesh<VertexType>::getVertices(void) const | ||||
| 	{ | ||||
| @@ -109,19 +70,6 @@ namespace PolyVox | ||||
| 		m_vecTriangleIndices.push_back(index2); | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	void Mesh<VertexType>::addTriangleCubic(uint32_t index0, uint32_t index1, uint32_t index2) | ||||
| 	{ | ||||
| 		//Make sure the specified indices correspond to valid vertices. | ||||
| 		POLYVOX_ASSERT(index0 < m_vecVertices.size(), "Index points at an invalid vertex."); | ||||
| 		POLYVOX_ASSERT(index1 < m_vecVertices.size(), "Index points at an invalid vertex."); | ||||
| 		POLYVOX_ASSERT(index2 < m_vecVertices.size(), "Index points at an invalid vertex."); | ||||
|  | ||||
| 		m_vecTriangleIndices.push_back(index0); | ||||
| 		m_vecTriangleIndices.push_back(index1); | ||||
| 		m_vecTriangleIndices.push_back(index2); | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	uint32_t Mesh<VertexType>::addVertex(const VertexType& vertex) | ||||
| 	{ | ||||
| @@ -134,7 +82,6 @@ namespace PolyVox | ||||
| 	{ | ||||
| 		m_vecVertices.clear(); | ||||
| 		m_vecTriangleIndices.clear(); | ||||
| 		m_vecLodRecords.clear(); | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| @@ -142,57 +89,6 @@ namespace PolyVox | ||||
| 	{ | ||||
| 		return (getNoOfVertices() == 0) || (getNoOfIndices() == 0); | ||||
| 	} | ||||
| 	 | ||||
| 	template <typename VertexType> | ||||
| 	int Mesh<VertexType>::noOfDegenerateTris(void) | ||||
| 	{ | ||||
| 		int count = 0; | ||||
| 		for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size();) | ||||
| 		{ | ||||
| 			int v0 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
| 			int v1 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
| 			int v2 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
|  | ||||
| 			if((v0 == v1) || (v1 == v2) || (v2 == v0)) | ||||
| 			{ | ||||
| 				count++; | ||||
| 			} | ||||
| 		} | ||||
| 		return count; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	void Mesh<VertexType>::removeDegenerateTris(void) | ||||
| 	{ | ||||
| 		int noOfNonDegenerate = 0; | ||||
| 		int targetCt = 0; | ||||
| 		for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size();) | ||||
| 		{ | ||||
| 			int v0 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
| 			int v1 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
| 			int v2 = m_vecTriangleIndices[triCt]; | ||||
| 			triCt++; | ||||
|  | ||||
| 			if((v0 != v1) && (v1 != v2) & (v2 != v0)) | ||||
| 			{ | ||||
| 				m_vecTriangleIndices[targetCt] = v0; | ||||
| 				targetCt++; | ||||
| 				m_vecTriangleIndices[targetCt] = v1; | ||||
| 				targetCt++; | ||||
| 				m_vecTriangleIndices[targetCt] = v2; | ||||
| 				targetCt++; | ||||
|  | ||||
| 				noOfNonDegenerate++; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		m_vecTriangleIndices.resize(noOfNonDegenerate * 3); | ||||
| 	} | ||||
|  | ||||
| 	template <typename VertexType> | ||||
| 	void Mesh<VertexType>::removeUnusedVertices(void) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user