Fixed some compiler warnings.
Removed m_mapUsedMaterials as it didn't seem to be used.
This commit is contained in:
parent
3ae119f171
commit
97e6b56778
@ -49,7 +49,7 @@ void renderRegionImmediateMode(PolyVox::SurfaceMesh<PositionMaterialNormal>& mes
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t material = vertex.getMaterial() + 0.5;
|
uint8_t material = static_cast<uint8_t>(vertex.getMaterial() + 0.5);
|
||||||
|
|
||||||
OpenGLColour colour = convertMaterialIDToColour(material);
|
OpenGLColour colour = convertMaterialIDToColour(material);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh<PositionMaterialNorma
|
|||||||
*ptr = vertex.getNormal().getZ();
|
*ptr = vertex.getNormal().getZ();
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
uint8_t material = vertex.getMaterial() + 0.5;
|
uint8_t material = static_cast<uint8_t>(vertex.getMaterial() + 0.5);
|
||||||
|
|
||||||
OpenGLColour colour = convertMaterialIDToColour(material);
|
OpenGLColour colour = convertMaterialIDToColour(material);
|
||||||
|
|
||||||
|
@ -64,6 +64,15 @@ namespace PolyVox
|
|||||||
:m_pVolume(pVolume)
|
:m_pVolume(pVolume)
|
||||||
,m_regValid(regValid)
|
,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<VoxelType>& m_pVolume;
|
const LargeVolume<VoxelType>& m_pVolume;
|
||||||
|
@ -44,16 +44,16 @@ namespace PolyVox
|
|||||||
for(int32_t x = m_regSizeInVoxels.getLowerCorner().getX(); x < m_regSizeInVoxels.getUpperCorner().getX(); x++)
|
for(int32_t x = m_regSizeInVoxels.getLowerCorner().getX(); x < m_regSizeInVoxels.getUpperCorner().getX(); x++)
|
||||||
{
|
{
|
||||||
// these are always positive anyway
|
// these are always positive anyway
|
||||||
uint32_t regX = x - m_regSizeInVoxels.getLowerCorner().getX();
|
float regX = static_cast<float>(x - m_regSizeInVoxels.getLowerCorner().getX());
|
||||||
uint32_t regY = y - m_regSizeInVoxels.getLowerCorner().getY();
|
float regY = static_cast<float>(y - m_regSizeInVoxels.getLowerCorner().getY());
|
||||||
uint32_t regZ = z - m_regSizeInVoxels.getLowerCorner().getZ();
|
float regZ = static_cast<float>(z - m_regSizeInVoxels.getLowerCorner().getZ());
|
||||||
|
|
||||||
int currentVoxel = m_volData->getVoxelAt(x,y,z).getDensity() >= VoxelType::getThreshold();
|
int currentVoxel = m_volData->getVoxelAt(x,y,z).getDensity() >= VoxelType::getThreshold();
|
||||||
|
|
||||||
int plusXVoxel = m_volData->getVoxelAt(x+1,y,z).getDensity() >= VoxelType::getThreshold();
|
int plusXVoxel = m_volData->getVoxelAt(x+1,y,z).getDensity() >= VoxelType::getThreshold();
|
||||||
if(currentVoxel > plusXVoxel)
|
if(currentVoxel > plusXVoxel)
|
||||||
{
|
{
|
||||||
uint32_t material = m_volData->getVoxelAt(x,y,z).getMaterial();
|
float material = static_cast<float>(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 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));
|
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)
|
if(currentVoxel < plusXVoxel)
|
||||||
{
|
{
|
||||||
int material = m_volData->getVoxelAt(x+1,y,z).getMaterial();
|
float material = static_cast<float>(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 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));
|
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();
|
int plusYVoxel = m_volData->getVoxelAt(x,y+1,z).getDensity() >= VoxelType::getThreshold();
|
||||||
if(currentVoxel > plusYVoxel)
|
if(currentVoxel > plusYVoxel)
|
||||||
{
|
{
|
||||||
int material = m_volData->getVoxelAt(x,y,z).getMaterial();
|
float material = static_cast<float>(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 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));
|
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)
|
if(currentVoxel < plusYVoxel)
|
||||||
{
|
{
|
||||||
int material = m_volData->getVoxelAt(x,y+1,z).getMaterial();
|
float material = static_cast<float>(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 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));
|
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();
|
int plusZVoxel = m_volData->getVoxelAt(x,y,z+1).getDensity() >= VoxelType::getThreshold();
|
||||||
if(currentVoxel > plusZVoxel)
|
if(currentVoxel > plusZVoxel)
|
||||||
{
|
{
|
||||||
int material = m_volData->getVoxelAt(x,y,z).getMaterial();
|
float material = static_cast<float>(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 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));
|
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)
|
if(currentVoxel < plusZVoxel)
|
||||||
{
|
{
|
||||||
int material = m_volData->getVoxelAt(x,y,z+1).getMaterial();
|
float material = static_cast<float>(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 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));
|
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));
|
||||||
|
@ -93,11 +93,6 @@ namespace PolyVox
|
|||||||
std::vector<VertexType> m_vecVertices;
|
std::vector<VertexType> m_vecVertices;
|
||||||
|
|
||||||
std::vector<LodRecord> m_vecLodRecords;
|
std::vector<LodRecord> 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<uint8_t> m_mapUsedMaterials;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename VertexType>
|
template <typename VertexType>
|
||||||
|
@ -103,11 +103,6 @@ namespace PolyVox
|
|||||||
m_vecTriangleIndices.push_back(index0);
|
m_vecTriangleIndices.push_back(index0);
|
||||||
m_vecTriangleIndices.push_back(index1);
|
m_vecTriangleIndices.push_back(index1);
|
||||||
m_vecTriangleIndices.push_back(index2);
|
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 <typename VertexType>
|
template <typename VertexType>
|
||||||
@ -131,7 +126,6 @@ namespace PolyVox
|
|||||||
m_vecVertices.clear();
|
m_vecVertices.clear();
|
||||||
m_vecTriangleIndices.clear();
|
m_vecTriangleIndices.clear();
|
||||||
m_vecLodRecords.clear();
|
m_vecLodRecords.clear();
|
||||||
m_mapUsedMaterials.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VertexType>
|
template <typename VertexType>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user