Removed redundant classes SurfaceEdge, SurfaceTriange, and SurfaceTypes.

Also fixed a new bug in IndexedSurfacePatch
This commit is contained in:
David Williams 2008-04-16 20:46:24 +00:00
parent 2bc1fc2b88
commit 35f9996663
5 changed files with 10 additions and 47 deletions

View File

@ -7,8 +7,6 @@ SET(SRC_FILES
source/MarchingCubesTables.cpp source/MarchingCubesTables.cpp
source/PolyVoxSceneManager.cpp source/PolyVoxSceneManager.cpp
source/RegionGeometry.cpp source/RegionGeometry.cpp
source/SurfaceEdge.cpp
source/SurfaceTriangle.cpp
source/SurfaceVertex.cpp source/SurfaceVertex.cpp
source/Volume.cpp source/Volume.cpp
source/VolumeIterator.cpp source/VolumeIterator.cpp
@ -23,9 +21,6 @@ SET(INC_FILES
include/PolyVoxForwardDeclarations.h include/PolyVoxForwardDeclarations.h
include/PolyVoxSceneManager.h include/PolyVoxSceneManager.h
include/RegionGeometry.h include/RegionGeometry.h
include/SurfaceEdge.h
include/SurfaceTypes.h
include/SurfaceTriangle.h
include/SurfaceVertex.h include/SurfaceVertex.h
include/TypeDef.h include/TypeDef.h
include/Vector.h include/Vector.h

View File

@ -10,9 +10,9 @@ namespace PolyVox
class IntegrealVector3; class IntegrealVector3;
class PolyVoxSceneManager; class PolyVoxSceneManager;
class RegionGeometry; class RegionGeometry;
class SurfaceEdge; //class SurfaceEdge;
class SurfaceTriange; //class SurfaceTriange;
class SurfaceTypes; //class SurfaceTypes;
class SurfaceVertex; class SurfaceVertex;
template <boost::uint32_t Size, typename Type> class Vector; template <boost::uint32_t Size, typename Type> class Vector;
typedef Vector<2,float> Vector2DFloat; typedef Vector<2,float> Vector2DFloat;

View File

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __PolyVox_SurfaceVertex_H__ #ifndef __PolyVox_SurfaceVertex_H__
#define __PolyVox_SurfaceVertex_H__ #define __PolyVox_SurfaceVertex_H__
#include "SurfaceTypes.h"
#include "TypeDef.h" #include "TypeDef.h"
#include "Vector.h" #include "Vector.h"
@ -37,13 +36,11 @@ namespace PolyVox
friend bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs); friend bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs);
float getAlpha(void) const; float getAlpha(void) const;
const SurfaceEdgeIterator& getEdge(void) const;
float getMaterial(void) const; float getMaterial(void) const;
const Vector3DFloat& getNormal(void) const; const Vector3DFloat& getNormal(void) const;
const Vector3DFloat& getPosition(void) const; const Vector3DFloat& getPosition(void) const;
void setAlpha(float alphaToSet); void setAlpha(float alphaToSet);
void setEdge(const SurfaceEdgeIterator& edgeToSet);
void setMaterial(float materialToSet); void setMaterial(float materialToSet);
void setNormal(const Vector3DFloat& normalToSet); void setNormal(const Vector3DFloat& normalToSet);
@ -54,11 +51,7 @@ namespace PolyVox
Vector3DFloat normal; Vector3DFloat normal;
float material; float material;
float alpha; float alpha;
SurfaceEdgeIterator edge;
unsigned long m_uHash;
}; };

View File

@ -1,5 +1,4 @@
#include "IndexedSurfacePatch.h" #include "IndexedSurfacePatch.h"
#include "SurfaceTypes.h"
using namespace boost; using namespace boost;
@ -26,12 +25,12 @@ namespace PolyVox
noOfVerticesSubmitted += 3; noOfVerticesSubmitted += 3;
if(!m_AllowDuplicateVertices) if(!m_AllowDuplicateVertices)
{ {
long int index = vertexIndices[long int(v0.getPosition().x() +0.5)][long int(v0.getPosition().y() +0.5)][long int(v0.getPosition().z() +0.5)]; long int index = vertexIndices[long int(v0.getPosition().x() * 2.0 +0.5)][long int(v0.getPosition().y() * 2.0 +0.5)][long int(v0.getPosition().z() * 2.0 +0.5)];
if(index == -1) if(index == -1)
{ {
m_vecVertices.push_back(v0); m_vecVertices.push_back(v0);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
vertexIndices[long int(v0.getPosition().x() +0.5)][long int(v0.getPosition().y() +0.5)][long int(v0.getPosition().z() +0.5)] = m_vecVertices.size()-1; vertexIndices[long int(v0.getPosition().x() * 2.0 +0.5)][long int(v0.getPosition().y() * 2.0 +0.5)][long int(v0.getPosition().z() * 2.0 +0.5)] = m_vecVertices.size()-1;
noOfVerticesAccepted++; noOfVerticesAccepted++;
} }
@ -40,12 +39,12 @@ namespace PolyVox
m_vecTriangleIndices.push_back(index); m_vecTriangleIndices.push_back(index);
} }
index = vertexIndices[long int(v1.getPosition().x() +0.5)][long int(v1.getPosition().y() +0.5)][long int(v1.getPosition().z() +0.5)]; index = vertexIndices[long int(v1.getPosition().x() * 2.0 +0.5)][long int(v1.getPosition().y() * 2.0 +0.5)][long int(v1.getPosition().z() * 2.0 +0.5)];
if(index == -1) if(index == -1)
{ {
m_vecVertices.push_back(v1); m_vecVertices.push_back(v1);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
vertexIndices[long int(v1.getPosition().x() +0.5)][long int(v1.getPosition().y() +0.5)][long int(v1.getPosition().z() +0.5)] = m_vecVertices.size()-1; vertexIndices[long int(v1.getPosition().x() * 2.0 +0.5)][long int(v1.getPosition().y() * 2.0 +0.5)][long int(v1.getPosition().z() * 2.0 +0.5)] = m_vecVertices.size()-1;
noOfVerticesAccepted++; noOfVerticesAccepted++;
} }
@ -54,12 +53,12 @@ namespace PolyVox
m_vecTriangleIndices.push_back(index); m_vecTriangleIndices.push_back(index);
} }
index = vertexIndices[long int(v2.getPosition().x() +0.5)][long int(v2.getPosition().y() +0.5)][long int(v2.getPosition().z() +0.5)]; index = vertexIndices[long int(v2.getPosition().x() * 2.0 +0.5)][long int(v2.getPosition().y() * 2.0 +0.5)][long int(v2.getPosition().z() * 2.0 +0.5)];
if(index == -1) if(index == -1)
{ {
m_vecVertices.push_back(v2); m_vecVertices.push_back(v2);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
vertexIndices[long int(v2.getPosition().x() +0.5)][long int(v2.getPosition().y() +0.5)][long int(v2.getPosition().z() +0.5)] = m_vecVertices.size()-1; vertexIndices[long int(v2.getPosition().x() * 2.0 +0.5)][long int(v2.getPosition().y() * 2.0 +0.5)][long int(v2.getPosition().z() * 2.0 +0.5)] = m_vecVertices.size()-1;
noOfVerticesAccepted++; noOfVerticesAccepted++;
} }

View File

@ -2,8 +2,6 @@
#include "Constants.h" #include "Constants.h"
#include "SurfaceVertex.h" #include "SurfaceVertex.h"
#include "SurfaceTriangle.h"
#include "SurfaceEdge.h"
namespace PolyVox namespace PolyVox
{ {
@ -15,7 +13,6 @@ namespace PolyVox
:material(materialToSet) :material(materialToSet)
,alpha(alphaToSet) ,alpha(alphaToSet)
,position(positionToSet) ,position(positionToSet)
,m_uHash((position.x()*(POLYVOX_REGION_SIDE_LENGTH*2+1)*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.y()*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.z()))
{ {
} }
@ -24,7 +21,6 @@ namespace PolyVox
:position(positionToSet) :position(positionToSet)
,normal(normalToSet) ,normal(normalToSet)
{ {
m_uHash = (position.x()*(POLYVOX_REGION_SIDE_LENGTH*2+1)*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.y()*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.z());
} }
float SurfaceVertex::getAlpha(void) const float SurfaceVertex::getAlpha(void) const
@ -37,11 +33,6 @@ namespace PolyVox
return material; return material;
} }
const SurfaceEdgeIterator& SurfaceVertex::getEdge(void) const
{
return edge;
}
const Vector3DFloat& SurfaceVertex::getNormal(void) const const Vector3DFloat& SurfaceVertex::getNormal(void) const
{ {
return normal; return normal;
@ -62,11 +53,6 @@ namespace PolyVox
material = materialToSet; material = materialToSet;
} }
void SurfaceVertex::setEdge(const SurfaceEdgeIterator& edgeToSet)
{
edge = edgeToSet;
}
void SurfaceVertex::setNormal(const Vector3DFloat& normalToSet) void SurfaceVertex::setNormal(const Vector3DFloat& normalToSet)
{ {
normal = normalToSet; normal = normalToSet;
@ -78,15 +64,5 @@ namespace PolyVox
std::stringstream ss; std::stringstream ss;
ss << "SurfaceVertex: Position = (" << position.x() << "," << position.y() << "," << position.z() << "), Normal = " << normal; ss << "SurfaceVertex: Position = (" << position.x() << "," << position.y() << "," << position.z() << "), Normal = " << normal;
return ss.str(); return ss.str();
}
bool operator==(const SurfaceVertex& lhs, const SurfaceVertex& rhs)
{
return (lhs.m_uHash == rhs.m_uHash);
}
bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs)
{
return (lhs.m_uHash < rhs.m_uHash);
} }
} }