Преглед на файлове

Removed use of STL from the Math library, except for AreaAllocator.

Lasse Öörni преди 14 години
родител
ревизия
7aecd79aab
променени са 7 файла, в които са добавени 13 реда и са изтрити 41 реда
  1. 2 0
      Engine/Math/AreaAllocator.h
  2. 3 16
      Engine/Math/BoundingBox.cpp
  3. 0 6
      Engine/Math/BoundingBox.h
  4. 8 0
      Engine/Math/MathDefs.h
  5. 0 2
      Engine/Math/Precompiled.h
  6. 0 13
      Engine/Math/Sphere.cpp
  7. 0 4
      Engine/Math/Sphere.h

+ 2 - 0
Engine/Math/AreaAllocator.h

@@ -25,6 +25,8 @@
 
 #include "Rect.h"
 
+#include <vector>
+
 /// Rectangle allocator, used for font glyph packing
 class AreaAllocator
 {

+ 3 - 16
Engine/Math/BoundingBox.cpp

@@ -24,13 +24,6 @@
 #include "Precompiled.h"
 #include "Frustum.h"
 
-void BoundingBox::Define(const std::vector<Vector3>& vertices)
-{
-    defined_ = false;
-    for (std::vector<Vector3>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)
-        Merge(*i);
-}
-
 void BoundingBox::Define(const Vector3* vertices, unsigned count)
 {
     if (!count)
@@ -55,12 +48,6 @@ void BoundingBox::Define(const Sphere& sphere)
     defined_ = true;
 }
 
-void BoundingBox::Merge(const std::vector<Vector3>& vertices)
-{
-    for (std::vector<Vector3>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)
-        Merge(*i);
-}
-
 void BoundingBox::Merge(const Vector3* vertices, unsigned count)
 {
     while (count--)
@@ -100,11 +87,11 @@ void BoundingBox::Intersect(const BoundingBox& box)
         max_.z_ = box.max_.z_;
     
     if (min_.x_ > max_.x_)
-        std::swap(min_.x_, max_.x_);
+        Swap(min_.x_, max_.x_);
     if (min_.y_ > max_.y_)
-        std::swap(min_.y_, max_.y_);
+        Swap(min_.y_, max_.y_);
     if (min_.z_ > max_.z_)
-        std::swap(min_.z_, max_.z_);
+        Swap(min_.z_, max_.z_);
 }
 
 void BoundingBox::Transform(const Matrix3& transform)

+ 0 - 6
Engine/Math/BoundingBox.h

@@ -26,8 +26,6 @@
 #include "Rect.h"
 #include "Vector3.h"
 
-#include <vector>
-
 class Frustum;
 class Matrix3;
 class Matrix4;
@@ -171,16 +169,12 @@ public:
         if (box.max_.z_ > max_.z_) max_.z_ = box.max_.z_;
     }
     
-    /// Define from a vector of vertices
-    void Define(const std::vector<Vector3>& vertices);
     /// Define from an array of vertices
     void Define(const Vector3* vertices, unsigned count);
     /// Define from a frustum
     void Define(const Frustum& frustum);
     /// Define from a sphere
     void Define(const Sphere& sphere);
-    /// Merge a vector of vertices
-    void Merge(const std::vector<Vector3>& vertices);
     /// Merge an array of vertices
     void Merge(const Vector3* vertices, unsigned count);
     /// Merge a frustum

+ 8 - 0
Engine/Math/MathDefs.h

@@ -125,6 +125,14 @@ inline int Clamp(int value, int min, int max)
     return value;
 }
 
+/// Swap two values
+template<class T> inline void Swap(T& first, T& second)
+{
+    T temp = first;
+    first = second;
+    second = temp;
+}
+
 /// Check whether an unsigned integer is a power of two
 inline bool IsPowerOfTwo(unsigned value)
 {

+ 0 - 2
Engine/Math/Precompiled.h

@@ -22,5 +22,3 @@
 //
 
 #pragma once
-
-#include <vector>

+ 0 - 13
Engine/Math/Sphere.cpp

@@ -24,13 +24,6 @@
 #include "Precompiled.h"
 #include "Frustum.h"
 
-void Sphere::Define(const std::vector<Vector3>& vertices)
-{
-    defined_ = false;
-    for (std::vector<Vector3>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)
-        Merge(*i);
-}
-
 void Sphere::Define(const Vector3* vertices, unsigned count)
 {
     if (!count)
@@ -61,12 +54,6 @@ void Sphere::Define(const Frustum& frustum)
     Define(frustum.GetVertices(), NUM_FRUSTUM_VERTICES);
 }
 
-void Sphere::Merge(const std::vector<Vector3>& vertices)
-{
-    for (std::vector<Vector3>::const_iterator i = vertices.begin(); i != vertices.end(); ++i)
-        Merge(*i);
-}
-
 void Sphere::Merge(const Vector3* vertices, unsigned count)
 {
     while (count--)

+ 0 - 4
Engine/Math/Sphere.h

@@ -79,8 +79,6 @@ public:
         defined_ = true;
     }
     
-    /// Define from a vector of vertices
-    void Define(const std::vector<Vector3>& vertices);
     /// Define from an array of vertices
     void Define(const Vector3* vertices, unsigned count);
     /// Define from a boundingBox
@@ -109,8 +107,6 @@ public:
         }
     }
     
-    /// Merge a vector of vertices
-    void Merge(const std::vector<Vector3>& vertices);
     /// Merge an array of vertices
     void Merge(const Vector3* vertices, unsigned count);
     /// Merge a bounding box