Templatised SurfaceMesh class on vertex type.

Replaced 'SurfaceVertex' with PositionMaterial and PositionMaterialNormal classes.
Different surface extractors can now work with different vertex types.
This commit is contained in:
David Williams
2010-10-17 21:13:46 +00:00
parent 56ec37f5e2
commit 9e1de4ba72
28 changed files with 460 additions and 176 deletions

View File

@ -30,7 +30,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
SurfaceExtractor<VoxelType>::SurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh* result)
SurfaceExtractor<VoxelType>::SurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
:m_volData(volData)
,m_sampVolume(volData)
,m_regSizeInVoxels(region)
@ -457,7 +457,7 @@ namespace PolyVox
const uint8_t uMaterial = v000.getMaterial() | v100.getMaterial(); //Because one of these is 0, the or operation takes the max.
SurfaceVertex surfaceVertex(v3dPosition, v3dNormal, uMaterial);
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
//surfaceVertex.setOnGeometryEdge(isXEdge || isYEdge || isZEdge);
surfaceVertex.setOnGeometryEdgeNegX(isNegXEdge);
surfaceVertex.setOnGeometryEdgePosX(isPosXEdge);
@ -487,7 +487,7 @@ namespace PolyVox
const uint8_t uMaterial = v000.getMaterial() | v010.getMaterial(); //Because one of these is 0, the or operation takes the max.
SurfaceVertex surfaceVertex(v3dPosition, v3dNormal, uMaterial);
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
//surfaceVertex.setOnGeometryEdge(isXEdge || isYEdge || isZEdge);
surfaceVertex.setOnGeometryEdgeNegX(isNegXEdge);
surfaceVertex.setOnGeometryEdgePosX(isPosXEdge);
@ -517,7 +517,7 @@ namespace PolyVox
const uint8_t uMaterial = v000.getMaterial() | v001.getMaterial(); //Because one of these is 0, the or operation takes the max.
SurfaceVertex surfaceVertex(v3dPosition, v3dNormal, uMaterial);
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, uMaterial);
//surfaceVertex.setOnGeometryEdge(isXEdge || isYEdge || isZEdge);
surfaceVertex.setOnGeometryEdgeNegX(isNegXEdge);
surfaceVertex.setOnGeometryEdgePosX(isPosXEdge);