Renamed IndexedSurfacePatch to SurfaceMesh.

This commit is contained in:
David Williams 2010-02-20 00:20:43 +00:00
parent 3ed74a982c
commit 2d78808000
20 changed files with 143 additions and 143 deletions

View File

@ -24,18 +24,18 @@ freely, subject to the following restrictions:
#include "OpenGLImmediateModeSupport.h" #include "OpenGLImmediateModeSupport.h"
#include "OpenGLSupport.h" #include "OpenGLSupport.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
using namespace PolyVox; using namespace PolyVox;
using namespace std; using namespace std;
void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp, unsigned int uLodLevel) void renderRegionImmediateMode(PolyVox::SurfaceMesh& mesh, unsigned int uLodLevel)
{ {
const vector<SurfaceVertex>& vecVertices = isp.getVertices(); const vector<SurfaceVertex>& vecVertices = mesh.getVertices();
const vector<PolyVox::uint32_t>& vecIndices = isp.getIndices(); const vector<PolyVox::uint32_t>& vecIndices = mesh.getIndices();
int beginIndex = isp.m_vecLodRecords[uLodLevel].beginIndex; int beginIndex = mesh.m_vecLodRecords[uLodLevel].beginIndex;
int endIndex = isp.m_vecLodRecords[uLodLevel].endIndex; int endIndex = mesh.m_vecLodRecords[uLodLevel].endIndex;
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
//for(vector<PolyVox::uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex) //for(vector<PolyVox::uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex)
@ -44,7 +44,7 @@ void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp, unsigned int u
const SurfaceVertex& vertex = vecVertices[vecIndices[index]]; const SurfaceVertex& vertex = vecVertices[vecIndices[index]];
const Vector3DFloat& v3dVertexPos = vertex.getPosition(); const Vector3DFloat& v3dVertexPos = vertex.getPosition();
//const Vector3DFloat v3dRegionOffset(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength); //const Vector3DFloat v3dRegionOffset(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength);
const Vector3DFloat v3dFinalVertexPos = v3dVertexPos + static_cast<Vector3DFloat>(isp.m_Region.getLowerCorner()); const Vector3DFloat v3dFinalVertexPos = v3dVertexPos + static_cast<Vector3DFloat>(mesh.m_Region.getLowerCorner());

View File

@ -28,6 +28,6 @@ freely, subject to the following restrictions:
#include "glew/glew.h" #include "glew/glew.h"
void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp, unsigned int uLodLevel); void renderRegionImmediateMode(PolyVox::SurfaceMesh& mesh, unsigned int uLodLevel);
#endif //__OpenGLExample_OpenGLImmediateModeSupport_H__ #endif //__OpenGLExample_OpenGLImmediateModeSupport_H__

View File

@ -24,22 +24,22 @@ freely, subject to the following restrictions:
#include "OpenGLSupport.h" #include "OpenGLSupport.h"
#include "OpenGLVertexBufferObjectSupport.h" #include "OpenGLVertexBufferObjectSupport.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
using namespace PolyVox; using namespace PolyVox;
using namespace std; using namespace std;
OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp) OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh& mesh)
{ {
//Represents our filled in OpenGL vertex and index buffer objects. //Represents our filled in OpenGL vertex and index buffer objects.
OpenGLSurfacePatch result; OpenGLSurfaceMesh result;
//The source //The source
result.sourceISP = &isp; result.sourceMesh = &mesh;
//Convienient access to the vertices and indices //Convienient access to the vertices and indices
const vector<SurfaceVertex>& vecVertices = isp.getVertices(); const vector<SurfaceVertex>& vecVertices = mesh.getVertices();
const vector<PolyVox::uint32_t>& vecIndices = isp.getIndices(); const vector<PolyVox::uint32_t>& vecIndices = mesh.getIndices();
//If we have any indices... //If we have any indices...
if(!vecIndices.empty()) if(!vecIndices.empty())
@ -67,7 +67,7 @@ OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp)
const SurfaceVertex& vertex = *iterVertex; const SurfaceVertex& vertex = *iterVertex;
const Vector3DFloat& v3dVertexPos = vertex.getPosition(); const Vector3DFloat& v3dVertexPos = vertex.getPosition();
//const Vector3DFloat v3dRegionOffset(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength); //const Vector3DFloat v3dRegionOffset(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength);
const Vector3DFloat v3dFinalVertexPos = v3dVertexPos + static_cast<Vector3DFloat>(isp.m_Region.getLowerCorner()); const Vector3DFloat v3dFinalVertexPos = v3dVertexPos + static_cast<Vector3DFloat>(mesh.m_Region.getLowerCorner());
*ptr = v3dFinalVertexPos.getX(); *ptr = v3dFinalVertexPos.getX();
ptr++; ptr++;
@ -100,23 +100,23 @@ OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp)
return result; return result;
} }
void renderRegionVertexBufferObject(const OpenGLSurfacePatch& openGLSurfacePatch, unsigned int uLodLevel) void renderRegionVertexBufferObject(const OpenGLSurfaceMesh& openGLSurfaceMesh, unsigned int uLodLevel)
{ {
int beginIndex = openGLSurfacePatch.sourceISP->m_vecLodRecords[uLodLevel].beginIndex; int beginIndex = openGLSurfaceMesh.sourceMesh->m_vecLodRecords[uLodLevel].beginIndex;
int endIndex = openGLSurfacePatch.sourceISP->m_vecLodRecords[uLodLevel].endIndex; int endIndex = openGLSurfaceMesh.sourceMesh->m_vecLodRecords[uLodLevel].endIndex;
glBindBuffer(GL_ARRAY_BUFFER, openGLSurfacePatch.vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, openGLSurfaceMesh.vertexBuffer);
glVertexPointer(3, GL_FLOAT, 36, 0); glVertexPointer(3, GL_FLOAT, 36, 0);
glNormalPointer(GL_FLOAT, 36, (GLvoid*)12); glNormalPointer(GL_FLOAT, 36, (GLvoid*)12);
glColorPointer(3, GL_FLOAT, 36, (GLvoid*)24); glColorPointer(3, GL_FLOAT, 36, (GLvoid*)24);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, openGLSurfacePatch.indexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, openGLSurfaceMesh.indexBuffer);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
//glDrawElements(GL_TRIANGLES, openGLSurfacePatch.noOfIndices, GL_UNSIGNED_INT, 0); //glDrawElements(GL_TRIANGLES, openGLSurfaceMesh.noOfIndices, GL_UNSIGNED_INT, 0);
glDrawRangeElements(GL_TRIANGLES, beginIndex, endIndex-1, endIndex - beginIndex,/* openGLSurfacePatch.noOfIndices,*/ GL_UNSIGNED_INT, 0); glDrawRangeElements(GL_TRIANGLES, beginIndex, endIndex-1, endIndex - beginIndex,/* openGLSurfaceMesh.noOfIndices,*/ GL_UNSIGNED_INT, 0);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);

View File

@ -28,15 +28,15 @@ freely, subject to the following restrictions:
#include "glew/glew.h" #include "glew/glew.h"
struct OpenGLSurfacePatch struct OpenGLSurfaceMesh
{ {
GLulong noOfIndices; GLulong noOfIndices;
GLuint indexBuffer; GLuint indexBuffer;
GLuint vertexBuffer; GLuint vertexBuffer;
const PolyVox::IndexedSurfacePatch* sourceISP; const PolyVox::SurfaceMesh* sourceMesh;
}; };
OpenGLSurfacePatch BuildOpenGLSurfacePatch(const PolyVox::IndexedSurfacePatch& isp); OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const PolyVox::SurfaceMesh& mesh);
void renderRegionVertexBufferObject(const OpenGLSurfacePatch& openGLSurfacePatch, unsigned int uLodLevel); void renderRegionVertexBufferObject(const OpenGLSurfaceMesh& openGLSurfaceMesh, unsigned int uLodLevel);
#endif //__OpenGLExample_OpenGLVertexBufferObjectSupport_H__ #endif //__OpenGLExample_OpenGLVertexBufferObjectSupport_H__

View File

@ -51,8 +51,8 @@ OpenGLWidget::OpenGLWidget(QWidget *parent)
void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData) void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
{ {
//First we free anything from the previous volume (if there was one). //First we free anything from the previous volume (if there was one).
m_mapOpenGLSurfacePatches.clear(); m_mapOpenGLSurfaceMeshes.clear();
m_mapIndexedSurfacePatches.clear(); m_mapSurfaceMeshes.clear();
m_volData = volData; m_volData = volData;
//If we have any volume data then generate the new surface patches. //If we have any volume data then generate the new surface patches.
@ -89,63 +89,63 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
Vector3DInt16 regUpperCorner(regionEndX, regionEndY, regionEndZ); Vector3DInt16 regUpperCorner(regionEndX, regionEndY, regionEndZ);
//Extract the surface for this region //Extract the surface for this region
//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent); //extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), meshCurrent);
POLYVOX_SHARED_PTR<IndexedSurfacePatch> isp = surfaceExtractor.extractSurfaceForRegion(PolyVox::Region(regLowerCorner, regUpperCorner)); POLYVOX_SHARED_PTR<SurfaceMesh> mesh = surfaceExtractor.extractSurfaceForRegion(PolyVox::Region(regLowerCorner, regUpperCorner));
//computeNormalsForVertices(m_volData, *(isp.get()), SOBEL_SMOOTHED); //computeNormalsForVertices(m_volData, *(mesh.get()), SOBEL_SMOOTHED);
//*ispCurrent = getSmoothedSurface(*ispCurrent); //*meshCurrent = getSmoothedSurface(*meshCurrent);
//isp->smooth(0.3f); //mesh->smooth(0.3f);
//ispCurrent->generateAveragedFaceNormals(true); //meshCurrent->generateAveragedFaceNormals(true);
if(isp->m_vecTriangleIndices.size() > 0) if(mesh->m_vecTriangleIndices.size() > 0)
{ {
//isp->makeProgressiveMesh(); //mesh->makeProgressiveMesh();
/*RenderDynamicMesh rdm; /*RenderDynamicMesh rdm;
rdm.buildFromIndexedSurfacePatch(*isp);*/ rdm.buildFromSurfaceMesh(*mesh);*/
//computeNormalsForVertices(m_volData, *(isp.get()), SOBEL_SMOOTHED); //computeNormalsForVertices(m_volData, *(mesh.get()), SOBEL_SMOOTHED);
//isp->smoothPositions(0.3f); //mesh->smoothPositions(0.3f);
//isp->generateAveragedFaceNormals(true); //mesh->generateAveragedFaceNormals(true);
/*for(int ct = 0; ct < 20; ct ++) /*for(int ct = 0; ct < 20; ct ++)
{ {
//cout << "Before: " << isp->noOfDegenerateTris() << endl; //cout << "Before: " << mesh->noOfDegenerateTris() << endl;
isp->decimate(); mesh->decimate();
//cout << "After: " << isp->noOfDegenerateTris() << endl; //cout << "After: " << mesh->noOfDegenerateTris() << endl;
isp->removeDegenerateTris(); mesh->removeDegenerateTris();
//cout << "After Remove: " << isp->noOfDegenerateTris() << endl << endl; //cout << "After Remove: " << mesh->noOfDegenerateTris() << endl << endl;
}*/ }*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
//For decimation built into ISP //For decimation built into Mesh
//isp->generateAveragedFaceNormals(true); //mesh->generateAveragedFaceNormals(true);
isp->decimate(0.999f); mesh->decimate(0.999f);
//isp->generateAveragedFaceNormals(true); //mesh->generateAveragedFaceNormals(true);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*isp->generateAveragedFaceNormals(true); /*mesh->generateAveragedFaceNormals(true);
Mesh mesh; Mesh mesh;
mesh.buildFromISP(isp.get()); mesh.buildFromMesh(mesh.get());
//mesh.removeEdge(*(mesh.m_edges.begin())); //mesh.removeEdge(*(mesh.m_edges.begin()));
mesh.decimateAll(); mesh.decimateAll();
mesh.fillISP(isp.get());*/ mesh.fillMesh(mesh.get());*/
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ); Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
if(m_bUseOpenGLVertexBufferObjects) if(m_bUseOpenGLVertexBufferObjects)
{ {
OpenGLSurfacePatch openGLSurfacePatch = BuildOpenGLSurfacePatch(*(isp.get())); OpenGLSurfaceMesh openGLSurfaceMesh = BuildOpenGLSurfaceMesh(*(mesh.get()));
m_mapOpenGLSurfacePatches.insert(make_pair(v3dRegPos, openGLSurfacePatch)); m_mapOpenGLSurfaceMeshes.insert(make_pair(v3dRegPos, openGLSurfaceMesh));
} }
//else //else
//{ //{
m_mapIndexedSurfacePatches.insert(make_pair(v3dRegPos, isp)); m_mapSurfaceMeshes.insert(make_pair(v3dRegPos, mesh));
//} //}
//delete ispCurrent; //delete meshCurrent;
} }
} }
} }
@ -226,17 +226,17 @@ void OpenGLWidget::paintGL()
for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX) for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
{ {
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ); Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
if(m_mapIndexedSurfacePatches.find(v3dRegPos) != m_mapIndexedSurfacePatches.end()) if(m_mapSurfaceMeshes.find(v3dRegPos) != m_mapSurfaceMeshes.end())
{ {
POLYVOX_SHARED_PTR<IndexedSurfacePatch> ispCurrent = m_mapIndexedSurfacePatches[v3dRegPos]; POLYVOX_SHARED_PTR<SurfaceMesh> meshCurrent = m_mapSurfaceMeshes[v3dRegPos];
unsigned int uLodLevel = 0; //ispCurrent->m_vecLodRecords.size() - 1; unsigned int uLodLevel = 0; //meshCurrent->m_vecLodRecords.size() - 1;
if(m_bUseOpenGLVertexBufferObjects) if(m_bUseOpenGLVertexBufferObjects)
{ {
renderRegionVertexBufferObject(m_mapOpenGLSurfacePatches[v3dRegPos], uLodLevel); renderRegionVertexBufferObject(m_mapOpenGLSurfaceMeshes[v3dRegPos], uLodLevel);
} }
else else
{ {
renderRegionImmediateMode(*ispCurrent, uLodLevel); renderRegionImmediateMode(*meshCurrent, uLodLevel);
} }
} }
} }

View File

@ -30,7 +30,7 @@ freely, subject to the following restrictions:
#include <QTimer> #include <QTimer>
#include "Volume.h" #include "Volume.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include "PolyVoxImpl/Utility.h" #include "PolyVoxImpl/Utility.h"
#include "OpenGLImmediateModeSupport.h" #include "OpenGLImmediateModeSupport.h"
@ -72,8 +72,8 @@ class OpenGLWidget : public QGLWidget
PolyVox::Volume<PolyVox::uint8_t>* m_volData; PolyVox::Volume<PolyVox::uint8_t>* m_volData;
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region //Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
std::map<PolyVox::Vector3DUint8, OpenGLSurfacePatch> m_mapOpenGLSurfacePatches; std::map<PolyVox::Vector3DUint8, OpenGLSurfaceMesh> m_mapOpenGLSurfaceMeshes;
std::map<PolyVox::Vector3DUint8, POLYVOX_SHARED_PTR<PolyVox::IndexedSurfacePatch> > m_mapIndexedSurfacePatches; std::map<PolyVox::Vector3DUint8, POLYVOX_SHARED_PTR<PolyVox::SurfaceMesh> > m_mapSurfaceMeshes;
unsigned int m_uRegionSideLength; unsigned int m_uRegionSideLength;
unsigned int m_uVolumeWidthInRegions; unsigned int m_uVolumeWidthInRegions;

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
#include "Log.h" #include "Log.h"
#include "Volume.h" #include "Volume.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include "PolyVoxImpl/Utility.h" #include "PolyVoxImpl/Utility.h"
#include "OpenGLImmediateModeSupport.h" #include "OpenGLImmediateModeSupport.h"

View File

@ -5,7 +5,7 @@ PROJECT(PolyVoxCore)
#Projects source files #Projects source files
SET(CORE_SRC_FILES SET(CORE_SRC_FILES
source/GradientEstimators.cpp source/GradientEstimators.cpp
source/IndexedSurfacePatch.cpp source/SurfaceMesh.cpp
source/Log.cpp source/Log.cpp
source/Mesh.cpp source/Mesh.cpp
source/MeshEdge.cpp source/MeshEdge.cpp
@ -20,7 +20,7 @@ SET(CORE_SRC_FILES
#Projects headers files #Projects headers files
SET(CORE_INC_FILES SET(CORE_INC_FILES
include/GradientEstimators.inl include/GradientEstimators.inl
include/IndexedSurfacePatch.h include/SurfaceMesh.h
include/Log.h include/Log.h
include/Mesh.h include/Mesh.h
include/MeshEdge.h include/MeshEdge.h

View File

@ -55,7 +55,7 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(VolumeSampler<VoxelType>& volIter); Vector3DFloat computeSmoothSobelGradient(VolumeSampler<VoxelType>& volIter);
POLYVOXCORE_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod); POLYVOXCORE_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod);
POLYVOXCORE_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod); POLYVOXCORE_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
} }

View File

@ -40,8 +40,8 @@ namespace PolyVox
{ {
public: public:
void buildFromISP(IndexedSurfacePatch* pIsp); void buildFromMesh(SurfaceMesh* pMesh);
void fillISP(IndexedSurfacePatch* pIsp); void fillMesh(SurfaceMesh* pMesh);
void matchEdgePairs(void); void matchEdgePairs(void);
void computeEdgeCosts(void); void computeEdgeCosts(void);

View File

@ -43,7 +43,7 @@ namespace PolyVox
//MeshEdge* m_pEdge; //MeshEdge* m_pEdge;
//std::set<MeshFace*> m_faces; //std::set<MeshFace*> m_faces;
//std::set<MeshEdge*> m_edges; //Edges which have this vertex as the src //std::set<MeshEdge*> m_edges; //Edges which have this vertex as the src
long int m_index; //Bit wasteful to store this the whle time, as it's only used when converting to ISPs? long int m_index; //Bit wasteful to store this the whle time, as it's only used when converting to Meshs?
bool isSane(void); bool isSane(void);
}; };

View File

@ -46,7 +46,7 @@ namespace PolyVox
class MeshVertex; class MeshVertex;
//--------------------------------- //---------------------------------
class IndexedSurfacePatch; class SurfaceMesh;
class Region; class Region;
class SurfaceVertex; class SurfaceVertex;
class SurfaceExtractor; class SurfaceExtractor;

View File

@ -45,7 +45,7 @@ namespace PolyVox
void setLodLevel(uint8_t uLodLevel); void setLodLevel(uint8_t uLodLevel);
POLYVOX_SHARED_PTR<IndexedSurfacePatch> extractSurfaceForRegion(Region region); POLYVOX_SHARED_PTR<SurfaceMesh> extractSurfaceForRegion(Region region);
private: private:
//Extract the surface for a particular LOD level //Extract the surface for a particular LOD level
@ -106,7 +106,7 @@ namespace PolyVox
uint32_t m_uNoOfOccupiedCells; uint32_t m_uNoOfOccupiedCells;
//The surface patch we are currently filling. //The surface patch we are currently filling.
IndexedSurfacePatch* m_ispCurrent; SurfaceMesh* m_meshCurrent;
//Information about the region we are currently processing //Information about the region we are currently processing
Region m_regInputCropped; Region m_regInputCropped;

View File

@ -23,8 +23,8 @@ freely, subject to the following restrictions:
*******************************************************************************/ *******************************************************************************/
#pragma endregion #pragma endregion
#ifndef __PolyVox_IndexedSurfacePatch_H__ #ifndef __PolyVox_SurfaceMesh_H__
#define __PolyVox_IndexedSurfacePatch_H__ #define __PolyVox_SurfaceMesh_H__
#include <vector> #include <vector>
#include <set> #include <set>
@ -45,11 +45,11 @@ namespace PolyVox
int endIndex; //Let's put it just past the end STL style int endIndex; //Let's put it just past the end STL style
}; };
class POLYVOXCORE_API IndexedSurfacePatch class POLYVOXCORE_API SurfaceMesh
{ {
public: public:
IndexedSurfacePatch(); SurfaceMesh();
~IndexedSurfacePatch(); ~SurfaceMesh();
const std::vector<uint32_t>& getIndices(void) const; const std::vector<uint32_t>& getIndices(void) const;
uint32_t getNoOfIndices(void) const; uint32_t getNoOfIndices(void) const;
@ -67,7 +67,7 @@ namespace PolyVox
void smoothPositions(float fAmount, bool bIncludeGeometryEdgeVertices = false); void smoothPositions(float fAmount, bool bIncludeGeometryEdgeVertices = false);
void sumNearbyNormals(bool bNormaliseResult = true); void sumNearbyNormals(bool bNormaliseResult = true);
POLYVOX_SHARED_PTR<IndexedSurfacePatch> extractSubset(std::set<uint8_t> setMaterials); POLYVOX_SHARED_PTR<SurfaceMesh> extractSubset(std::set<uint8_t> setMaterials);
void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false); void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false);
@ -110,4 +110,4 @@ namespace PolyVox
}; };
} }
#endif /* __IndexedSurfacePatch_H__ */ #endif /* __SurfaceMesh_H__ */

View File

@ -46,7 +46,7 @@ namespace PolyVox
/// by a three dimensional (x,y,z) coordinate, rather than the two dimensional (x,y) /// by a three dimensional (x,y,z) coordinate, rather than the two dimensional (x,y)
/// coordinate which is used to identify an element (pixel) in a normal image. Within /// coordinate which is used to identify an element (pixel) in a normal image. Within
/// PolyVox, the Volume class is used to store and manipulate our data before we extract /// PolyVox, the Volume class is used to store and manipulate our data before we extract
/// our SurfacePatch's from it. /// our SurfaceMeshs from it.
/// ///
/// <b>Data Representaion - feel free to skip</b> /// <b>Data Representaion - feel free to skip</b>
/// If stored carelessly, volume data can take up a huge amount of memory. For example, a /// If stored carelessly, volume data can take up a huge amount of memory. For example, a

View File

@ -22,7 +22,7 @@ freely, subject to the following restrictions:
*******************************************************************************/ *******************************************************************************/
#include "GradientEstimators.h" #include "GradientEstimators.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include "SurfaceVertex.h" #include "SurfaceVertex.h"
#include "PolyVoxImpl/TypeDef.h" #include "PolyVoxImpl/TypeDef.h"
@ -30,13 +30,13 @@ using namespace std;
namespace PolyVox namespace PolyVox
{ {
void computeNormalsForVertices(Volume<uint8_t>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod) void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod)
{ {
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData(); std::vector<SurfaceVertex>& vecVertices = mesh.getRawVertexData();
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin(); std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
while(iterSurfaceVertex != vecVertices.end()) while(iterSurfaceVertex != vecVertices.end())
{ {
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_Region.getLowerCorner()); const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(mesh.m_Region.getLowerCorner());
const Vector3DInt16 v3dFloor = static_cast<Vector3DInt16>(v3dPos); const Vector3DInt16 v3dFloor = static_cast<Vector3DInt16>(v3dPos);
VolumeSampler<uint8_t> volIter(volumeData); VolumeSampler<uint8_t> volIter(volumeData);

View File

@ -25,31 +25,31 @@ freely, subject to the following restrictions:
#include "Mesh.h" #include "Mesh.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include <vector> #include <vector>
namespace PolyVox namespace PolyVox
{ {
void Mesh::buildFromISP(IndexedSurfacePatch* pIsp) void Mesh::buildFromMesh(SurfaceMesh* pMesh)
{ {
//First we copy the vertices across. //First we copy the vertices across.
//We also keep track of where each vertex went //We also keep track of where each vertex went
std::vector< std::set<MeshVertex*>::iterator > vertexMapper(pIsp->getNoOfVertices()); std::vector< std::set<MeshVertex*>::iterator > vertexMapper(pMesh->getNoOfVertices());
for(int ct = 0; ct < pIsp->getNoOfVertices(); ct++) for(int ct = 0; ct < pMesh->getNoOfVertices(); ct++)
{ {
MeshVertex* pMeshVertex = new MeshVertex; MeshVertex* pMeshVertex = new MeshVertex;
pMeshVertex->m_vertexData = pIsp->m_vecVertices[ct]; pMeshVertex->m_vertexData = pMesh->m_vecVertices[ct];
vertexMapper[ct] = m_vertices.insert(pMeshVertex).first; vertexMapper[ct] = m_vertices.insert(pMeshVertex).first;
} }
//Next, we add each triangle to the mesh //Next, we add each triangle to the mesh
for(int triCt = 0; triCt < pIsp->getNoOfIndices() / 3; triCt++) for(int triCt = 0; triCt < pMesh->getNoOfIndices() / 3; triCt++)
{ {
int index0 = pIsp->m_vecTriangleIndices[triCt * 3]; int index0 = pMesh->m_vecTriangleIndices[triCt * 3];
int index1 = pIsp->m_vecTriangleIndices[triCt * 3 + 1]; int index1 = pMesh->m_vecTriangleIndices[triCt * 3 + 1];
int index2 = pIsp->m_vecTriangleIndices[triCt * 3 + 2]; int index2 = pMesh->m_vecTriangleIndices[triCt * 3 + 2];
MeshVertex* meshVertex0 = *(vertexMapper[index0]); MeshVertex* meshVertex0 = *(vertexMapper[index0]);
MeshVertex* meshVertex1 = *(vertexMapper[index1]); MeshVertex* meshVertex1 = *(vertexMapper[index1]);
@ -188,14 +188,14 @@ namespace PolyVox
} }
} }
void Mesh::fillISP(IndexedSurfacePatch* pIsp) void Mesh::fillMesh(SurfaceMesh* pMesh)
{ {
pIsp->clear(); pMesh->clear();
for(std::set<MeshVertex*>::iterator vertItor = m_vertices.begin(); vertItor != m_vertices.end(); vertItor++) for(std::set<MeshVertex*>::iterator vertItor = m_vertices.begin(); vertItor != m_vertices.end(); vertItor++)
{ {
MeshVertex* meshVertex = *vertItor; MeshVertex* meshVertex = *vertItor;
meshVertex->m_index = pIsp->addVertex(meshVertex->m_vertexData); meshVertex->m_index = pMesh->addVertex(meshVertex->m_vertexData);
} }
for(std::set<MeshFace*>::iterator faceItor = m_faces.begin(); faceItor != m_faces.end(); faceItor++) for(std::set<MeshFace*>::iterator faceItor = m_faces.begin(); faceItor != m_faces.end(); faceItor++)
@ -205,14 +205,14 @@ namespace PolyVox
MeshVertex* v1 = meshFace->m_pEdge->m_pNextEdge->m_pSrc; MeshVertex* v1 = meshFace->m_pEdge->m_pNextEdge->m_pSrc;
MeshVertex* v2 = meshFace->m_pEdge->m_pNextEdge->m_pNextEdge->m_pSrc; MeshVertex* v2 = meshFace->m_pEdge->m_pNextEdge->m_pNextEdge->m_pSrc;
pIsp->addTriangle(v0->m_index, v1->m_index, v2->m_index); pMesh->addTriangle(v0->m_index, v1->m_index, v2->m_index);
} }
pIsp->m_vecLodRecords.clear(); pMesh->m_vecLodRecords.clear();
LodRecord lodRecord; LodRecord lodRecord;
lodRecord.beginIndex = 0; lodRecord.beginIndex = 0;
lodRecord.endIndex = pIsp->getNoOfIndices(); lodRecord.endIndex = pMesh->getNoOfIndices();
pIsp->m_vecLodRecords.push_back(lodRecord); pMesh->m_vecLodRecords.push_back(lodRecord);
} }
void Mesh::removeEdge(MeshEdge* pMeshEdge) void Mesh::removeEdge(MeshEdge* pMeshEdge)

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
#include "SurfaceExtractor.h" #include "SurfaceExtractor.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include "PolyVoxImpl/MarchingCubesTables.h" #include "PolyVoxImpl/MarchingCubesTables.h"
#include "SurfaceVertex.h" #include "SurfaceVertex.h"
@ -49,7 +49,7 @@ namespace PolyVox
m_uStepSize = 1 << uLodLevel; m_uStepSize = 1 << uLodLevel;
} }
POLYVOX_SHARED_PTR<IndexedSurfacePatch> SurfaceExtractor::extractSurfaceForRegion(Region region) POLYVOX_SHARED_PTR<SurfaceMesh> SurfaceExtractor::extractSurfaceForRegion(Region region)
{ {
m_regInputUncropped = region; m_regInputUncropped = region;
@ -62,7 +62,7 @@ namespace PolyVox
m_regInputCropped = region; m_regInputCropped = region;
m_regInputCropped.cropTo(m_regVolumeCropped); m_regInputCropped.cropTo(m_regVolumeCropped);
m_ispCurrent = new IndexedSurfacePatch(); m_meshCurrent = new SurfaceMesh();
m_uRegionWidth = m_regInputCropped.width(); m_uRegionWidth = m_regInputCropped.width();
m_uRegionHeight = m_regInputCropped.height(); m_uRegionHeight = m_regInputCropped.height();
@ -111,15 +111,15 @@ namespace PolyVox
delete[] m_pPreviousVertexIndicesZ; delete[] m_pPreviousVertexIndicesZ;
delete[] m_pCurrentVertexIndicesZ; delete[] m_pCurrentVertexIndicesZ;
m_ispCurrent->m_Region = m_regInputUncropped; m_meshCurrent->m_Region = m_regInputUncropped;
m_ispCurrent->m_vecLodRecords.clear(); m_meshCurrent->m_vecLodRecords.clear();
LodRecord lodRecord; LodRecord lodRecord;
lodRecord.beginIndex = 0; lodRecord.beginIndex = 0;
lodRecord.endIndex = m_ispCurrent->getNoOfIndices(); lodRecord.endIndex = m_meshCurrent->getNoOfIndices();
m_ispCurrent->m_vecLodRecords.push_back(lodRecord); m_meshCurrent->m_vecLodRecords.push_back(lodRecord);
return POLYVOX_SHARED_PTR<IndexedSurfacePatch>(m_ispCurrent); return POLYVOX_SHARED_PTR<SurfaceMesh>(m_meshCurrent);
} }
template<uint8_t uLodLevel> template<uint8_t uLodLevel>
@ -636,7 +636,7 @@ namespace PolyVox
surfaceVertex.setOnGeometryEdgePosY(isPosYEdge); surfaceVertex.setOnGeometryEdgePosY(isPosYEdge);
surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge); surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge);
surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge); surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge);
uint32_t uLastVertexIndex = m_ispCurrent->addVertex(surfaceVertex); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
m_pCurrentVertexIndicesX[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex; m_pCurrentVertexIndicesX[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex;
} }
if (edgeTable[iCubeIndex] & 8) if (edgeTable[iCubeIndex] & 8)
@ -654,7 +654,7 @@ namespace PolyVox
surfaceVertex.setOnGeometryEdgePosY(isPosYEdge); surfaceVertex.setOnGeometryEdgePosY(isPosYEdge);
surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge); surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge);
surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge); surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge);
uint32_t uLastVertexIndex = m_ispCurrent->addVertex(surfaceVertex); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
m_pCurrentVertexIndicesY[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex; m_pCurrentVertexIndicesY[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex;
} }
if (edgeTable[iCubeIndex] & 256) if (edgeTable[iCubeIndex] & 256)
@ -672,7 +672,7 @@ namespace PolyVox
surfaceVertex.setOnGeometryEdgePosY(isPosYEdge); surfaceVertex.setOnGeometryEdgePosY(isPosYEdge);
surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge); surfaceVertex.setOnGeometryEdgeNegZ(isNegZEdge);
surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge); surfaceVertex.setOnGeometryEdgePosZ(isPosZEdge);
uint32_t uLastVertexIndex = m_ispCurrent->addVertex(surfaceVertex); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
m_pCurrentVertexIndicesZ[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex; m_pCurrentVertexIndicesZ[getIndex(uXVolSpace - m_regInputCropped.getLowerCorner().getX(),uYVolSpace - m_regInputCropped.getLowerCorner().getY())] = uLastVertexIndex;
} }
}//For each cell }//For each cell
@ -785,7 +785,7 @@ namespace PolyVox
assert(ind0 < 1000000); assert(ind0 < 1000000);
assert(ind1 < 1000000); assert(ind1 < 1000000);
assert(ind2 < 1000000); assert(ind2 < 1000000);
m_ispCurrent->addTriangle(ind0, ind1, ind2); m_meshCurrent->addTriangle(ind0, ind1, ind2);
} }
}//For each triangle }//For each triangle
}//For each cell }//For each cell

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
*******************************************************************************/ *******************************************************************************/
#pragma endregion #pragma endregion
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include <cstdlib> #include <cstdlib>
#include <list> #include <list>
@ -32,26 +32,26 @@ using namespace std;
namespace PolyVox namespace PolyVox
{ {
IndexedSurfacePatch::IndexedSurfacePatch() SurfaceMesh::SurfaceMesh()
{ {
m_iTimeStamp = -1; m_iTimeStamp = -1;
} }
IndexedSurfacePatch::~IndexedSurfacePatch() SurfaceMesh::~SurfaceMesh()
{ {
} }
const std::vector<uint32_t>& IndexedSurfacePatch::getIndices(void) const const std::vector<uint32_t>& SurfaceMesh::getIndices(void) const
{ {
return m_vecTriangleIndices; return m_vecTriangleIndices;
} }
uint32_t IndexedSurfacePatch::getNoOfIndices(void) const uint32_t SurfaceMesh::getNoOfIndices(void) const
{ {
return m_vecTriangleIndices.size(); return m_vecTriangleIndices.size();
} }
uint32_t IndexedSurfacePatch::getNoOfNonUniformTrianges(void) const uint32_t SurfaceMesh::getNoOfNonUniformTrianges(void) const
{ {
uint32_t result = 0; uint32_t result = 0;
for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3) for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3)
@ -68,7 +68,7 @@ namespace PolyVox
return result; return result;
} }
uint32_t IndexedSurfacePatch::getNoOfUniformTrianges(void) const uint32_t SurfaceMesh::getNoOfUniformTrianges(void) const
{ {
uint32_t result = 0; uint32_t result = 0;
for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3) for(uint32_t i = 0; i < m_vecTriangleIndices.size() - 2; i += 3)
@ -82,22 +82,22 @@ namespace PolyVox
return result; return result;
} }
uint32_t IndexedSurfacePatch::getNoOfVertices(void) const uint32_t SurfaceMesh::getNoOfVertices(void) const
{ {
return m_vecVertices.size(); return m_vecVertices.size();
} }
std::vector<SurfaceVertex>& IndexedSurfacePatch::getRawVertexData(void) std::vector<SurfaceVertex>& SurfaceMesh::getRawVertexData(void)
{ {
return m_vecVertices; return m_vecVertices;
} }
const std::vector<SurfaceVertex>& IndexedSurfacePatch::getVertices(void) const const std::vector<SurfaceVertex>& SurfaceMesh::getVertices(void) const
{ {
return m_vecVertices; return m_vecVertices;
} }
void IndexedSurfacePatch::addTriangle(uint32_t index0, uint32_t index1, uint32_t index2) void SurfaceMesh::addTriangle(uint32_t index0, uint32_t index1, uint32_t index2)
{ {
m_vecTriangleIndices.push_back(index0); m_vecTriangleIndices.push_back(index0);
m_vecTriangleIndices.push_back(index1); m_vecTriangleIndices.push_back(index1);
@ -115,13 +115,13 @@ namespace PolyVox
} }
} }
uint32_t IndexedSurfacePatch::addVertex(const SurfaceVertex& vertex) uint32_t SurfaceMesh::addVertex(const SurfaceVertex& vertex)
{ {
m_vecVertices.push_back(vertex); m_vecVertices.push_back(vertex);
return m_vecVertices.size() - 1; return m_vecVertices.size() - 1;
} }
void IndexedSurfacePatch::clear(void) void SurfaceMesh::clear(void)
{ {
m_vecVertices.clear(); m_vecVertices.clear();
m_vecTriangleIndices.clear(); m_vecTriangleIndices.clear();
@ -129,7 +129,7 @@ namespace PolyVox
m_mapUsedMaterials.clear(); m_mapUsedMaterials.clear();
} }
const bool IndexedSurfacePatch::isEmpty(void) const const bool SurfaceMesh::isEmpty(void) const
{ {
return (getNoOfVertices() == 0) || (getNoOfIndices() == 0); return (getNoOfVertices() == 0) || (getNoOfIndices() == 0);
} }
@ -142,10 +142,10 @@ namespace PolyVox
/// \param fAmount A factor controlling how much the vertices move by. Find a good /// \param fAmount A factor controlling how much the vertices move by. Find a good
/// value by experimentation, starting with something small such as 0.1f. /// value by experimentation, starting with something small such as 0.1f.
/// \param bIncludeGeometryEdgeVertices Indicates whether vertices on the edge of an /// \param bIncludeGeometryEdgeVertices Indicates whether vertices on the edge of an
/// IndexedSurfacePatch should be smoothed. This can cause dicontinuities between /// SurfaceMesh should be smoothed. This can cause dicontinuities between
/// neighbouring patches. /// neighbouring patches.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void IndexedSurfacePatch::smoothPositions(float fAmount, bool bIncludeGeometryEdgeVertices) void SurfaceMesh::smoothPositions(float fAmount, bool bIncludeGeometryEdgeVertices)
{ {
if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise... if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise...
{ {
@ -221,7 +221,7 @@ namespace PolyVox
/// vertex. Usually, the resulting normals should be renormalised afterwards. /// vertex. Usually, the resulting normals should be renormalised afterwards.
/// Note: This function can cause lighting discontinuities accross region boundaries. /// Note: This function can cause lighting discontinuities accross region boundaries.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void IndexedSurfacePatch::sumNearbyNormals(bool bNormaliseResult) void SurfaceMesh::sumNearbyNormals(bool bNormaliseResult)
{ {
if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise... if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise...
{ {
@ -262,7 +262,7 @@ namespace PolyVox
} }
} }
void IndexedSurfacePatch::generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices) void SurfaceMesh::generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices)
{ {
Vector3DFloat offset = static_cast<Vector3DFloat>(m_Region.getLowerCorner()); Vector3DFloat offset = static_cast<Vector3DFloat>(m_Region.getLowerCorner());
@ -313,7 +313,7 @@ namespace PolyVox
//This function looks at every vertex in the mesh and determines //This function looks at every vertex in the mesh and determines
//how many of it's neighbours have the same material. //how many of it's neighbours have the same material.
void IndexedSurfacePatch::countNoOfNeighboursUsingMaterial(void) void SurfaceMesh::countNoOfNeighboursUsingMaterial(void)
{ {
//Find all the neighbouring vertices for each vertex //Find all the neighbouring vertices for each vertex
std::vector< std::set<int> > neighbouringVertices(m_vecVertices.size()); std::vector< std::set<int> > neighbouringVertices(m_vecVertices.size());
@ -348,9 +348,9 @@ namespace PolyVox
} }
} }
POLYVOX_SHARED_PTR<IndexedSurfacePatch> IndexedSurfacePatch::extractSubset(std::set<uint8_t> setMaterials) POLYVOX_SHARED_PTR<SurfaceMesh> SurfaceMesh::extractSubset(std::set<uint8_t> setMaterials)
{ {
POLYVOX_SHARED_PTR<IndexedSurfacePatch> result(new IndexedSurfacePatch); POLYVOX_SHARED_PTR<SurfaceMesh> result(new SurfaceMesh);
if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise... if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise...
{ {
@ -413,7 +413,7 @@ namespace PolyVox
return result; return result;
} }
/*int IndexedSurfacePatch::countMaterialBoundary(void) /*int SurfaceMesh::countMaterialBoundary(void)
{ {
int count = 0; int count = 0;
for(int ct = 0; ct < m_vecVertices.size(); ct++) for(int ct = 0; ct < m_vecVertices.size(); ct++)
@ -426,7 +426,7 @@ namespace PolyVox
return count; return count;
} }
void IndexedSurfacePatch::growMaterialBoundary(void) void SurfaceMesh::growMaterialBoundary(void)
{ {
std::vector<SurfaceVertex> vecNewVertices = m_vecVertices; std::vector<SurfaceVertex> vecNewVertices = m_vecVertices;
@ -453,7 +453,7 @@ namespace PolyVox
m_vecVertices = vecNewVertices; m_vecVertices = vecNewVertices;
}*/ }*/
void IndexedSurfacePatch::decimate(float fMinDotProductForCollapse) void SurfaceMesh::decimate(float fMinDotProductForCollapse)
{ {
// We will need the information from this function to // We will need the information from this function to
// determine when material boundary edges can collapse. // determine when material boundary edges can collapse.
@ -475,7 +475,7 @@ namespace PolyVox
} }
// Returns true if every bit which is set in 'a' is also set in 'b'. The reverse does not need to be true. // Returns true if every bit which is set in 'a' is also set in 'b'. The reverse does not need to be true.
bool IndexedSurfacePatch::isSubset(std::bitset<VF_NO_OF_FLAGS> a, std::bitset<VF_NO_OF_FLAGS> b) bool SurfaceMesh::isSubset(std::bitset<VF_NO_OF_FLAGS> a, std::bitset<VF_NO_OF_FLAGS> b)
{ {
bool result = true; bool result = true;
@ -494,7 +494,7 @@ namespace PolyVox
return result; return result;
} }
uint32_t IndexedSurfacePatch::performDecimationPass(float fMinDotProductForCollapse) uint32_t SurfaceMesh::performDecimationPass(float fMinDotProductForCollapse)
{ {
// I'm using a vector of lists here, rather than a vector of sets, // I'm using a vector of lists here, rather than a vector of sets,
// because I don't believe that duplicaes should occur. But this // because I don't believe that duplicaes should occur. But this
@ -783,7 +783,7 @@ namespace PolyVox
return noOfEdgesCollapsed; return noOfEdgesCollapsed;
} }
int IndexedSurfacePatch::noOfDegenerateTris(void) int SurfaceMesh::noOfDegenerateTris(void)
{ {
int count = 0; int count = 0;
for(int triCt = 0; triCt < m_vecTriangleIndices.size();) for(int triCt = 0; triCt < m_vecTriangleIndices.size();)
@ -803,7 +803,7 @@ namespace PolyVox
return count; return count;
} }
void IndexedSurfacePatch::removeDegenerateTris(void) void SurfaceMesh::removeDegenerateTris(void)
{ {
int noOfNonDegenerate = 0; int noOfNonDegenerate = 0;
int targetCt = 0; int targetCt = 0;

View File

@ -26,7 +26,7 @@ freely, subject to the following restrictions:
#include "VolumeChangeTracker.h" #include "VolumeChangeTracker.h"
#include "GradientEstimators.h" #include "GradientEstimators.h"
#include "IndexedSurfacePatch.h" #include "SurfaceMesh.h"
#include "PolyVoxImpl/MarchingCubesTables.h" #include "PolyVoxImpl/MarchingCubesTables.h"
#include "SurfaceVertex.h" #include "SurfaceVertex.h"
#include "PolyVoxImpl/Utility.h" #include "PolyVoxImpl/Utility.h"