ソースを参照

Optimize vector/quaternion Normalize() to a no-op if already at unit length. Changed return value to void.
Optimize cache friendliness of Drawable bounding box update by including the local-space bounding box in the base class. Not used in all subclasses.
Optimize Drawable zone handling by making the zone pointers raw pointers instead of weak. Now finding a drawable's zone can be performed in the threaded view preparation phase.
Removed unnecessary collection of whole visible scene bounding box; it is not used anywhere.

Lasse Öörni 12 年 前
コミット
caf0994b8f

+ 14 - 7
Docs/ScriptAPI.dox

@@ -355,7 +355,7 @@ Properties:<br>
 Vector2
 
 Methods:<br>
-- float Normalize()
+- void Normalize()
 - float DotProduct(const Vector2&) const
 - float AbsDotProduct(const Vector2&) const
 - Vector2 Lerp(const Vector2&, float) const
@@ -374,7 +374,7 @@ Properties:<br>
 Vector3
 
 Methods:<br>
-- float Normalize()
+- void Normalize()
 - float DotProduct(const Vector3&) const
 - float AbsDotProduct(const Vector3&) const
 - Vector3 CrossProduct(const Vector3&) const
@@ -2221,6 +2221,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 
 
@@ -2290,6 +2291,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - LightType lightType
 - bool perVertex
@@ -2356,8 +2358,8 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
-- BoundingBox worldBoundingBox (readonly)
 - BoundingBox boundingBox
+- BoundingBox worldBoundingBox (readonly)
 - Matrix3x4 inverseWorldTransform (readonly)
 - Color ambientColor
 - Color ambientStartColor (readonly)
@@ -2417,11 +2419,11 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Model@ model
 - Material@ material (writeonly)
 - Material@[] materials
-- BoundingBox boundingBox (readonly)
 - uint numGeometries (readonly)
 - uint occlusionLodLevel
 
@@ -2471,11 +2473,11 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Model@ model
 - Material@ material (writeonly)
 - Material@[] materials
-- BoundingBox boundingBox (readonly)
 - uint numGeometries (readonly)
 - Zone@ zone (readonly)
 
@@ -2565,11 +2567,11 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Model@ model
 - Material@ material (writeonly)
 - Material@[] materials
-- BoundingBox boundingBox (readonly)
 - uint numGeometries (readonly)
 - Zone@ zone (readonly)
 - float animationLodBias
@@ -2700,6 +2702,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Material@ material
 - uint numBillboards
@@ -2773,6 +2776,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Material@ material
 - bool relative
@@ -2870,10 +2874,10 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Material@ material (writeonly)
 - Material@[] materials
-- BoundingBox boundingBox (readonly)
 - uint numGeometries
 - Zone@ zone (readonly)
 
@@ -2926,6 +2930,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Material@ material
 - uint numDecals (readonly)
@@ -2981,6 +2986,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 
 
@@ -4959,6 +4965,7 @@ Properties:<br>
 - uint shadowMask
 - uint zoneMask
 - uint maxLights
+- BoundingBox boundingBox (readonly)
 - BoundingBox worldBoundingBox (readonly)
 - Font@ font (readonly)
 - int fontSize (readonly)

+ 0 - 4
Source/Engine/Graphics/CustomGeometry.h

@@ -89,8 +89,6 @@ public:
     /// Set material on one geometry. Return true if successful.
     bool SetMaterial(unsigned index, Material* material);
     
-    /// Return local space bounding box.
-    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return number of geometries.
     unsigned GetNumGeometries() const { return geometries_.Size(); }
     /// Return material by geometry index.
@@ -110,8 +108,6 @@ protected:
     virtual void OnWorldBoundingBoxUpdate();
     
 private:
-    /// Local-space bounding box.
-    BoundingBox boundingBox_;
     /// Primitive type per geometry.
     PODVector<PrimitiveType> primitiveTypes_;
     /// Source vertices per geometry.

+ 3 - 12
Source/Engine/Graphics/Drawable.cpp

@@ -80,6 +80,8 @@ Drawable::Drawable(Context* context, unsigned char drawableFlags) :
     maxLights_(0),
     octant_(0),
     firstLight_(0),
+    zone_(0),
+    lastZone_(0),
     viewFrame_(0),
     viewCamera_(0),
     zoneDirty_(false)
@@ -337,16 +339,6 @@ void Drawable::LimitVertexLights()
     vertexLights_.Resize(MAX_VERTEX_LIGHTS);
 }
 
-Zone* Drawable::GetZone() const
-{
-    return zone_;
-}
-
-Zone* Drawable::GetLastZone() const
-{
-    return lastZone_;
-}
-
 void Drawable::OnNodeSet(Node* node)
 {
     if (node)
@@ -364,8 +356,7 @@ void Drawable::OnMarkedDirty(Node* node)
     if (!reinsertionQueued_ && octant_)
         octant_->GetRoot()->QueueReinsertion(this);
 
-    // Mark zone assignment dirty. Due to possibly being called from a worker thread, it is unsafe to manipulate the Zone weak
-    // pointer here
+    // Mark zone assignment dirty
     if (node == node_)
         zoneDirty_ = true;
 }

+ 10 - 6
Source/Engine/Graphics/Drawable.h

@@ -162,6 +162,8 @@ public:
     /// Mark for update before octree reinsertion.
     void MarkForUpdate();
     
+    /// Return local space bounding box. May not be applicable or properly updated on all drawables.
+    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return world-space bounding box.
     const BoundingBox& GetWorldBoundingBox();
     /// Return drawable flags.
@@ -191,7 +193,7 @@ public:
     /// Return draw call source data.
     const Vector<SourceBatch>& GetBatches() const { return batches_; }
     
-    /// Set new zone.
+    /// Set new zone. Zone assignment may optionally be temporary, meaning it needs to be re-evaluated on the next frame.
     void SetZone(Zone* zone, bool temporary = false);
     /// Set sorting value.
     void SetSortValue(float value);
@@ -214,9 +216,9 @@ public:
     /// Return octree octant.
     Octant* GetOctant() const { return octant_; }
     /// Return current zone.
-    Zone* GetZone() const;
+    Zone* GetZone() const { return zone_; }
     /// Return previous zone.
-    Zone* GetLastZone() const;
+    Zone* GetLastZone() const { return lastZone_; }
     /// Return if zone assignment needs re-evaluation.
     bool IsZoneDirty() const { return zoneDirty_; }
     /// Return distance from camera.
@@ -256,8 +258,10 @@ protected:
     /// Move into another octree octant.
     void SetOctant(Octant* octant) { octant_ = octant; }
     
-    /// World bounding box.
+    /// World-space bounding box.
     BoundingBox worldBoundingBox_;
+    /// Local-space bounding box.
+    BoundingBox boundingBox_;
     /// Draw call source data.
     Vector<SourceBatch> batches_;
     /// Drawable flags.
@@ -313,9 +317,9 @@ protected:
     /// Per-vertex lights affecting this drawable.
     PODVector<Light*> vertexLights_;
     /// Current zone.
-    WeakPtr<Zone> zone_;
+    Zone* zone_;
     /// Previous zone.
-    WeakPtr<Zone> lastZone_;
+    Zone* lastZone_;
     /// Last view's frameinfo. Not safe to dereference.
     const FrameInfo* viewFrame_;
     /// Last view's camera. Not safe to dereference.

+ 0 - 4
Source/Engine/Graphics/StaticModel.h

@@ -73,8 +73,6 @@ public:
     
     /// Return model.
     Model* GetModel() const { return model_; }
-    /// Return model's bounding box.
-    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return number of geometries.
     unsigned GetNumGeometries() const { return geometries_.Size(); }
     /// Return material by geometry index.
@@ -107,8 +105,6 @@ protected:
     /// Choose LOD levels based on distance.
     void CalculateLodLevels();
     
-    /// Local-space bounding box.
-    BoundingBox boundingBox_;
     /// Extra per-geometry data.
     PODVector<StaticModelGeometryData> geometryData_;
     /// All geometries.

+ 0 - 4
Source/Engine/Graphics/TerrainPatch.h

@@ -94,8 +94,6 @@ public:
     TerrainPatch* GetEastPatch() const { return east_; }
     /// Return geometrical error array.
     PODVector<float>& GetLodErrors() { return lodErrors_; }
-    /// Return local-space bounding box.
-    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return patch coordinates.
     const IntVector2& GetCoordinates() const { return coordinates_; }
     /// Return current LOD level.
@@ -131,8 +129,6 @@ private:
     WeakPtr<TerrainPatch> east_;
     /// Geometrical error per LOD level.
     PODVector<float> lodErrors_;
-    /// Local-space bounding box.
-    BoundingBox boundingBox_;
     /// Patch coordinates in the terrain. (0,0) is the northwest corner.
     IntVector2 coordinates_;
     /// Current LOD level.

+ 14 - 20
Source/Engine/Graphics/View.cpp

@@ -174,22 +174,28 @@ void CheckVisibilityWork(const WorkItem* item, unsigned threadIndex)
     const Matrix3x4& viewMatrix = view->camera_->GetView();
     Vector3 viewZ = Vector3(viewMatrix.m20_, viewMatrix.m21_, viewMatrix.m22_);
     Vector3 absViewZ = viewZ.Abs();
+    unsigned cameraViewMask = view->camera_->GetViewMask();
+    bool cameraZoneOverride = view->cameraZoneOverride_;
     
     while (start != end)
     {
         Drawable* drawable = *start++;
-        drawable->UpdateBatches(view->frame_);
         
         // If draw distance non-zero, check it
         float maxDistance = drawable->GetDrawDistance();
         if ((maxDistance <= 0.0f || drawable->GetDistance() <= maxDistance) && (!buffer || !drawable->IsOccludee() ||
             buffer->IsVisible(drawable->GetWorldBoundingBox())))
         {
+            drawable->UpdateBatches(view->frame_);
             drawable->MarkInView(view->frame_);
             
-            // For geometries, clear lights and calculate view space Z range
+            // For geometries, find zone, clear lights and calculate view space Z range
             if (drawable->GetDrawableFlags() & DRAWABLE_GEOMETRY)
             {
+                Zone* drawableZone = drawable->GetZone();
+                if ((!drawableZone || (drawableZone->GetViewMask() & cameraViewMask) == 0) && !cameraZoneOverride)
+                    view->FindZone(drawable);
+                
                 const BoundingBox& geomBox = drawable->GetWorldBoundingBox();
                 Vector3 center = geomBox.Center();
                 float viewCenterZ = viewZ.DotProduct(center) + viewMatrix.m23_;
@@ -662,14 +668,10 @@ void View::GetDrawables()
         queue->Complete(M_MAX_UNSIGNED);
     }
     
-    // Sort into geometries & lights, and build visible scene bounding boxes in world and view space
-    sceneBox_.min_ = sceneBox_.max_ = Vector3::ZERO;
-    sceneBox_.defined_ = false;
+    // Sort into geometries & lights, and build scene Z range
     minZ_ = M_INFINITY;
     maxZ_ = 0.0f;
     
-    unsigned cameraViewMask = camera_->GetViewMask();
-    
     for (unsigned i = 0; i < tempDrawables.Size(); ++i)
     {
         Drawable* drawable = tempDrawables[i];
@@ -678,15 +680,9 @@ void View::GetDrawables()
         
         if (drawable->GetDrawableFlags() & DRAWABLE_GEOMETRY)
         {
-            // Find zone for the drawable if necessary
-            Zone* drawableZone = drawable->GetZone();
-            if ((drawable->IsZoneDirty() || !drawableZone || (drawableZone->GetViewMask() & cameraViewMask) == 0) && !cameraZoneOverride_)
-                FindZone(drawable);
-            
             // Expand the scene bounding box and Z range (skybox not included because of infinite size) and store the drawawble
             if (drawable->GetType() != Skybox::GetTypeStatic())
             {
-                sceneBox_.Merge(drawable->GetWorldBoundingBox());
                 minZ_ = Min(minZ_, drawable->GetMinZ());
                 maxZ_ = Max(maxZ_, drawable->GetMaxZ());
             }
@@ -1884,21 +1880,19 @@ void View::ProcessShadowCasters(LightQueryResult& query, const PODVector<Drawabl
        // For point light, check that this drawable is inside the split shadow camera frustum
         if (type == LIGHT_POINT && shadowCameraFrustum.IsInsideFast(drawable->GetWorldBoundingBox()) == OUTSIDE)
             continue;
-        
-        // Note: as lights are processed threaded, it is possible a drawable's UpdateBatches() function is called several
-        // times. However, this should not cause problems as no scene modification happens at this point.
-        if (!drawable->IsInView(frame_, false))
-            drawable->UpdateBatches(frame_);
-        
         // Check shadow distance
         float maxShadowDistance = drawable->GetShadowDistance();
         float drawDistance = drawable->GetDrawDistance();
         if (drawDistance > 0.0f && (maxShadowDistance <= 0.0f || drawDistance < maxShadowDistance))
             maxShadowDistance = drawDistance;
-        
         if (maxShadowDistance > 0.0f && drawable->GetDistance() > maxShadowDistance)
             continue;
         
+        // Note: as lights are processed threaded, it is possible a drawable's UpdateBatches() function is called several
+        // times. However, this should not cause problems as no scene modification happens at this point.
+        if (!drawable->IsInView(frame_, false))
+            drawable->UpdateBatches(frame_);
+        
         // Project shadow caster bounding box to light view space for visibility check
         lightViewBox = drawable->GetWorldBoundingBox().Transformed(lightView);
         

+ 0 - 2
Source/Engine/Graphics/View.h

@@ -230,8 +230,6 @@ private:
     IntVector2 rtSize_;
     /// Information of the frame being rendered.
     FrameInfo frame_;
-    /// Combined bounding box of visible geometries.
-    BoundingBox sceneBox_;
     /// Write screenbuffer index.
     unsigned writeBuffer_;
     /// Read screenbuffer index.

+ 7 - 3
Source/Engine/Graphics/Zone.cpp

@@ -47,17 +47,18 @@ Zone::Zone(Context* context) :
     inverseWorldDirty_(true),
     override_(false),
     ambientGradient_(false),
-    boundingBox_(DEFAULT_BOUNDING_BOX_MIN, DEFAULT_BOUNDING_BOX_MAX),
     ambientColor_(DEFAULT_AMBIENT_COLOR),
     fogColor_(DEFAULT_FOG_COLOR),
     fogStart_(DEFAULT_FOG_START),
     fogEnd_(DEFAULT_FOG_END),
     priority_(0)
 {
+    boundingBox_ = BoundingBox(DEFAULT_BOUNDING_BOX_MIN, DEFAULT_BOUNDING_BOX_MAX);
 }
 
 Zone::~Zone()
 {
+    /// \todo When zone is destroyed, there is now possibility of dangling zone pointers
 }
 
 void Zone::RegisterObject(Context* context)
@@ -224,8 +225,11 @@ void Zone::OnMarkedDirty(Node* node)
             Drawable* drawable = *i;
             unsigned drawableFlags = drawable->GetDrawableFlags();
             if (drawableFlags & DRAWABLE_GEOMETRY)
-                (*i)->SetZone(0);
-            if (drawableFlags & DRAWABLE_ZONE)
+            {
+                if (drawable->GetZone() == this)
+                    drawable->SetZone(0);
+            }
+            else if (drawableFlags & DRAWABLE_ZONE)
             {
                 Zone* zone = static_cast<Zone*>(drawable);
                 zone->lastAmbientStartZone_.Reset();

+ 0 - 4
Source/Engine/Graphics/Zone.h

@@ -65,8 +65,6 @@ public:
     /// Set ambient gradient mode. In gradient mode ambient color is interpolated from neighbor zones.
     void SetAmbientGradient(bool enable);
     
-    /// Return bounding box.
-    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
     /// Return inverse world transform.
     const Matrix3x4& GetInverseWorldTransform() const;
     /// Return zone's own ambient color, disregarding gradient mode.
@@ -107,8 +105,6 @@ protected:
     bool override_;
     /// Ambient gradient mode flag.
     bool ambientGradient_;
-    /// Local-space bounding box.
-    BoundingBox boundingBox_;
     /// Last world-space bounding box.
     BoundingBox lastWorldBoundingBox_;
     /// Ambient color.

+ 17 - 10
Source/Engine/Math/Quaternion.h

@@ -172,24 +172,31 @@ public:
     /// Define from a rotation matrix.
     void FromRotationMatrix(const Matrix3& matrix);
     
-    /// Normalize to unit length and return the previous length.
-    float Normalize()
+    /// Normalize to unit length.
+    void Normalize()
     {
-        float len = sqrtf(LengthSquared());
-        if (len >= M_EPSILON)
-            *this *= (1.0f / len);
-
-        return len;
+        float lenSquared = LengthSquared();
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
+        {
+            float invLen = 1.0f / sqrtf(lenSquared);
+            w_ *= invLen;
+            x_ *= invLen;
+            y_ *= invLen;
+            z_ *= invLen;
+        }
     }
     
     /// Return normalized to unit length.
     Quaternion Normalized() const
     {
         float lenSquared = LengthSquared();
-        if (lenSquared >= M_EPSILON * M_EPSILON)
-            return *this * (1.0f / sqrtf(lenSquared));
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
+        {
+            float invLen = 1.0f / sqrtf(lenSquared);
+            return *this * invLen;
+        }
         else
-            return IDENTITY;
+            return *this;
     }
     
     /// Return inverse.

+ 11 - 10
Source/Engine/Math/Vector2.h

@@ -134,18 +134,16 @@ public:
         return *this;
     }
     
-    /// Normalize to unit length and return the previous length.
-    float Normalize()
+    /// Normalize to unit length.
+    void Normalize()
     {
-        float len = Length();
-        if (len >= M_EPSILON)
+        float lenSquared = LengthSquared();
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
         {
-            float invLen = 1.0f / len;
+            float invLen = 1.0f / sqrtf(lenSquared);
             x_ *= invLen;
             y_ *= invLen;
         }
-        
-        return len;
     }
     
     /// Return length.
@@ -166,9 +164,12 @@ public:
     /// Return normalized to unit length.
     Vector2 Normalized() const
     {
-        float len = Length();
-        if (len >= M_EPSILON)
-            return *this * (1.0f / len);
+        float lenSquared = LengthSquared();
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
+        {
+            float invLen = 1.0f / sqrtf(lenSquared);
+            return *this * invLen;
+        }
         else
             return *this;
     }

+ 11 - 10
Source/Engine/Math/Vector3.h

@@ -151,19 +151,17 @@ public:
         return *this;
     }
     
-    /// Normalize to unit length and return the previous length.
-    float Normalize()
+    /// Normalize to unit length.
+    void Normalize()
     {
-        float len = Length();
-        if (len >= M_EPSILON)
+        float lenSquared = LengthSquared();
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
         {
-            float invLen = 1.0f / len;
+            float invLen = 1.0f / sqrtf(lenSquared);
             x_ *= invLen;
             y_ *= invLen;
             z_ *= invLen;
         }
-        
-        return len;
     }
     
     /// Return length.
@@ -195,9 +193,12 @@ public:
     /// Return normalized to unit length.
     Vector3 Normalized() const
     {
-        float len = Length();
-        if (len >= M_EPSILON)
-            return *this * (1.0f / len);
+        float lenSquared = LengthSquared();
+        if (!Urho3D::Equals(lenSquared, 1.0f) && lenSquared > 0.0f)
+        {
+            float invLen = 1.0f / sqrtf(lenSquared);
+            return *this * invLen;
+        }
         else
             return *this;
     }

+ 1 - 1
Source/Engine/Script/APITemplates.h

@@ -672,6 +672,7 @@ template <class T> void RegisterDrawable(asIScriptEngine* engine, const char* cl
     engine->RegisterObjectMethod(className, "uint get_zoneMask() const", asMETHOD(T, GetZoneMask), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_maxLights(uint)", asMETHOD(T, SetMaxLights), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_maxLights() const", asMETHOD(T, GetMaxLights), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "const BoundingBox& get_boundingBox() const", asMETHOD(T, GetBoundingBox), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const BoundingBox& get_worldBoundingBox()", asMETHOD(T, GetWorldBoundingBox), asCALL_THISCALL);
 }
 
@@ -742,7 +743,6 @@ template <class T> void RegisterStaticModel(asIScriptEngine* engine, const char*
     engine->RegisterObjectMethod(className, "void set_material(Material@+)", asMETHODPR(T, SetMaterial, (Material*), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool set_materials(uint, Material@+)", asMETHODPR(T, SetMaterial, (unsigned, Material*), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "Material@+ get_materials(uint) const", asMETHOD(T, GetMaterial), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "const BoundingBox& get_boundingBox() const", asMETHOD(T, GetBoundingBox), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_numGeometries() const", asMETHOD(T, GetNumGeometries), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "Zone@+ get_zone() const", asMETHOD(T, GetZone), asCALL_THISCALL);
 }

+ 0 - 3
Source/Engine/Script/GraphicsAPI.cpp

@@ -783,7 +783,6 @@ static void RegisterZone(asIScriptEngine* engine)
 {
     RegisterDrawable<Zone>(engine, "Zone");
     engine->RegisterObjectMethod("Zone", "void set_boundingBox(const BoundingBox&in)", asMETHOD(Zone, SetBoundingBox), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Zone", "const BoundingBox& get_boundingBox() const", asMETHOD(Zone, GetBoundingBox), asCALL_THISCALL);
     engine->RegisterObjectMethod("Zone", "const Matrix3x4& get_inverseWorldTransform() const", asMETHOD(Zone, GetInverseWorldTransform), asCALL_THISCALL);
     engine->RegisterObjectMethod("Zone", "void set_ambientColor(const Color&in)", asMETHOD(Zone, SetAmbientColor), asCALL_THISCALL);
     engine->RegisterObjectMethod("Zone", "const Color& get_ambientColor() const", asMETHOD(Zone, GetAmbientColor), asCALL_THISCALL);
@@ -813,7 +812,6 @@ static void RegisterStaticModel(asIScriptEngine* engine)
     engine->RegisterObjectMethod("StaticModel", "void set_material(Material@+)", asMETHODPR(StaticModel, SetMaterial, (Material*), void), asCALL_THISCALL);
     engine->RegisterObjectMethod("StaticModel", "bool set_materials(uint, Material@+)", asMETHODPR(StaticModel, SetMaterial, (unsigned, Material*), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("StaticModel", "Material@+ get_materials(uint) const", asMETHOD(StaticModel, GetMaterial), asCALL_THISCALL);
-    engine->RegisterObjectMethod("StaticModel", "const BoundingBox& get_boundingBox() const", asMETHOD(StaticModel, GetBoundingBox), asCALL_THISCALL);
     engine->RegisterObjectMethod("StaticModel", "uint get_numGeometries() const", asMETHOD(StaticModel, GetNumGeometries), asCALL_THISCALL);
     engine->RegisterObjectMethod("StaticModel", "void set_occlusionLodLevel(uint) const", asMETHOD(StaticModel, SetOcclusionLodLevel), asCALL_THISCALL);
     engine->RegisterObjectMethod("StaticModel", "uint get_occlusionLodLevel() const", asMETHOD(StaticModel, GetOcclusionLodLevel), asCALL_THISCALL);
@@ -1078,7 +1076,6 @@ static void RegisterCustomGeometry(asIScriptEngine* engine)
     engine->RegisterObjectMethod("CustomGeometry", "void set_material(Material@+)", asMETHODPR(CustomGeometry, SetMaterial, (Material*), void), asCALL_THISCALL);
     engine->RegisterObjectMethod("CustomGeometry", "bool set_materials(uint, Material@+)", asMETHODPR(CustomGeometry, SetMaterial, (unsigned, Material*), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("CustomGeometry", "Material@+ get_materials(uint) const", asMETHOD(CustomGeometry, GetMaterial), asCALL_THISCALL);
-    engine->RegisterObjectMethod("CustomGeometry", "const BoundingBox& get_boundingBox() const", asMETHOD(CustomGeometry, GetBoundingBox), asCALL_THISCALL);
     engine->RegisterObjectMethod("CustomGeometry", "void set_numGeometries(uint)", asMETHOD(CustomGeometry, SetNumGeometries), asCALL_THISCALL);
     engine->RegisterObjectMethod("CustomGeometry", "uint get_numGeometries() const", asMETHOD(CustomGeometry, GetNumGeometries), asCALL_THISCALL);
     engine->RegisterObjectMethod("CustomGeometry", "Zone@+ get_zone() const", asMETHOD(CustomGeometry, GetZone), asCALL_THISCALL);

+ 2 - 2
Source/Engine/Script/MathAPI.cpp

@@ -217,7 +217,7 @@ static void RegisterVector2(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Vector2", "Vector2 opMul(float) const", asMETHODPR(Vector2, operator *, (float) const, Vector2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector2", "Vector2 opDiv(const Vector2&in) const", asMETHODPR(Vector2, operator /, (const Vector2&) const, Vector2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector2", "Vector2 opDiv(float) const", asMETHODPR(Vector2, operator /, (float) const, Vector2), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Vector2", "float Normalize()", asMETHOD(Vector2, Normalize), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Vector2", "void Normalize()", asMETHOD(Vector2, Normalize), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector2", "float DotProduct(const Vector2&in) const", asMETHOD(Vector2, DotProduct), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector2", "float AbsDotProduct(const Vector2&in) const", asMETHOD(Vector2, AbsDotProduct), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector2", "Vector2 Lerp(const Vector2&in, float) const", asMETHOD(Vector2, Lerp), asCALL_THISCALL);
@@ -279,7 +279,7 @@ static void RegisterVector3(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Vector3", "Vector3 opMul(float) const", asMETHODPR(Vector3, operator *, (float) const, Vector3), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector3", "Vector3 opDiv(const Vector3&in) const", asMETHODPR(Vector3, operator /, (const Vector3&) const, Vector3), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector3", "Vector3 opDiv(float) const", asMETHODPR(Vector3, operator /, (float) const, Vector3), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Vector3", "float Normalize()", asMETHOD(Vector3, Normalize), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Vector3", "void Normalize()", asMETHOD(Vector3, Normalize), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector3", "float DotProduct(const Vector3&in) const", asMETHOD(Vector3, DotProduct), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector3", "float AbsDotProduct(const Vector3&in) const", asMETHOD(Vector3, AbsDotProduct), asCALL_THISCALL);
     engine->RegisterObjectMethod("Vector3", "Vector3 CrossProduct(const Vector3&in) const", asMETHOD(Vector3, CrossProduct), asCALL_THISCALL);

+ 0 - 2
Source/Engine/UI/Text3D.h

@@ -157,8 +157,6 @@ private:
     PODVector<UIBatch> uiBatches_;
     /// Text vertex data.
     PODVector<float> uiVertexData_;
-    /// Local-space bounding box.
-    BoundingBox boundingBox_;
     /// Custom world transform for facing the camera automatically.
     Matrix3x4 customWorldTransform_;
     /// Face camera flag.

+ 1 - 0
Source/Extras/LuaScript/pkgs/Graphics/Drawable.pkg

@@ -34,6 +34,7 @@ class Drawable : public Component
     void SetOccludee(bool enable);
     void MarkForUpdate();
     
+    const BoundingBox& GetBoundingBox() const;
     const BoundingBox& GetWorldBoundingBox();
     unsigned char GetDrawableFlags() const;
     float GetDrawDistance() const;

+ 0 - 1
Source/Extras/LuaScript/pkgs/Graphics/StaticModel.pkg

@@ -14,7 +14,6 @@ class StaticModel : public Drawable
     void SetOcclusionLodLevel(unsigned level);
     
     Model* GetModel() const;
-    const BoundingBox& GetBoundingBox() const;
     unsigned GetNumGeometries() const;
     Material* GetMaterial(unsigned index = 0) const;
     unsigned GetOcclusionLodLevel() const;

+ 0 - 1
Source/Extras/LuaScript/pkgs/Graphics/TerrainPatch.pkg

@@ -19,7 +19,6 @@ class TerrainPatch : public Drawable
     TerrainPatch* GetSouthPatch() const;
     TerrainPatch* GetWestPatch() const;
     TerrainPatch* GetEastPatch() const;
-    const BoundingBox& GetBoundingBox() const;
     const IntVector2& GetCoordinates() const;
     unsigned GetLodLevel() const;
     float GetOcclusionOffset() const;

+ 0 - 1
Source/Extras/LuaScript/pkgs/Graphics/Zone.pkg

@@ -11,7 +11,6 @@ class Zone : public Drawable
     void SetOverride(bool enable);
     void SetAmbientGradient(bool enable);
     
-    const BoundingBox& GetBoundingBox() const;
     const Matrix3x4& GetInverseWorldTransform() const;
     const Color& GetAmbientColor() const;
     const Color& GetAmbientStartColor();

+ 1 - 1
Source/Extras/LuaScript/pkgs/Math/Quaternion.pkg

@@ -30,7 +30,7 @@ class Quaternion
     void FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
     void FromRotationMatrix(const Matrix3& matrix);
     
-    float Normalize();
+    void Normalize();
     
     Quaternion Normalized() const;
     Quaternion Inverse() const;

+ 1 - 1
Source/Extras/LuaScript/pkgs/Math/Vector2.pkg

@@ -17,7 +17,7 @@ class Vector2
     Vector2 operator / (const Vector2& rhs) const;
     Vector2 operator / (const Vector2& rhs) const;
 
-    float Normalize();
+    void Normalize();
     float Length() const;
     float LengthSquared() const;
     float DotProduct(const Vector2& rhs) const;

+ 1 - 1
Source/Extras/LuaScript/pkgs/Math/Vector3.pkg

@@ -16,7 +16,7 @@ class Vector3
     Vector3 operator / (float rhs) const;
     Vector3 operator / (const Vector3& rhs) const;
     Vector3 operator / (const Vector3& rhs) const;
-    float Normalize();
+    void Normalize();
     float Length() const;
     float LengthSquared() const;
     float DotProduct(const Vector3& rhs) const;