diff --git a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl b/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl index 1e1e07bc..9159b02f 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl @@ -40,8 +40,8 @@ namespace PolyVox } //and if their density is below the threshold. - Material8 voxel = volData->getVoxelAt(v3dPos); - if(voxel.getDensity() >= Material8::getThreshold()) + VoxelType voxel = volData->getVoxelAt(v3dPos); + if(voxel.getDensity() >= VoxelType::getThreshold()) { return false; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h index 1beb6cb2..17b6189d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h @@ -63,7 +63,7 @@ namespace PolyVox void execute(); private: - int32_t addVertex(float fX, float fY, float fZ, uint8_t uMaterial, Array<3, IndexAndMaterial>& existingVertices); + int32_t addVertex(float fX, float fY, float fZ, uint32_t uMaterial, Array<3, IndexAndMaterial>& existingVertices); bool performQuadMerging(std::list& quads); bool mergeQuads(Quad& q1, Quad& q2); diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl index d347e190..fae71749 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl @@ -95,7 +95,7 @@ namespace PolyVox if((currentVoxelIsSolid != negXVoxelIsSolid) && (finalY == false) && (finalZ == false)) { - int material = (std::max)(currentVoxel.getMaterial(), negXVoxel.getMaterial()); + uint32_t material = (std::max)(currentVoxel.getMaterial(), negXVoxel.getMaterial()); // Check to ensure that when a voxel solid/non-solid change is right on a region border, the vertices are generated on the solid side of the region border if(((currentVoxelIsSolid > negXVoxelIsSolid) && finalX == false) || ((currentVoxelIsSolid < negXVoxelIsSolid) && regX != 0)) @@ -241,7 +241,7 @@ namespace PolyVox } template< template class VolumeType, typename VoxelType> - int32_t CubicSurfaceExtractor::addVertex(float fX, float fY, float fZ, uint8_t uMaterialIn, Array<3, IndexAndMaterial>& existingVertices) + int32_t CubicSurfaceExtractor::addVertex(float fX, float fY, float fZ, uint32_t uMaterialIn, Array<3, IndexAndMaterial>& existingVertices) { uint32_t uX = static_cast(fX + 0.75f); uint32_t uY = static_cast(fY + 0.75f); diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl index f0fff385..732aca9b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl @@ -58,7 +58,7 @@ namespace PolyVox int plusXVoxel = m_volData->getVoxelAt(x+1,y,z).getDensity() >= VoxelType::getThreshold(); if(currentVoxel > plusXVoxel) { - int material = m_volData->getVoxelAt(x,y,z).getMaterial(); + uint32_t material = 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)); diff --git a/library/PolyVoxCore/include/PolyVoxCore/Material.h b/library/PolyVoxCore/include/PolyVoxCore/Material.h index 53d78c08..8f6ff962 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Material.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Material.h @@ -88,6 +88,8 @@ namespace PolyVox }; typedef Material Material8; + typedef Material Material16; + typedef Material Material32; } #endif //__PolyVox_Material_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h b/library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h index 8d1ce04f..656b3e1e 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h +++ b/library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h @@ -77,6 +77,8 @@ namespace PolyVox typedef Density Density8; template class Material; typedef Material Material8; + typedef Material Material16; + typedef Material Material32; template class MaterialDensityPair; typedef MaterialDensityPair MaterialDensityPair44; diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl index e2cad798..f0ae31ac 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl @@ -448,7 +448,7 @@ namespace PolyVox Vector3DFloat v3dNormal = (n100*fInterp) + (n000*(1-fInterp)); v3dNormal.normalise(); - const uint8_t uMaterial = v000.getMaterial() | v100.getMaterial(); //Because one of these is 0, the or operation takes the max. + 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); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); @@ -471,7 +471,7 @@ namespace PolyVox Vector3DFloat v3dNormal = (n010*fInterp) + (n000*(1-fInterp)); v3dNormal.normalise(); - const uint8_t uMaterial = v000.getMaterial() | v010.getMaterial(); //Because one of these is 0, the or operation takes the max. + 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); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); @@ -494,7 +494,7 @@ namespace PolyVox Vector3DFloat v3dNormal = (n001*fInterp) + (n000*(1-fInterp)); v3dNormal.normalise(); - const uint8_t uMaterial = v000.getMaterial() | v001.getMaterial(); //Because one of these is 0, the or operation takes the max. + 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); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);