Browse Source

If no Text3D text vertices, set local bounding box to zero sized.

Lasse Öörni 9 years ago
parent
commit
db6b91cd7d
1 changed files with 13 additions and 8 deletions
  1. 13 8
      Source/Urho3D/UI/Text3D.cpp

+ 13 - 8
Source/Urho3D/UI/Text3D.cpp

@@ -606,16 +606,21 @@ void Text3D::UpdateTextBatches()
         break;
         break;
     }
     }
 
 
-    boundingBox_.Clear();
-
-    for (unsigned i = 0; i < uiVertexData_.Size(); i += UI_VERTEX_SIZE)
+    if (uiVertexData_.Size())
     {
     {
-        Vector3& position = *(reinterpret_cast<Vector3*>(&uiVertexData_[i]));
-        position += offset;
-        position *= TEXT_SCALING;
-        position.y_ = -position.y_;
-        boundingBox_.Merge(position);
+        boundingBox_.Clear();
+
+        for (unsigned i = 0; i < uiVertexData_.Size(); i += UI_VERTEX_SIZE)
+        {
+            Vector3& position = *(reinterpret_cast<Vector3*>(&uiVertexData_[i]));
+            position += offset;
+            position *= TEXT_SCALING;
+            position.y_ = -position.y_;
+            boundingBox_.Merge(position);
+        }
     }
     }
+    else
+        boundingBox_.Define(Vector3::ZERO, Vector3::ZERO);
 
 
     textDirty_ = false;
     textDirty_ = false;
     geometryDirty_ = true;
     geometryDirty_ = true;