Working version of mesh decimation code which acts directly on vertex/index buffers.

Also initial work on a 'dynamic' mesh for simplification... but this probably won't be needed now.
This commit is contained in:
David Williams
2010-02-02 23:18:17 +00:00
parent 5c8dd011e7
commit 89c48cdc27
16 changed files with 1445 additions and 24 deletions

View File

@ -36,7 +36,6 @@ namespace PolyVox
SurfaceVertex::SurfaceVertex(Vector3DFloat positionToSet, float materialToSet)
:position(positionToSet)
,material(materialToSet)
,m_bIsMaterialEdgeVertex(false)
{
}
@ -45,7 +44,6 @@ namespace PolyVox
:position(positionToSet)
,normal(normalToSet)
,material(materialToSet)
,m_bIsMaterialEdgeVertex(false)
{
}
@ -64,14 +62,34 @@ namespace PolyVox
return position;
}
bool SurfaceVertex::isEdgeVertex(void) const
bool SurfaceVertex::isOnEdge(void) const
{
return m_bIsEdgeVertex;
return (isOnMaterialEdge() || isOnGeometryEdge());
}
void SurfaceVertex::setEdgeVertex(bool isEdgeVertex)
bool SurfaceVertex::isOnMaterialEdge(void) const
{
m_bIsEdgeVertex = isEdgeVertex;
return m_bFlags[VF_ON_MATERIAL_EDGE];
}
bool SurfaceVertex::isOnGeometryEdge(void) const
{
return m_bFlags[VF_ON_GEOMETRY_EDGE_X] || m_bFlags[VF_ON_GEOMETRY_EDGE_Y] || m_bFlags[VF_ON_GEOMETRY_EDGE_Z];
}
bool SurfaceVertex::isOnGeometryEdgeX(void) const
{
return m_bFlags[VF_ON_GEOMETRY_EDGE_X];
}
bool SurfaceVertex::isOnGeometryEdgeY(void) const
{
return m_bFlags[VF_ON_GEOMETRY_EDGE_Y];
}
bool SurfaceVertex::isOnGeometryEdgeZ(void) const
{
return m_bFlags[VF_ON_GEOMETRY_EDGE_Z];
}
void SurfaceVertex::setMaterial(float materialToSet)
@ -84,6 +102,26 @@ namespace PolyVox
normal = normalToSet;
}
void SurfaceVertex::setOnMaterialEdge(bool bOnMaterialEdge)
{
m_bFlags[VF_ON_MATERIAL_EDGE] = bOnMaterialEdge;
}
void SurfaceVertex::setOnGeometryEdgeX(bool bOnRegionEdge)
{
m_bFlags[VF_ON_GEOMETRY_EDGE_X] = bOnRegionEdge;
}
void SurfaceVertex::setOnGeometryEdgeY(bool bOnRegionEdge)
{
m_bFlags[VF_ON_GEOMETRY_EDGE_Y] = bOnRegionEdge;
}
void SurfaceVertex::setOnGeometryEdgeZ(bool bOnRegionEdge)
{
m_bFlags[VF_ON_GEOMETRY_EDGE_Z] = bOnRegionEdge;
}
void SurfaceVertex::setPosition(const Vector3DFloat& positionToSet)
{
position = positionToSet;