Browse Source

Simplify defining Vector2,3,4::ZERO. Consistency for the up direction parameter name in Node::LookAt() & Quaternion::FromLookRotation().

Lasse Öörni 11 years ago
parent
commit
f6c96c2f9f

+ 1 - 1
Source/Engine/Math/Quaternion.h

@@ -172,7 +172,7 @@ public:
     /// Define from a rotation matrix.
     void FromRotationMatrix(const Matrix3& matrix);
     /// Define from a direction to look in and an up direction.
-    void FromLookRotation(const Vector3& direction, const Vector3&up = Vector3::UP);
+    void FromLookRotation(const Vector3& direction, const Vector3& up = Vector3::UP);
 
     /// Normalize to unit length.
     void Normalize()

+ 2 - 2
Source/Engine/Math/Vector2.cpp

@@ -28,14 +28,14 @@
 namespace Urho3D
 {
 
-const Vector2 Vector2::ZERO(0.0f, 0.0f);
+const Vector2 Vector2::ZERO;
 const Vector2 Vector2::LEFT(-1.0f, 0.0f);
 const Vector2 Vector2::RIGHT(1.0f, 0.0f);
 const Vector2 Vector2::UP(0.0f, 1.0f);
 const Vector2 Vector2::DOWN(0.0f, -1.0f);
 const Vector2 Vector2::ONE(1.0f, 1.0f);
 
-const IntVector2 IntVector2::ZERO(0, 0);
+const IntVector2 IntVector2::ZERO;
 
 String Vector2::ToString() const
 {

+ 1 - 1
Source/Engine/Math/Vector3.cpp

@@ -28,7 +28,7 @@
 namespace Urho3D
 {
 
-const Vector3 Vector3::ZERO(0.0f, 0.0f, 0.0f);
+const Vector3 Vector3::ZERO;
 const Vector3 Vector3::LEFT(-1.0f, 0.0f, 0.0f);
 const Vector3 Vector3::RIGHT(1.0f, 0.0f, 0.0f);
 const Vector3 Vector3::UP(0.0f, 1.0f, 0.0f);

+ 1 - 1
Source/Engine/Math/Vector4.cpp

@@ -28,7 +28,7 @@
 namespace Urho3D
 {
 
-const Vector4 Vector4::ZERO(0.0f, 0.0f, 0.0f, 0.0f);
+const Vector4 Vector4::ZERO;
 const Vector4 Vector4::ONE(1.0f, 1.0f, 1.0f, 1.0f);
 
 String Vector4::ToString() const

+ 2 - 2
Source/Engine/Scene/Node.cpp

@@ -398,14 +398,14 @@ void Node::Roll(float angle, bool fixedAxis)
     Rotate(Quaternion(angle, Vector3::FORWARD), fixedAxis);
 }
 
-void Node::LookAt(const Vector3& target, const Vector3& upAxis)
+void Node::LookAt(const Vector3& target, const Vector3& up)
 {
     Vector3 lookDir = target - GetWorldPosition();
     // Check if target is very close, in that case can not reliably calculate lookat direction
     if (lookDir.Equals(Vector3::ZERO))
         return;
     Quaternion rotation;
-    rotation.FromLookRotation(lookDir, upAxis);
+    rotation.FromLookRotation(lookDir, up);
     // Return doing nothing if rotation became invalid
     if (rotation.IsNaN())
         return;

+ 1 - 1
Source/Engine/Scene/Node.h

@@ -125,7 +125,7 @@ public:
     /// Rotate around the Z axis.
     void Roll(float angle, bool fixedAxis = false);
     /// Look at a target world position.
-    void LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP);
+    void LookAt(const Vector3& target, const Vector3& up = Vector3::UP);
     /// Modify scale in parent space uniformly.
     void Scale(float scale);
     /// Modify scale in parent space.

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

@@ -598,7 +598,7 @@ template <class T> void RegisterNode(asIScriptEngine* engine, const char* classN
     engine->RegisterObjectMethod(className, "void Pitch(float, bool fixedAxis = false)", asMETHOD(T, Pitch), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Yaw(float, bool fixedAxis = false)", asMETHOD(T, Yaw), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Roll(float, bool fixedAxis = false)", asMETHOD(T, Roll), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void LookAt(const Vector3&in, const Vector3&in upAxis = Vector3(0, 1, 0))", asMETHOD(T, LookAt), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void LookAt(const Vector3&in, const Vector3&in up = Vector3(0, 1, 0))", asMETHOD(T, LookAt), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Scale(float)", asMETHODPR(T, Scale, (float), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Scale(const Vector3&in)", asMETHODPR(T, Scale, (const Vector3&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "Node@+ CreateChild(const String&in name = String(), CreateMode mode = REPLICATED, uint id = 0)", asMETHODPR(T, CreateChild, (const String&, CreateMode, unsigned), Node*), asCALL_THISCALL);