Drastically reduced memory usage.
This commit is contained in:
		@@ -25,12 +25,14 @@ namespace PolyVox
 | 
				
			|||||||
		std::vector<boost::uint16_t> m_vecTriangleIndices;
 | 
							std::vector<boost::uint16_t> m_vecTriangleIndices;
 | 
				
			||||||
		std::vector<SurfaceVertex> m_vecVertices;
 | 
							std::vector<SurfaceVertex> m_vecVertices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		long int vertexIndices[POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1];
 | 
							static long int vertexIndices[POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		static long int noOfVerticesSubmitted;
 | 
							static long int noOfVerticesSubmitted;
 | 
				
			||||||
		static long int noOfVerticesAccepted;
 | 
							static long int noOfVerticesAccepted;
 | 
				
			||||||
		static long int noOfTrianglesSubmitted;
 | 
							static long int noOfTrianglesSubmitted;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							long int getSizeInBytes(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private:
 | 
						private:
 | 
				
			||||||
		bool m_AllowDuplicateVertices;
 | 
							bool m_AllowDuplicateVertices;
 | 
				
			||||||
	};	
 | 
						};	
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,20 @@ namespace PolyVox
 | 
				
			|||||||
		IndexedSurfacePatch* m_patchSingleMaterial;
 | 
							IndexedSurfacePatch* m_patchSingleMaterial;
 | 
				
			||||||
		IndexedSurfacePatch* m_patchMultiMaterial;
 | 
							IndexedSurfacePatch* m_patchMultiMaterial;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							long int getSizeInBytes(void)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								long int size = sizeof(RegionGeometry);
 | 
				
			||||||
 | 
								if(m_patchSingleMaterial)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									size += m_patchSingleMaterial->getSizeInBytes();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if(m_patchMultiMaterial)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									size += m_patchMultiMaterial->getSizeInBytes();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return size;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	};	
 | 
						};	
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ namespace PolyVox
 | 
				
			|||||||
	long int IndexedSurfacePatch::noOfVerticesSubmitted = 0;
 | 
						long int IndexedSurfacePatch::noOfVerticesSubmitted = 0;
 | 
				
			||||||
	long int IndexedSurfacePatch::noOfVerticesAccepted = 0;
 | 
						long int IndexedSurfacePatch::noOfVerticesAccepted = 0;
 | 
				
			||||||
	long int IndexedSurfacePatch::noOfTrianglesSubmitted = 0;
 | 
						long int IndexedSurfacePatch::noOfTrianglesSubmitted = 0;
 | 
				
			||||||
 | 
						long int IndexedSurfacePatch::vertexIndices[POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	IndexedSurfacePatch::IndexedSurfacePatch(bool allowDuplicateVertices)
 | 
						IndexedSurfacePatch::IndexedSurfacePatch(bool allowDuplicateVertices)
 | 
				
			||||||
		:m_AllowDuplicateVertices(allowDuplicateVertices)
 | 
							:m_AllowDuplicateVertices(allowDuplicateVertices)
 | 
				
			||||||
@@ -93,4 +94,12 @@ namespace PolyVox
 | 
				
			|||||||
			vecIndices.push_back(iterVertex - vecVertices.begin());
 | 
								vecIndices.push_back(iterVertex - vecVertices.begin());
 | 
				
			||||||
		}*/
 | 
							}*/
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						long int IndexedSurfacePatch::getSizeInBytes(void)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							long int size = sizeof(IndexedSurfacePatch);
 | 
				
			||||||
 | 
							size += m_vecVertices.capacity() * sizeof(m_vecVertices[0]);
 | 
				
			||||||
 | 
							size += m_vecTriangleIndices.capacity() * sizeof(m_vecTriangleIndices[0]);
 | 
				
			||||||
 | 
							return size;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -49,10 +49,13 @@ namespace PolyVox
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		//Regenerate meshes.
 | 
							//Regenerate meshes.
 | 
				
			||||||
		for(uint16_t regionZ = 0; regionZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
 | 
							for(uint16_t regionZ = 0; regionZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
 | 
				
			||||||
 | 
							//for(uint16_t regionZ = 6; regionZ < 7; ++regionZ)
 | 
				
			||||||
		{		
 | 
							{		
 | 
				
			||||||
			for(uint16_t regionY = 0; regionY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)
 | 
								for(uint16_t regionY = 0; regionY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)
 | 
				
			||||||
 | 
								//for(uint16_t regionY = POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS/2; regionY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS/2+1; ++regionY)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				for(uint16_t regionX = 0; regionX < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX)
 | 
									for(uint16_t regionX = 0; regionX < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX)
 | 
				
			||||||
 | 
									//for(uint16_t regionX = POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS/2; regionX < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS/2+1; ++regionX)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if(surfaceUpToDate[regionX][regionY][regionZ] == false)
 | 
										if(surfaceUpToDate[regionX][regionY][regionZ] == false)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user