Work on mesh decimation.
This commit is contained in:
parent
32204b483f
commit
152a79eaa9
@ -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);
|
//bool operator < (const SurfaceEdge& lhs, const SurfaceEdge& rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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 SurfaceTriangle& lhs, const SurfaceTriangle& rhs);
|
||||||
|
|
||||||
//bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs);
|
//bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace Ogre
|
|||||||
//uchar flags;
|
//uchar flags;
|
||||||
//uchar noOfUses;
|
//uchar noOfUses;
|
||||||
|
|
||||||
bool fixed;
|
//bool fixed;
|
||||||
|
|
||||||
SurfaceEdgeIterator edge;
|
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 SurfaceVertex& lhs, const SurfaceVertex& rhs);
|
||||||
|
|
||||||
|
|
||||||
//bool operator < (const SurfaceVertexIterator& lhs, const SurfaceVertexIterator& rhs);
|
//bool operator < (const SurfaceVertexIterator& lhs, const SurfaceVertexIterator& rhs);
|
||||||
|
@ -22,11 +22,11 @@ namespace Ogre
|
|||||||
(
|
(
|
||||||
(lhs.target == rhs.target) &&
|
(lhs.target == rhs.target) &&
|
||||||
//(lhs.triangle == rhs.triangle)
|
//(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)
|
if(lhs.target == rhs.target)
|
||||||
{
|
{
|
||||||
@ -37,5 +37,5 @@ namespace Ogre
|
|||||||
return (*(lhs.otherHalfEdge->target) < *(rhs.otherHalfEdge->target));
|
return (*(lhs.otherHalfEdge->target) < *(rhs.otherHalfEdge->target));
|
||||||
}
|
}
|
||||||
return (*(lhs.target) < *(rhs.target));
|
return (*(lhs.target) < *(rhs.target));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -47,17 +47,17 @@ namespace Ogre
|
|||||||
|
|
||||||
void SurfacePatch::addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2)
|
void SurfacePatch::addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2)
|
||||||
{
|
{
|
||||||
if(v0.position.x > 8)
|
if(v0.position.x > 16)
|
||||||
return;
|
return;
|
||||||
if(v0.position.y > 8)
|
if(v0.position.y > 16)
|
||||||
return;
|
return;
|
||||||
if(v1.position.x > 8)
|
if(v1.position.x > 16)
|
||||||
return;
|
return;
|
||||||
if(v1.position.y > 8)
|
if(v1.position.y > 16)
|
||||||
return;
|
return;
|
||||||
if(v2.position.x > 8)
|
if(v2.position.x > 16)
|
||||||
return;
|
return;
|
||||||
if(v2.position.y > 8)
|
if(v2.position.y > 16)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -377,14 +377,21 @@ namespace Ogre
|
|||||||
SurfaceVertexIterator firstVertex = firstEdge->target;
|
SurfaceVertexIterator firstVertex = firstEdge->target;
|
||||||
|
|
||||||
SurfaceEdgeIterator nextEdge = firstEdge;
|
SurfaceEdgeIterator nextEdge = firstEdge;
|
||||||
|
int ct = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
ct++;
|
||||||
|
LogManager::getSingleton().logMessage("ct = " + StringConverter::toString(ct));
|
||||||
|
if(ct > 100)
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if(nextEdge->hasTriangle == false)
|
if(nextEdge->hasTriangle == false)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
listConnectedVertices.push_back(nextEdge->target);
|
listConnectedVertices.push_back(nextEdge->target);
|
||||||
nextEdge = nextEdge->nextHalfEdge->nextHalfEdge->otherHalfEdge;
|
nextEdge = nextEdge->previousHalfEdge->otherHalfEdge;
|
||||||
}while((nextEdge != firstEdge) && (nextEdge != m_listEdges.end()));
|
}while((nextEdge != firstEdge) && (nextEdge != m_listEdges.end()));
|
||||||
|
|
||||||
if(nextEdge->hasTriangle == false)
|
if(nextEdge->hasTriangle == false)
|
||||||
|
@ -34,38 +34,17 @@ namespace Ogre
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
bool operator == (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs)
|
bool operator == (const SurfaceTriangle& lhs, const SurfaceTriangle& rhs)
|
||||||
{
|
{
|
||||||
/*return
|
return lhs.edge == rhs.edge;
|
||||||
(
|
}
|
||||||
(lhs.v0 == rhs.v0) &&
|
|
||||||
(lhs.v1 == rhs.v1) &&
|
|
||||||
(lhs.v2 == rhs.v2)
|
|
||||||
);*/
|
|
||||||
|
|
||||||
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)
|
/*bool operator < (const SurfaceTriangleIterator& lhs, const SurfaceTriangleIterator& rhs)
|
||||||
{
|
{
|
||||||
/*if(lhs.v0 == rhs.v0)
|
return (*lhs) < (*rhs);
|
||||||
{
|
}*/
|
||||||
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);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
@ -90,56 +90,11 @@ namespace Ogre
|
|||||||
return (lhsOffset == rhsOffset) /*&& (abs(lhs.alpha - rhs.alpha) <= 0.01)*/;
|
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 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);
|
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;
|
return lhsOffset < rhsOffset;
|
||||||
|
}*/
|
||||||
/*if(lhsOffset == rhsOffset)
|
|
||||||
{
|
|
||||||
return (lhs.alpha < rhs.alpha);
|
|
||||||
}
|
|
||||||
return (lhsOffset < rhsOffset)*/;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user