Browse Source

Sphere: unsigned to signed, fix warnings

1vanK 3 years ago
parent
commit
d4243d9303

+ 1 - 1
Source/Urho3D/AngelScript/Generated_Classes.cpp

@@ -2291,7 +2291,7 @@ static void Sphere__Sphere_constspPolyhedronamp(Sphere* _ptr, const Polyhedron&
 // class Sphere | File: ../Math/Sphere.h
 static void Register_Sphere(asIScriptEngine* engine)
 {
-    // Sphere::Sphere(const Vector3* vertices, unsigned count) noexcept
+    // Sphere::Sphere(const Vector3* vertices, i32 count) noexcept
     // Error: type "const Vector3*" can not automatically bind
 
     // Sphere::Sphere(const Sphere& sphere) noexcept = default

+ 2 - 2
Source/Urho3D/AngelScript/Generated_Members.h

@@ -4689,9 +4689,9 @@ template <class T> void RegisterMembers_SourceBatch(asIScriptEngine* engine, con
 // class Sphere | File: ../Math/Sphere.h
 template <class T> void RegisterMembers_Sphere(asIScriptEngine* engine, const char* className)
 {
-    // void Sphere::Define(const Vector3* vertices, unsigned count)
+    // void Sphere::Define(const Vector3* vertices, i32 count)
     // Error: type "const Vector3*" can not automatically bind
-    // void Sphere::Merge(const Vector3* vertices, unsigned count)
+    // void Sphere::Merge(const Vector3* vertices, i32 count)
     // Error: type "const Vector3*" can not automatically bind
     // bool Sphere::operator !=(const Sphere& rhs) const
     // Only operator == is needed

+ 7 - 4
Source/Urho3D/Math/Sphere.cpp

@@ -11,8 +11,10 @@
 namespace Urho3D
 {
 
-void Sphere::Define(const Vector3* vertices, unsigned count)
+void Sphere::Define(const Vector3* vertices, i32 count)
 {
+    assert(count >= 0);
+
     if (!count)
         return;
 
@@ -47,8 +49,10 @@ void Sphere::Define(const Polyhedron& poly)
     Merge(poly);
 }
 
-void Sphere::Merge(const Vector3* vertices, unsigned count)
+void Sphere::Merge(const Vector3* vertices, i32 count)
 {
+    assert(count >= 0);
+
     while (count--)
         Merge(*vertices++);
 }
@@ -76,9 +80,8 @@ void Sphere::Merge(const Frustum& frustum)
 
 void Sphere::Merge(const Polyhedron& poly)
 {
-    for (unsigned i = 0; i < poly.faces_.Size(); ++i)
+    for (const Vector<Vector3>& face : poly.faces_)
     {
-        const Vector<Vector3>& face = poly.faces_[i];
         if (!face.Empty())
             Merge(&face[0], face.Size());
     }

+ 3 - 3
Source/Urho3D/Math/Sphere.h

@@ -35,7 +35,7 @@ public:
     }
 
     /// Construct from an array of vertices.
-    Sphere(const Vector3* vertices, unsigned count) noexcept
+    Sphere(const Vector3* vertices, i32 count) noexcept
     {
         Define(vertices, count);
     }
@@ -81,7 +81,7 @@ public:
     }
 
     /// Define from an array of vertices.
-    void Define(const Vector3* vertices, unsigned count);
+    void Define(const Vector3* vertices, i32 count);
     /// Define from a bounding box.
     void Define(const BoundingBox& box);
     /// Define from a frustum.
@@ -111,7 +111,7 @@ public:
     }
 
     /// Merge an array of vertices.
-    void Merge(const Vector3* vertices, unsigned count);
+    void Merge(const Vector3* vertices, i32 count);
     /// Merge a bounding box.
     void Merge(const BoundingBox& box);
     /// Merge a frustum.