From 97e6b5677820e871350644e85746aba18d214c7b Mon Sep 17 00:00:00 2001 From: David Williams Date: Mon, 28 Nov 2011 16:43:40 +0000 Subject: [PATCH] Fixed some compiler warnings. Removed m_mapUsedMaterials as it didn't seem to be used. --- examples/OpenGL/OpenGLImmediateModeSupport.cpp | 2 +- .../OpenGL/OpenGLVertexBufferObjectSupport.cpp | 2 +- .../include/PolyVoxCore/ConstVolumeProxy.h | 9 +++++++++ .../CubicSurfaceExtractorWithNormals.inl | 18 +++++++++--------- .../include/PolyVoxCore/SurfaceMesh.h | 5 ----- .../include/PolyVoxCore/SurfaceMesh.inl | 6 ------ 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/examples/OpenGL/OpenGLImmediateModeSupport.cpp b/examples/OpenGL/OpenGLImmediateModeSupport.cpp index 3e09b21b..c891008d 100644 --- a/examples/OpenGL/OpenGLImmediateModeSupport.cpp +++ b/examples/OpenGL/OpenGLImmediateModeSupport.cpp @@ -49,7 +49,7 @@ void renderRegionImmediateMode(PolyVox::SurfaceMesh& mes - uint8_t material = vertex.getMaterial() + 0.5; + uint8_t material = static_cast(vertex.getMaterial() + 0.5); OpenGLColour colour = convertMaterialIDToColour(material); diff --git a/examples/OpenGL/OpenGLVertexBufferObjectSupport.cpp b/examples/OpenGL/OpenGLVertexBufferObjectSupport.cpp index a2f9d7e9..8dfb3351 100644 --- a/examples/OpenGL/OpenGLVertexBufferObjectSupport.cpp +++ b/examples/OpenGL/OpenGLVertexBufferObjectSupport.cpp @@ -83,7 +83,7 @@ OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh(vertex.getMaterial() + 0.5); OpenGLColour colour = convertMaterialIDToColour(material); diff --git a/library/PolyVoxCore/include/PolyVoxCore/ConstVolumeProxy.h b/library/PolyVoxCore/include/PolyVoxCore/ConstVolumeProxy.h index bde93f4d..c8e33588 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/ConstVolumeProxy.h +++ b/library/PolyVoxCore/include/PolyVoxCore/ConstVolumeProxy.h @@ -64,6 +64,15 @@ namespace PolyVox :m_pVolume(pVolume) ,m_regValid(regValid) { + //Should never get here as it's a private constructor + assert(false); + } + + //Private assignment operator, so client code can't abuse this class. + ConstVolumeProxy& operator=(const ConstVolumeProxy& rhs) throw() + { + //Should never get here as it's a private assignment operator + assert(false); } const LargeVolume& m_pVolume; diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl index 1cd99ea4..c448cbba 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl @@ -44,16 +44,16 @@ namespace PolyVox for(int32_t x = m_regSizeInVoxels.getLowerCorner().getX(); x < m_regSizeInVoxels.getUpperCorner().getX(); x++) { // these are always positive anyway - uint32_t regX = x - m_regSizeInVoxels.getLowerCorner().getX(); - uint32_t regY = y - m_regSizeInVoxels.getLowerCorner().getY(); - uint32_t regZ = z - m_regSizeInVoxels.getLowerCorner().getZ(); + float regX = static_cast(x - m_regSizeInVoxels.getLowerCorner().getX()); + float regY = static_cast(y - m_regSizeInVoxels.getLowerCorner().getY()); + float regZ = static_cast(z - m_regSizeInVoxels.getLowerCorner().getZ()); int currentVoxel = m_volData->getVoxelAt(x,y,z).getDensity() >= VoxelType::getThreshold(); int plusXVoxel = m_volData->getVoxelAt(x+1,y,z).getDensity() >= VoxelType::getThreshold(); if(currentVoxel > plusXVoxel) { - uint32_t material = m_volData->getVoxelAt(x,y,z).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x,y,z).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), material)); @@ -65,7 +65,7 @@ namespace PolyVox } if(currentVoxel < plusXVoxel) { - int material = m_volData->getVoxelAt(x+1,y,z).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x+1,y,z).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), material)); @@ -79,7 +79,7 @@ namespace PolyVox int plusYVoxel = m_volData->getVoxelAt(x,y+1,z).getDensity() >= VoxelType::getThreshold(); if(currentVoxel > plusYVoxel) { - int material = m_volData->getVoxelAt(x,y,z).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x,y,z).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), material)); @@ -91,7 +91,7 @@ namespace PolyVox } if(currentVoxel < plusYVoxel) { - int material = m_volData->getVoxelAt(x,y+1,z).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x,y+1,z).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), material)); @@ -105,7 +105,7 @@ namespace PolyVox int plusZVoxel = m_volData->getVoxelAt(x,y,z+1).getDensity() >= VoxelType::getThreshold(); if(currentVoxel > plusZVoxel) { - int material = m_volData->getVoxelAt(x,y,z).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x,y,z).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), material)); @@ -117,7 +117,7 @@ namespace PolyVox } if(currentVoxel < plusZVoxel) { - int material = m_volData->getVoxelAt(x,y,z+1).getMaterial(); + float material = static_cast(m_volData->getVoxelAt(x,y,z+1).getMaterial()); uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), material)); uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), material)); diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.h b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.h index c0833d5a..bd1e93b5 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.h +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.h @@ -93,11 +93,6 @@ namespace PolyVox std::vector m_vecVertices; std::vector m_vecLodRecords; - - //The set of materials which are in this mesh. Only those materials - //which cover a whole triangle are counted. Materials which only - //exist on a material boundary do not count. - std::set m_mapUsedMaterials; }; template diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl index 83fc97ab..f21ad6b0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl @@ -103,11 +103,6 @@ namespace PolyVox m_vecTriangleIndices.push_back(index0); m_vecTriangleIndices.push_back(index1); m_vecTriangleIndices.push_back(index2); - - if((m_vecVertices[index0].material == m_vecVertices[index1].material) && (m_vecVertices[index0].material == m_vecVertices[index2].material)) - { - m_mapUsedMaterials.insert(m_vecVertices[index0].material); - } } template @@ -131,7 +126,6 @@ namespace PolyVox m_vecVertices.clear(); m_vecTriangleIndices.clear(); m_vecLodRecords.clear(); - m_mapUsedMaterials.clear(); } template