diff --git a/include/SurfaceEdge.h b/include/SurfaceEdge.h index ad3c9338..3b71318f 100644 --- a/include/SurfaceEdge.h +++ b/include/SurfaceEdge.h @@ -54,7 +54,7 @@ namespace Ogre }; bool operator == (const SurfaceEdge& lhs, const SurfaceEdge& rhs); - bool operator < (const SurfaceEdge& lhs, const SurfaceEdge& rhs); + //bool operator < (const SurfaceEdge& lhs, const SurfaceEdge& rhs); } #endif diff --git a/include/SurfaceTriangle.h b/include/SurfaceTriangle.h index 5862f188..efef88cc 100644 --- a/include/SurfaceTriangle.h +++ b/include/SurfaceTriangle.h @@ -43,7 +43,7 @@ namespace Ogre }; bool operator == (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs); - bool operator < (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs); + //bool operator < (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs); //bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs); } diff --git a/include/SurfaceVertex.h b/include/SurfaceVertex.h index f7ceeb0d..8acde5de 100644 --- a/include/SurfaceVertex.h +++ b/include/SurfaceVertex.h @@ -43,7 +43,7 @@ namespace Ogre //uchar flags; //uchar noOfUses; - bool fixed; + //bool fixed; SurfaceEdgeIterator edge; @@ -57,7 +57,7 @@ namespace Ogre }; bool operator==(const SurfaceVertex& lhs, const SurfaceVertex& rhs); - bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs); + //bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs); //bool operator < (const SurfaceVertexIterator& lhs, const SurfaceVertexIterator& rhs); diff --git a/source/SurfaceEdge.cpp b/source/SurfaceEdge.cpp index c302e9ab..727c1595 100644 --- a/source/SurfaceEdge.cpp +++ b/source/SurfaceEdge.cpp @@ -22,11 +22,11 @@ namespace Ogre ( (lhs.target == rhs.target) && //(lhs.triangle == rhs.triangle) - (lhs.otherHalfEdge->target == rhs.otherHalfEdge->target) + (lhs.otherHalfEdge == rhs.otherHalfEdge) ); } - bool operator < (const SurfaceEdge& lhs, const SurfaceEdge& rhs) + /*bool operator < (const SurfaceEdge& lhs, const SurfaceEdge& rhs) { if(lhs.target == rhs.target) { @@ -37,5 +37,5 @@ namespace Ogre return (*(lhs.otherHalfEdge->target) < *(rhs.otherHalfEdge->target)); } return (*(lhs.target) < *(rhs.target)); - } + }*/ } diff --git a/source/SurfacePatch.cpp b/source/SurfacePatch.cpp index 8755c3f8..e37c6d81 100644 --- a/source/SurfacePatch.cpp +++ b/source/SurfacePatch.cpp @@ -47,17 +47,17 @@ namespace Ogre void SurfacePatch::addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2) { - if(v0.position.x > 8) + if(v0.position.x > 16) return; - if(v0.position.y > 8) + if(v0.position.y > 16) return; - if(v1.position.x > 8) + if(v1.position.x > 16) return; - if(v1.position.y > 8) + if(v1.position.y > 16) return; - if(v2.position.x > 8) + if(v2.position.x > 16) return; - if(v2.position.y > 8) + if(v2.position.y > 16) return; @@ -377,14 +377,21 @@ namespace Ogre SurfaceVertexIterator firstVertex = firstEdge->target; SurfaceEdgeIterator nextEdge = firstEdge; + int ct = 0; do { + ct++; + LogManager::getSingleton().logMessage("ct = " + StringConverter::toString(ct)); + if(ct > 100) + { + exit(1); + } if(nextEdge->hasTriangle == false) { break; } listConnectedVertices.push_back(nextEdge->target); - nextEdge = nextEdge->nextHalfEdge->nextHalfEdge->otherHalfEdge; + nextEdge = nextEdge->previousHalfEdge->otherHalfEdge; }while((nextEdge != firstEdge) && (nextEdge != m_listEdges.end())); if(nextEdge->hasTriangle == false) diff --git a/source/SurfaceTriangle.cpp b/source/SurfaceTriangle.cpp index c70e6409..3e2a7bc8 100644 --- a/source/SurfaceTriangle.cpp +++ b/source/SurfaceTriangle.cpp @@ -34,38 +34,17 @@ namespace Ogre }*/ bool operator == (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs) - { - /*return - ( - (lhs.v0 == rhs.v0) && - (lhs.v1 == rhs.v1) && - (lhs.v2 == rhs.v2) - );*/ + { + return lhs.edge == rhs.edge; + } - return lhs.edge == rhs.edge; - } + /*bool operator < (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs) + { + return (*lhs.edge < *rhs.edge); + }*/ - bool operator < (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs) - { - /*if(lhs.v0 == rhs.v0) - { - if(lhs.v1 == rhs.v1) - { - if(lhs.v2 == rhs.v2) - { - return false; - } - return (*(lhs.v2) < *(rhs.v2)); - } - return (*(lhs.v1) < *(rhs.v1)); - } - return (*(lhs.v0) < *(rhs.v0));*/ - - return (*lhs.edge < *rhs.edge); - } - - /*bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs) - { - return (*lhs) < (*rhs); - }*/ + /*bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs) + { + return (*lhs) < (*rhs); + }*/ } diff --git a/source/SurfaceVertex.cpp b/source/SurfaceVertex.cpp index fb5a7785..e722d2db 100644 --- a/source/SurfaceVertex.cpp +++ b/source/SurfaceVertex.cpp @@ -90,56 +90,11 @@ namespace Ogre return (lhsOffset == rhsOffset) /*&& (abs(lhs.alpha - rhs.alpha) <= 0.01)*/; } - bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs) + /*bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs) { - /*if((*this) == rhs) - { - return false; - } - if(alpha < rhs.alpha) - { - return true; - }*/ - /*if(position.z < rhs.position.z) - { - return true; - } - if(position.y < rhs.position.y) - { - return true; - } - if(position.x < rhs.position.x) - { - return true; - } - - return false;*/ - - /*ulong value = 0; - value |= position.x; - value << 10; - value |= position.y; - value << 10; - value |= position.z; - - ulong rhsValue = 0; - rhsValue |= rhs.position.x; - rhsValue << 10; - rhsValue |= rhs.position.y; - rhsValue << 10; - rhsValue |= rhs.position.z; - - return value < rhsValue;*/ - unsigned long lhsOffset = (lhs.position.x*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (lhs.position.y*(OGRE_REGION_SIDE_LENGTH*2+1)) + (lhs.position.z); unsigned long rhsOffset = (rhs.position.x*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (rhs.position.y*(OGRE_REGION_SIDE_LENGTH*2+1)) + (rhs.position.z); - return lhsOffset < rhsOffset; - - /*if(lhsOffset == rhsOffset) - { - return (lhs.alpha < rhs.alpha); - } - return (lhsOffset < rhsOffset)*/; - } + return lhsOffset < rhsOffset; + }*/ }