Browse Source

Merge pull request #1782 from pacomont/Fix_AbstractPolyList_addBox

Fixes AbstractPolyList::addBox(). Complete each face with missing 2nd triangle.
Anis 9 years ago
parent
commit
98b52d1fed
1 changed files with 9 additions and 2 deletions
  1. 9 2
      Engine/source/collision/abstractPolyList.cpp

+ 9 - 2
Engine/source/collision/abstractPolyList.cpp

@@ -56,17 +56,24 @@ void AbstractPolyList::addBox(const Box3F &box, BaseMatInstance* material)
    pos.x += dx; addPoint(pos);
 
    for (S32 i = 0; i < 6; i++) {
-      begin(material, i);
       S32 v1 = base + PolyFace[i][0];
       S32 v2 = base + PolyFace[i][1];
       S32 v3 = base + PolyFace[i][2];
       S32 v4 = base + PolyFace[i][3];
+      // First triangle
+      begin(material, i);
       vertex(v1);
       vertex(v2);
       vertex(v3);
-      vertex(v4);
       plane(v1, v2, v3);
       end();
+      // Second triangle
+      begin(material, i);
+      vertex(v3);
+      vertex(v4);
+      vertex(v1);
+      plane(v3, v4, v1);
+      end();
    }
 }