Skip to content

Commit

Permalink
UPBGE: Fix uninitialized bounding box.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Dec 10, 2017
1 parent 71dcfe6 commit cafd183
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/gameengine/Rasterizer/RAS_BoundingBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ RAS_MeshBoundingBox::RAS_MeshBoundingBox(RAS_BoundingBoxManager *manager, const
:RAS_BoundingBox(manager)
{
for (RAS_IDisplayArray *array : displayArrayList) {
m_slots.push_back({array, {RAS_IDisplayArray::POSITION_MODIFIED, RAS_IDisplayArray::NONE_MODIFIED}});
m_slots.push_back({array, {RAS_IDisplayArray::POSITION_MODIFIED, RAS_IDisplayArray::NONE_MODIFIED},
mt::zero3, mt::zero3});
}

for (DisplayArraySlot& slot : m_slots) {
Expand Down Expand Up @@ -163,6 +164,9 @@ void RAS_MeshBoundingBox::Update(bool force)
}
modified = true;

slot.m_aabbMin = mt::vec3(FLT_MAX);
slot.m_aabbMax = mt::vec3(-FLT_MAX);

// For each vertex.
for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_Vertex vert = array->GetVertex(i);
Expand Down

0 comments on commit cafd183

Please sign in to comment.