Cleaning up decimation, moving to sets.
This commit is contained in:
@ -37,8 +37,6 @@ namespace Ogre
|
|||||||
class SurfaceVertex
|
class SurfaceVertex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SurfaceEdgeIterator edge;
|
|
||||||
|
|
||||||
SurfaceVertex();
|
SurfaceVertex();
|
||||||
SurfaceVertex(UIntVector3 positionToSet);
|
SurfaceVertex(UIntVector3 positionToSet);
|
||||||
SurfaceVertex(UIntVector3 positionToSet, Vector3 normalToSet);
|
SurfaceVertex(UIntVector3 positionToSet, Vector3 normalToSet);
|
||||||
@ -46,18 +44,23 @@ namespace Ogre
|
|||||||
friend bool operator==(const SurfaceVertex& lhs, const SurfaceVertex& rhs);
|
friend bool operator==(const SurfaceVertex& lhs, const SurfaceVertex& rhs);
|
||||||
friend bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs);
|
friend bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs);
|
||||||
|
|
||||||
const UIntVector3& getPosition(void) const;
|
float getAlpha(void) const;
|
||||||
|
const SurfaceEdgeIterator& getEdge(void) const;
|
||||||
const Vector3& getNormal(void) const;
|
const Vector3& getNormal(void) const;
|
||||||
void setNormal(const Vector3& normalToSet);
|
const UIntVector3& getPosition(void) const;
|
||||||
|
|
||||||
|
void setAlpha(float alphaToSet);
|
||||||
|
void setEdge(const SurfaceEdgeIterator& edgeToSet);
|
||||||
|
void setNormal(const Vector3& normalToSet);
|
||||||
|
|
||||||
std::string toString(void);
|
std::string toString(void);
|
||||||
float alpha;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UIntVector3 position;
|
UIntVector3 position;
|
||||||
Vector3 normal;
|
Vector3 normal;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
SurfaceEdgeIterator edge;
|
||||||
|
|
||||||
unsigned long m_uHash;
|
unsigned long m_uHash;
|
||||||
};
|
};
|
||||||
|
@ -770,25 +770,25 @@ namespace Ogre
|
|||||||
|
|
||||||
SurfaceVertex surfaceVertex0(vertex0);
|
SurfaceVertex surfaceVertex0(vertex0);
|
||||||
if(material0 == material)
|
if(material0 == material)
|
||||||
surfaceVertex0.alpha = 1.0;
|
surfaceVertex0.setAlpha(1.0);
|
||||||
else
|
else
|
||||||
surfaceVertex0.alpha = 0.0;
|
surfaceVertex0.setAlpha(0.0);
|
||||||
//surfaceVertex0.normal = Vector3(1.0,1.0,1.0);
|
//surfaceVertex0.normal = Vector3(1.0,1.0,1.0);
|
||||||
surfaceVertex0.setNormal(Vector3(0.0,0.0,0.0));
|
surfaceVertex0.setNormal(Vector3(0.0,0.0,0.0));
|
||||||
|
|
||||||
SurfaceVertex surfaceVertex1(vertex1);
|
SurfaceVertex surfaceVertex1(vertex1);
|
||||||
if(material1 == material)
|
if(material1 == material)
|
||||||
surfaceVertex1.alpha = 1.0;
|
surfaceVertex1.setAlpha(1.0);
|
||||||
else
|
else
|
||||||
surfaceVertex1.alpha = 0.0;
|
surfaceVertex1.setAlpha(0.0);
|
||||||
//surfaceVertex1.normal = Vector3(1.0,1.0,1.0);
|
//surfaceVertex1.normal = Vector3(1.0,1.0,1.0);
|
||||||
surfaceVertex1.setNormal(Vector3(0.0,0.0,0.0));
|
surfaceVertex1.setNormal(Vector3(0.0,0.0,0.0));
|
||||||
|
|
||||||
SurfaceVertex surfaceVertex2(vertex2);
|
SurfaceVertex surfaceVertex2(vertex2);
|
||||||
if(material2 == material)
|
if(material2 == material)
|
||||||
surfaceVertex2.alpha = 1.0;
|
surfaceVertex2.setAlpha(1.0);
|
||||||
else
|
else
|
||||||
surfaceVertex2.alpha = 0.0;
|
surfaceVertex2.setAlpha(0.0);
|
||||||
//surfaceVertex2.normal = Vector3(1.0,1.0,1.0);
|
//surfaceVertex2.normal = Vector3(1.0,1.0,1.0);
|
||||||
surfaceVertex2.setNormal(Vector3(0.0,0.0,0.0));
|
surfaceVertex2.setNormal(Vector3(0.0,0.0,0.0));
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ namespace Ogre
|
|||||||
SurfaceEdgeIterator v1v2Iter = findOrAddEdge(v1Iter,v2Iter);
|
SurfaceEdgeIterator v1v2Iter = findOrAddEdge(v1Iter,v2Iter);
|
||||||
SurfaceEdgeIterator v2v0Iter = findOrAddEdge(v2Iter,v0Iter);
|
SurfaceEdgeIterator v2v0Iter = findOrAddEdge(v2Iter,v0Iter);
|
||||||
|
|
||||||
v0Iter->edge = v0v1Iter;
|
v0Iter->setEdge(v0v1Iter);
|
||||||
v1Iter->edge = v1v2Iter;
|
v1Iter->setEdge(v1v2Iter);
|
||||||
v2Iter->edge = v2v0Iter;
|
v2Iter->setEdge(v2v0Iter);
|
||||||
|
|
||||||
v0v1Iter->nextHalfEdge = v1v2Iter;
|
v0v1Iter->nextHalfEdge = v1v2Iter;
|
||||||
v1v2Iter->nextHalfEdge = v2v0Iter;
|
v1v2Iter->nextHalfEdge = v2v0Iter;
|
||||||
@ -345,7 +345,7 @@ namespace Ogre
|
|||||||
std::list<SurfaceVertexIterator> result;
|
std::list<SurfaceVertexIterator> result;
|
||||||
//LogManager::getSingleton().logMessage("findConnectedVertices " + vertexIter->toString());
|
//LogManager::getSingleton().logMessage("findConnectedVertices " + vertexIter->toString());
|
||||||
|
|
||||||
SurfaceEdgeIterator firstEdge = vertexIter->edge;
|
SurfaceEdgeIterator firstEdge = vertexIter->getEdge();
|
||||||
SurfaceEdgeIterator nextEdge = firstEdge;
|
SurfaceEdgeIterator nextEdge = firstEdge;
|
||||||
SurfaceEdgeIterator previousEdge = firstEdge;
|
SurfaceEdgeIterator previousEdge = firstEdge;
|
||||||
int ct = 0;
|
int ct = 0;
|
||||||
|
@ -87,7 +87,7 @@ namespace Ogre
|
|||||||
*prPos++ = verticesToSet[i].getNormal().y;
|
*prPos++ = verticesToSet[i].getNormal().y;
|
||||||
*prPos++ = verticesToSet[i].getNormal().z;
|
*prPos++ = verticesToSet[i].getNormal().z;
|
||||||
|
|
||||||
*prPos++ = verticesToSet[i].alpha;
|
*prPos++ = verticesToSet[i].getAlpha();
|
||||||
|
|
||||||
if(verticesToSet[i].getPosition().x < vaabMin.x)
|
if(verticesToSet[i].getPosition().x < vaabMin.x)
|
||||||
vaabMin.x = verticesToSet[i].getPosition().x;
|
vaabMin.x = verticesToSet[i].getPosition().x;
|
||||||
|
@ -24,9 +24,14 @@ namespace Ogre
|
|||||||
m_uHash = (position.x*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.y*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.z);
|
m_uHash = (position.x*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.y*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
const UIntVector3& SurfaceVertex::getPosition(void) const
|
float SurfaceVertex::getAlpha(void) const
|
||||||
{
|
{
|
||||||
return position;
|
return alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SurfaceEdgeIterator& SurfaceVertex::getEdge(void) const
|
||||||
|
{
|
||||||
|
return edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vector3& SurfaceVertex::getNormal(void) const
|
const Vector3& SurfaceVertex::getNormal(void) const
|
||||||
@ -34,11 +39,26 @@ namespace Ogre
|
|||||||
return normal;
|
return normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UIntVector3& SurfaceVertex::getPosition(void) const
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurfaceVertex::setAlpha(float alphaToSet)
|
||||||
|
{
|
||||||
|
alpha = alphaToSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurfaceVertex::setEdge(const SurfaceEdgeIterator& edgeToSet)
|
||||||
|
{
|
||||||
|
edge = edgeToSet;
|
||||||
|
}
|
||||||
|
|
||||||
void SurfaceVertex::setNormal(const Vector3& normalToSet)
|
void SurfaceVertex::setNormal(const Vector3& normalToSet)
|
||||||
{
|
{
|
||||||
normal = normalToSet;
|
normal = normalToSet;
|
||||||
normal.normalise();
|
normal.normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SurfaceVertex::toString(void)
|
std::string SurfaceVertex::toString(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user