Explorar o código

Prevent Mesh from generating bounding boxes with 0 width

Ivan Safrin %!s(int64=11) %!d(string=hai) anos
pai
achega
d6771c9d8f
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      Core/Contents/Source/PolyMesh.cpp

+ 10 - 0
Core/Contents/Source/PolyMesh.cpp

@@ -537,6 +537,16 @@ Vector3 Mesh::calculateBBox() {
         retVec.z = max(retVec.z,fabs(vertices[i]->z));
     }
     
+    if(retVec.x == 0.0) {
+        retVec.x = 0.001;
+    }
+    if(retVec.y == 0.0) {
+        retVec.y = 0.001;
+    }
+    if(retVec.z == 0.0) {
+        retVec.z = 0.001;
+    }
+
     return retVec*2;
 }