diff --git a/examples/OpenGL/OpenGLWidget.cpp b/examples/OpenGL/OpenGLWidget.cpp index 0a7a248e..1066c416 100644 --- a/examples/OpenGL/OpenGLWidget.cpp +++ b/examples/OpenGL/OpenGLWidget.cpp @@ -96,7 +96,7 @@ void OpenGLWidget::setVolume(PolyVox::Volume* volData) MeshDecimator decimator(mesh.get(), decimatedMesh.get(), 0.95f); decimator.execute(); - decimatedMesh->generateAveragedFaceNormals(true); + //decimatedMesh->generateAveragedFaceNormals(true); //computeNormalsForVertices(m_volData, *(decimatedMesh.get()), SOBEL_SMOOTHED); //*meshCurrent = getSmoothedSurface(*meshCurrent); diff --git a/library/PolyVoxCore/include/SurfaceMesh.h b/library/PolyVoxCore/include/SurfaceMesh.h index da51d008..7e94a8ae 100644 --- a/library/PolyVoxCore/include/SurfaceMesh.h +++ b/library/PolyVoxCore/include/SurfaceMesh.h @@ -63,11 +63,14 @@ namespace PolyVox void clear(void); const bool isEmpty(void) const; - void sumNearbyNormals(bool bNormaliseResult = true); - - polyvox_shared_ptr< SurfaceMesh > extractSubset(std::set setMaterials); - - void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false); + //THESE FUNCTIONS TO BE REMOVED IN THE FUTURE. OR AT LEAST MOVED OUT OF THIS CLASS INTO FREE FUNCTIONS. + //THEY ARE CAUSING PROBLEMS WITH THE SWIG BINDINGS. THE FUNCTIONS REGARDING NORMALS MAKE NO SENSE WHEN + //A VERTEX MIGHT NOT HAVE NORMALS. THE EXTRACT SUBSET FUNCTION SHOULD MAYBE BE APPLICATION CODE, AT ANY + //RATE THE STD::SET CAUSES PROBLEMS WITH SWIG. IF YOU UNCOMMENT ANY OF THESE FUNCTIONS, PLEASE POST ON + //THE FORUM SO WE CAN KNOW THE FUNCTIONALITY IS STILL NEEDED IN SOME FORM. + //void sumNearbyNormals(bool bNormaliseResult = true); + //polyvox_shared_ptr< SurfaceMesh > extractSubset(std::set setMaterials); + //void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false); int noOfDegenerateTris(void); void removeDegenerateTris(void); diff --git a/library/PolyVoxCore/include/SurfaceMesh.inl b/library/PolyVoxCore/include/SurfaceMesh.inl index 556e9128..833a9f0b 100644 --- a/library/PolyVoxCore/include/SurfaceMesh.inl +++ b/library/PolyVoxCore/include/SurfaceMesh.inl @@ -154,7 +154,7 @@ namespace PolyVox /// vertex. Usually, the resulting normals should be renormalised afterwards. /// Note: This function can cause lighting discontinuities accross region boundaries. //////////////////////////////////////////////////////////////////////////////// - template + /*template 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... @@ -194,9 +194,9 @@ namespace PolyVox } m_vecVertices[uIndex].setNormal(summedNormals[uIndex]); } - } + }*/ - template + /*template void SurfaceMesh::generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices) { Vector3DFloat offset = static_cast(m_Region.getLowerCorner()); @@ -244,9 +244,9 @@ namespace PolyVox iterVertex->setNormal(normal); } } - } + }*/ - template + /*template polyvox_shared_ptr< SurfaceMesh > SurfaceMesh::extractSubset(std::set setMaterials) { polyvox_shared_ptr< SurfaceMesh > result(new SurfaceMesh); @@ -310,46 +310,6 @@ namespace PolyVox result->m_vecLodRecords.push_back(lodRecord); return result; - } - - /*int SurfaceMesh::countMaterialBoundary(void) - { - int count = 0; - for(int ct = 0; ct < m_vecVertices.size(); ct++) - { - if(m_vecVertices[ct].m_bIsMaterialEdgeVertex) - { - count++; - } - } - return count; - } - - void SurfaceMesh::growMaterialBoundary(void) - { - std::vector vecNewVertices = m_vecVertices; - - for(vector::iterator iterIndex = m_vecTriangleIndices.begin(); iterIndex != m_vecTriangleIndices.end();) - { - PositionMaterialNormal& v0 = m_vecVertices[*iterIndex]; - PositionMaterialNormal& v0New = vecNewVertices[*iterIndex]; - iterIndex++; - PositionMaterialNormal& v1 = m_vecVertices[*iterIndex]; - PositionMaterialNormal& v1New = vecNewVertices[*iterIndex]; - iterIndex++; - PositionMaterialNormal& v2 = m_vecVertices[*iterIndex]; - PositionMaterialNormal& v2New = vecNewVertices[*iterIndex]; - iterIndex++; - - if(v0.m_bIsMaterialEdgeVertex || v1.m_bIsMaterialEdgeVertex || v2.m_bIsMaterialEdgeVertex) - { - v0New.m_bIsMaterialEdgeVertex = true; - v1New.m_bIsMaterialEdgeVertex = true; - v2New.m_bIsMaterialEdgeVertex = true; - } - } - - m_vecVertices = vecNewVertices; }*/ template