瀏覽代碼

Changed Ray and Plane to set values for their default constructor.
Changed some of the Vector and Quaternion constructors to set their values using an initialization list instead of calling a method.

Darryl Gough 13 年之前
父節點
當前提交
aed1372c95

+ 1 - 0
gameplay/src/Plane.cpp

@@ -9,6 +9,7 @@ namespace gameplay
 {
 
 Plane::Plane()
+    : _normal(0, 1, 0), _distance(0)
 {
 }
 

+ 1 - 1
gameplay/src/Plane.h

@@ -37,7 +37,7 @@ public:
     static const int INTERSECTS_BACK = -1;
 
     /**
-     * Constructor.
+     * Constructs a new plane with normal (0, 1, 0) and distance 0.
      */
     Plane();
 

+ 1 - 1
gameplay/src/Quaternion.cpp

@@ -10,8 +10,8 @@ Quaternion::Quaternion()
 }
 
 Quaternion::Quaternion(float x, float y, float z, float w)
+    : x(x), y(y), z(z), w(w)
 {
-    set(x, y, z, w);
 }
 
 Quaternion::Quaternion(float* array)

+ 1 - 0
gameplay/src/Ray.cpp

@@ -9,6 +9,7 @@ namespace gameplay
 {
 
 Ray::Ray()
+    : _direction(0, 0, 1)
 {
 }
 

+ 1 - 1
gameplay/src/Ray.h

@@ -27,7 +27,7 @@ public:
     static const int INTERSECTS_NONE = -1;
 
     /**
-     * Constructor.
+     * Constructs a new ray initialized to origin(0,0,0) and direction(0,0,1).
      */
     Ray();
 

+ 1 - 1
gameplay/src/Vector2.cpp

@@ -10,8 +10,8 @@ Vector2::Vector2()
 }
 
 Vector2::Vector2(float x, float y)
+    : x(x), y(y)
 {
-    set(x, y);
 }
 
 Vector2::Vector2(const float* array)

+ 1 - 1
gameplay/src/Vector3.cpp

@@ -11,8 +11,8 @@ Vector3::Vector3()
 }
 
 Vector3::Vector3(float x, float y, float z)
+    : x(x), y(y), z(z)
 {
-    set(x, y, z);
 }
 
 Vector3::Vector3(const float* array)

+ 1 - 1
gameplay/src/Vector4.cpp

@@ -10,8 +10,8 @@ Vector4::Vector4()
 }
 
 Vector4::Vector4(float x, float y, float z, float w)
+    : x(x), y(y), z(z), w(w)
 {
-    set(x, y, z, w);
 }
 
 Vector4::Vector4(const float* src)