simplification

This commit is contained in:
Irlan
2018-04-24 22:03:22 -03:00
parent b37d68ad0f
commit 4f27966147

View File

@ -356,17 +356,12 @@ void qhHull::AddVertex(qhVertex* eye)
void qhHull::FindHorizon(qhVertex* eye) void qhHull::FindHorizon(qhVertex* eye)
{ {
// Classify faces // Classify faces
// Reuse new face buffer
u32 visibleCount = 0;
qhFace** visibleFaces = m_newFaces;
for (qhFace* face = m_faceList.head; face != NULL; face = face->next) for (qhFace* face = m_faceList.head; face != NULL; face = face->next)
{ {
float32 d = b3Distance(eye->position, face->plane); float32 d = b3Distance(eye->position, face->plane);
if (d > m_tolerance) if (d > m_tolerance)
{ {
face->state = qhFace::e_visible; face->state = qhFace::e_visible;
visibleFaces[visibleCount++] = face;
} }
else else
{ {
@ -376,9 +371,12 @@ void qhHull::FindHorizon(qhVertex* eye)
// Find the horizon // Find the horizon
m_horizonCount = 0; m_horizonCount = 0;
for (u32 i = 0; i < visibleCount; ++i) for (qhFace* face = m_faceList.head; face != NULL; face = face->next)
{ {
qhFace* face = visibleFaces[i]; if (face->state == qhFace::e_invisible)
{
continue;
}
qhHalfEdge* begin = face->edge; qhHalfEdge* begin = face->edge;
qhHalfEdge* edge = begin; qhHalfEdge* edge = begin;