--- a/gfx/layers/BSPTree.cpp
+++ b/gfx/layers/BSPTree.cpp
@@ -58,27 +58,28 @@ BSPTree::CalculateDotProduct(const gfx::
const float epsilon = 0.05f;
const gfx::Point3D& normal = aFirst.GetNormal();
const gfx::Point3D& planePoint = aFirst[0];
nsTArray<float> dotProducts;
for (const gfx::Point3D& point : aSecond.GetPoints()) {
- const float dot = (point - planePoint).DotProduct(normal);
- dotProducts.AppendElement(dot);
+ float dot = (point - planePoint).DotProduct(normal);
if (dot > epsilon) {
aPos++;
} else if (dot < -epsilon) {
aNeg++;
} else {
// The point is within the thick plane.
- dotProducts[dotProducts.Length() - 1] = 0.0f;
+ dot = 0.0f;
}
+
+ dotProducts.AppendElement(dot);
}
return dotProducts;
}
void
BSPTree::BuildTree(UniquePtr<BSPTreeNode>& aRoot,
std::deque<gfx::Polygon3D>& aPolygons)