Skip to content

Commit

Permalink
UPBGE: Fix occlusion culling.
Browse files Browse the repository at this point in the history
This commit fix the vertex reading from triangles in display array.
  • Loading branch information
panzergame committed Nov 15, 2017
1 parent 9d8b2eb commit 8166b30
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1879,10 +1879,9 @@ struct DbvtCullingCallback : btDbvt::ICollide {
const float face = (twoside) ? 0.0f : ((negative) ? -1.0f : 1.0f);

for (unsigned int j = 0, size = array->GetTriangleIndexCount(); j < size; j += 3) {
const unsigned int index = array->GetTriangleIndex(j);
m_ocb->appendOccluderM(array->GetVertex(index).GetXYZ(),
array->GetVertex(index + 1).GetXYZ(),
array->GetVertex(index + 2).GetXYZ(),
m_ocb->appendOccluderM(array->GetVertex(array->GetTriangleIndex(j)).GetXYZ(),
array->GetVertex(array->GetTriangleIndex(j + 1)).GetXYZ(),
array->GetVertex(array->GetTriangleIndex(j + 2)).GetXYZ(),
face);
}
}
Expand Down

0 comments on commit 8166b30

Please sign in to comment.