Fixing some warnings in PolyVox.
This commit is contained in:
parent
ffa4fcaade
commit
659529787a
@ -30,7 +30,7 @@ using namespace PolyVox;
|
||||
void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, float fRadius, uint8_t uValue)
|
||||
{
|
||||
//This vector hold the position of the center of the volume
|
||||
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
|
||||
Vector3DInt32 v3dVolCenter = (volData.getEnclosingRegion().getUpperCorner() - volData.getEnclosingRegion().getLowerCorner()) / 2;
|
||||
|
||||
//This three-level for loop iterates over every voxel in the volume
|
||||
for (int z = 0; z < volData.getWidth(); z++)
|
||||
@ -40,9 +40,9 @@ void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, float fRa
|
||||
for (int x = 0; x < volData.getDepth(); x++)
|
||||
{
|
||||
//Store our current position as a vector...
|
||||
Vector3DFloat v3dCurrentPos(x,y,z);
|
||||
Vector3DInt32 v3dCurrentPos(x,y,z);
|
||||
//And compute how far the current position is from the center of the volume
|
||||
float fDistToCenter = (v3dCurrentPos - v3dVolCenter).length();
|
||||
double fDistToCenter = (v3dCurrentPos - v3dVolCenter).length();
|
||||
|
||||
//If the current voxel is less than 'radius' units from the center
|
||||
//then we make it solid, otherwise we make it empty space.
|
||||
|
@ -359,7 +359,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
Vector3DInt32 v3dSize = v3dEnd - v3dStart + Vector3DInt32(1,1,1);
|
||||
int32_t numblocks = v3dSize.getX() * v3dSize.getY() * v3dSize.getZ();
|
||||
uint32_t numblocks = static_cast<uint32_t>(v3dSize.getX() * v3dSize.getY() * v3dSize.getZ());
|
||||
if(numblocks > m_uMaxNumberOfBlocksInMemory)
|
||||
{
|
||||
// cannot support the amount of blocks... so only load the maximum possible
|
||||
|
@ -85,7 +85,7 @@ namespace PolyVox
|
||||
//Build a list of all the triangles, complete with face normals.
|
||||
m_vecTriangles.clear();
|
||||
m_vecTriangles.resize(m_pOutputMesh->m_vecTriangleIndices.size() / 3);
|
||||
for(int triCt = 0; triCt < m_vecTriangles.size(); triCt++)
|
||||
for(uint32_t triCt = 0; triCt < m_vecTriangles.size(); triCt++)
|
||||
{
|
||||
m_vecTriangles[triCt].v0 = m_pOutputMesh->m_vecTriangleIndices[triCt * 3 + 0];
|
||||
m_vecTriangles[triCt].v1 = m_pOutputMesh->m_vecTriangleIndices[triCt * 3 + 1];
|
||||
@ -106,11 +106,11 @@ namespace PolyVox
|
||||
//For each vertex, determine which triangles are using it.
|
||||
trianglesUsingVertex.clear();
|
||||
trianglesUsingVertex.resize(m_pOutputMesh->m_vecVertices.size());
|
||||
for(int ct = 0; ct < trianglesUsingVertex.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < trianglesUsingVertex.size(); ct++)
|
||||
{
|
||||
trianglesUsingVertex[ct].reserve(6);
|
||||
}
|
||||
for(int ct = 0; ct < m_vecTriangles.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < m_vecTriangles.size(); ct++)
|
||||
{
|
||||
trianglesUsingVertex[m_vecTriangles[ct].v0].push_back(ct);
|
||||
trianglesUsingVertex[m_vecTriangles[ct].v1].push_back(ct);
|
||||
@ -145,7 +145,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
//For each triangle...
|
||||
for(int ctIter = 0; ctIter < m_vecTriangles.size(); ctIter++)
|
||||
for(uint32_t ctIter = 0; ctIter < m_vecTriangles.size(); ctIter++)
|
||||
{
|
||||
if(attemptEdgeCollapse(m_vecTriangles[ctIter].v0, m_vecTriangles[ctIter].v1))
|
||||
{
|
||||
@ -166,7 +166,7 @@ namespace PolyVox
|
||||
if(noOfEdgesCollapsed > 0)
|
||||
{
|
||||
//Fix up the indices
|
||||
for(int triCt = 0; triCt < m_pOutputMesh->m_vecTriangleIndices.size(); triCt++)
|
||||
for(uint32_t triCt = 0; triCt < m_pOutputMesh->m_vecTriangleIndices.size(); triCt++)
|
||||
{
|
||||
uint32_t before = m_pOutputMesh->m_vecTriangleIndices[triCt];
|
||||
uint32_t after = vertexMapper[m_pOutputMesh->m_vecTriangleIndices[triCt]];
|
||||
|
@ -450,7 +450,7 @@ namespace PolyVox
|
||||
|
||||
const uint32_t uMaterial = v000.getMaterial() | v100.getMaterial(); //Because one of these is 0, the or operation takes the max.
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
m_pCurrentVertexIndicesX[iXVolSpace - m_regSizeInVoxels.getLowerCorner().getX()][iYVolSpace - m_regSizeInVoxels.getLowerCorner().getY()] = uLastVertexIndex;
|
||||
|
||||
@ -473,7 +473,7 @@ namespace PolyVox
|
||||
|
||||
const uint32_t uMaterial = v000.getMaterial() | v010.getMaterial(); //Because one of these is 0, the or operation takes the max.
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
m_pCurrentVertexIndicesY[iXVolSpace - m_regSizeInVoxels.getLowerCorner().getX()][iYVolSpace - m_regSizeInVoxels.getLowerCorner().getY()] = uLastVertexIndex;
|
||||
|
||||
@ -496,7 +496,7 @@ namespace PolyVox
|
||||
|
||||
const uint32_t uMaterial = v000.getMaterial() | v001.getMaterial(); //Because one of these is 0, the or operation takes the max.
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
m_pCurrentVertexIndicesZ[iXVolSpace - m_regSizeInVoxels.getLowerCorner().getX()][iYVolSpace - m_regSizeInVoxels.getLowerCorner().getY()] = uLastVertexIndex;
|
||||
|
||||
|
@ -316,7 +316,7 @@ namespace PolyVox
|
||||
int SurfaceMesh<VertexType>::noOfDegenerateTris(void)
|
||||
{
|
||||
int count = 0;
|
||||
for(int triCt = 0; triCt < m_vecTriangleIndices.size();)
|
||||
for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size();)
|
||||
{
|
||||
int v0 = m_vecTriangleIndices[triCt];
|
||||
triCt++;
|
||||
@ -338,7 +338,7 @@ namespace PolyVox
|
||||
{
|
||||
int noOfNonDegenerate = 0;
|
||||
int targetCt = 0;
|
||||
for(int triCt = 0; triCt < m_vecTriangleIndices.size();)
|
||||
for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size();)
|
||||
{
|
||||
int v0 = m_vecTriangleIndices[triCt];
|
||||
triCt++;
|
||||
@ -369,7 +369,7 @@ namespace PolyVox
|
||||
vector<bool> isVertexUsed(m_vecVertices.size());
|
||||
fill(isVertexUsed.begin(), isVertexUsed.end(), false);
|
||||
|
||||
for(int triCt = 0; triCt < m_vecTriangleIndices.size(); triCt++)
|
||||
for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size(); triCt++)
|
||||
{
|
||||
int v = m_vecTriangleIndices[triCt];
|
||||
isVertexUsed[v] = true;
|
||||
@ -377,7 +377,7 @@ namespace PolyVox
|
||||
|
||||
int noOfUsedVertices = 0;
|
||||
vector<uint32_t> newPos(m_vecVertices.size());
|
||||
for(int vertCt = 0; vertCt < m_vecVertices.size(); vertCt++)
|
||||
for(uint32_t vertCt = 0; vertCt < m_vecVertices.size(); vertCt++)
|
||||
{
|
||||
if(isVertexUsed[vertCt])
|
||||
{
|
||||
@ -389,7 +389,7 @@ namespace PolyVox
|
||||
|
||||
m_vecVertices.resize(noOfUsedVertices);
|
||||
|
||||
for(int triCt = 0; triCt < m_vecTriangleIndices.size(); triCt++)
|
||||
for(uint32_t triCt = 0; triCt < m_vecTriangleIndices.size(); triCt++)
|
||||
{
|
||||
m_vecTriangleIndices[triCt] = newPos[m_vecTriangleIndices[triCt]];
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace PolyVox
|
||||
/**
|
||||
This copy constructor allows casting between vectors with different data types.
|
||||
It is now possible to use code such as:
|
||||
|
||||
|
||||
Vector3DDouble v3dDouble(1.0,2.0,3.0);
|
||||
Vector3DFloat v3dFloat = static_cast<Vector3DFloat>(v3dDouble); //Casting
|
||||
|
||||
@ -106,7 +106,7 @@ namespace PolyVox
|
||||
{
|
||||
for(uint32_t ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] = static_cast<CastType>(vector.getElement(ct));
|
||||
m_tElements[ct] = static_cast<Type>(vector.getElement(ct));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace PolyVox
|
||||
vecVertexMetadata.clear();
|
||||
vecVertexMetadata.resize(m_pOutputMesh->m_vecVertices.size());
|
||||
//Initialise the metadata
|
||||
for(int ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
{
|
||||
vecVertexMetadata[ct].normal.setElements(0,0,0);
|
||||
vecVertexMetadata[ct].isOnMaterialEdge = false;
|
||||
@ -22,7 +22,7 @@ namespace PolyVox
|
||||
//CubicSurfaceExtractor in. Duplicates are now neighbours in the resulting list so just scan through for pairs.
|
||||
std::vector<IntVertex> intVertices;
|
||||
intVertices.reserve(m_pOutputMesh->m_vecVertices.size());
|
||||
for(int ct = 0; ct < m_pOutputMesh->m_vecVertices.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < m_pOutputMesh->m_vecVertices.size(); ct++)
|
||||
{
|
||||
const Vector3DFloat& floatPos = m_pOutputMesh->m_vecVertices[ct].position;
|
||||
IntVertex intVertex(static_cast<uint32_t>(floatPos.getX()), static_cast<uint32_t>(floatPos.getY()), static_cast<uint32_t>(floatPos.getZ()), ct);
|
||||
@ -33,7 +33,7 @@ namespace PolyVox
|
||||
sort(intVertices.begin(), intVertices.end());
|
||||
|
||||
//Find neighbours which are duplicates.
|
||||
for(int ct = 0; ct < intVertices.size() - 1; ct++)
|
||||
for(uint32_t ct = 0; ct < intVertices.size() - 1; ct++)
|
||||
{
|
||||
const IntVertex& v0 = intVertices[ct+0];
|
||||
const IntVertex& v1 = intVertices[ct+1];
|
||||
@ -46,7 +46,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
//Compute an approcimation to the normal, used when deciding if an edge can collapse.
|
||||
for(int ct = 0; ct < m_pOutputMesh->m_vecVertices.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < m_pOutputMesh->m_vecVertices.size(); ct++)
|
||||
{
|
||||
Vector3DFloat sumOfNormals(0.0f,0.0f,0.0f);
|
||||
for(vector<uint32_t>::const_iterator iter = trianglesUsingVertex[ct].cbegin(); iter != trianglesUsingVertex[ct].cend(); iter++)
|
||||
@ -59,7 +59,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
//Identify those vertices on the edge of a region. Care will need to be taken when moving them.
|
||||
for(int ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
{
|
||||
Region regTransformed = m_pOutputMesh->m_Region;
|
||||
regTransformed.shift(regTransformed.getLowerCorner() * static_cast<int32_t>(-1));
|
||||
@ -83,7 +83,7 @@ namespace PolyVox
|
||||
vecVertexMetadata.resize(m_pOutputMesh->m_vecVertices.size());
|
||||
|
||||
//Initialise the metadata
|
||||
for(int ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
{
|
||||
vecVertexMetadata[ct].isOnRegionFace.reset();
|
||||
vecVertexMetadata[ct].isOnMaterialEdge = false;
|
||||
@ -91,7 +91,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
//Identify those vertices on the edge of a region. Care will need to be taken when moving them.
|
||||
for(int ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < vecVertexMetadata.size(); ct++)
|
||||
{
|
||||
Region regTransformed = m_pOutputMesh->m_Region;
|
||||
regTransformed.shift(regTransformed.getLowerCorner() * static_cast<int32_t>(-1));
|
||||
@ -110,7 +110,7 @@ namespace PolyVox
|
||||
//If all three vertices have the same material then we are not on a material edge. If any vertex has a different
|
||||
//material then all three vertices are on a material edge. E.g. If one vertex has material 'a' and the other two
|
||||
//have material 'b', then the two 'b's are still on an edge (with 'a') even though they are the same as eachother.
|
||||
for(int ct = 0; ct < m_vecTriangles.size(); ct++)
|
||||
for(uint32_t ct = 0; ct < m_vecTriangles.size(); ct++)
|
||||
{
|
||||
uint32_t v0 = m_vecTriangles[ct].v0;
|
||||
uint32_t v1 = m_vecTriangles[ct].v1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user