Pārlūkot izejas kodu

enum TransformSpace -> enum class TransformSpace

1vanK 3 gadi atpakaļ
vecāks
revīzija
e26083478a

+ 1 - 1
Source/Samples/07_Billboards/Billboards.cpp

@@ -280,7 +280,7 @@ void Billboards::AnimateScene(float timeStep)
 
 
     // Rotate the lights around the world Y-axis
     // Rotate the lights around the world Y-axis
     for (Node* lightNode : lightNodes)
     for (Node* lightNode : lightNodes)
-        lightNode->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
+        lightNode->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TransformSpace::World);
 
 
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (i32 i = 0; i < billboardNodes.Size(); ++i)
     for (i32 i = 0; i < billboardNodes.Size(); ++i)

+ 2 - 2
Source/Samples/45_InverseKinematics/InverseKinematics.cpp

@@ -262,7 +262,7 @@ void InverseKinematics::HandleSceneDrawableUpdateFinished(StringHash /*eventType
         float footOffset = leftFoot_->GetWorldPosition().y_ - jackNode_->GetWorldPosition().y_;
         float footOffset = leftFoot_->GetWorldPosition().y_ - jackNode_->GetWorldPosition().y_;
         leftEffector_->SetTargetPosition(result.position_ + result.normal_ * footOffset);
         leftEffector_->SetTargetPosition(result.position_ + result.normal_ * footOffset);
         // Rotate foot according to normal
         // Rotate foot according to normal
-        leftFoot_->Rotate(Quaternion(Vector3(0, 1, 0), result.normal_), TS_WORLD);
+        leftFoot_->Rotate(Quaternion(Vector3(0, 1, 0), result.normal_), TransformSpace::World);
     }
     }
 
 
     // Same deal with the right foot
     // Same deal with the right foot
@@ -272,7 +272,7 @@ void InverseKinematics::HandleSceneDrawableUpdateFinished(StringHash /*eventType
         phyWorld->RaycastSingle(result, Ray(rightFootPosition + result.normal_, -result.normal_), 2);
         phyWorld->RaycastSingle(result, Ray(rightFootPosition + result.normal_, -result.normal_), 2);
         float footOffset = rightFoot_->GetWorldPosition().y_ - jackNode_->GetWorldPosition().y_;
         float footOffset = rightFoot_->GetWorldPosition().y_ - jackNode_->GetWorldPosition().y_;
         rightEffector_->SetTargetPosition(result.position_ + result.normal_ * footOffset);
         rightEffector_->SetTargetPosition(result.position_ + result.normal_ * footOffset);
-        rightFoot_->Rotate(Quaternion(Vector3(0, 1, 0), result.normal_), TS_WORLD);
+        rightFoot_->Rotate(Quaternion(Vector3(0, 1, 0), result.normal_), TransformSpace::World);
     }
     }
 
 
     solver_->Solve();
     solver_->Solve();

+ 1 - 1
Source/Samples/54_WindowSettingsDemo/WindowSettingsDemo.cpp

@@ -98,7 +98,7 @@ void WindowSettingsDemo::CreateScene()
         [objectNode](StringHash /*eventType*/, VariantMap& eventData)
         [objectNode](StringHash /*eventType*/, VariantMap& eventData)
     {
     {
         const float timeStep = eventData[SceneUpdate::P_TIMESTEP].GetFloat();
         const float timeStep = eventData[SceneUpdate::P_TIMESTEP].GetFloat();
-        objectNode->Rotate(Quaternion(0.0f, 20.0f * timeStep, 0.0f), TS_WORLD);
+        objectNode->Rotate(Quaternion(0.0f, 20.0f * timeStep, 0.0f), TransformSpace::World);
     });
     });
 }
 }
 
 

+ 12 - 5
Source/Urho3D/AngelScript/Generated_Enums.cpp

@@ -604,6 +604,11 @@ static const unsigned SmoothingType_SMOOTH_NONE = SMOOTH_NONE;
 static const unsigned SmoothingType_SMOOTH_POSITION = SMOOTH_POSITION;
 static const unsigned SmoothingType_SMOOTH_POSITION = SMOOTH_POSITION;
 static const unsigned SmoothingType_SMOOTH_ROTATION = SMOOTH_ROTATION;
 static const unsigned SmoothingType_SMOOTH_ROTATION = SMOOTH_ROTATION;
 
 
+// enum class TransformSpace | File: ../Scene/Node.h
+static const int TransformSpace_Local = static_cast<int>(TransformSpace::Local);
+static const int TransformSpace_Parent = static_cast<int>(TransformSpace::Parent);
+static const int TransformSpace_World = static_cast<int>(TransformSpace::World);
+
 // enum VertexMask : u32 | File: ../GraphicsAPI/GraphicsDefs.h
 // enum VertexMask : u32 | File: ../GraphicsAPI/GraphicsDefs.h
 static const u32 VertexMask_MASK_NONE = MASK_NONE;
 static const u32 VertexMask_MASK_NONE = MASK_NONE;
 static const u32 VertexMask_MASK_POSITION = MASK_POSITION;
 static const u32 VertexMask_MASK_POSITION = MASK_POSITION;
@@ -1801,11 +1806,13 @@ void ASRegisterGeneratedEnums(asIScriptEngine* engine)
     engine->RegisterEnumValue("TrailType", "TT_FACE_CAMERA", TT_FACE_CAMERA);
     engine->RegisterEnumValue("TrailType", "TT_FACE_CAMERA", TT_FACE_CAMERA);
     engine->RegisterEnumValue("TrailType", "TT_BONE", TT_BONE);
     engine->RegisterEnumValue("TrailType", "TT_BONE", TT_BONE);
 
 
-    // enum TransformSpace | File: ../Scene/Node.h
-    engine->RegisterEnum("TransformSpace");
-    engine->RegisterEnumValue("TransformSpace", "TS_LOCAL", TS_LOCAL);
-    engine->RegisterEnumValue("TransformSpace", "TS_PARENT", TS_PARENT);
-    engine->RegisterEnumValue("TransformSpace", "TS_WORLD", TS_WORLD);
+    // enum class TransformSpace | File: ../Scene/Node.h
+    engine->RegisterTypedef("TransformSpace", "int");
+    engine->SetDefaultNamespace("TransformSpace");
+    engine->RegisterGlobalProperty("const int Local", (void*)&TransformSpace_Local);
+    engine->RegisterGlobalProperty("const int Parent", (void*)&TransformSpace_Parent);
+    engine->RegisterGlobalProperty("const int World", (void*)&TransformSpace_World);
+    engine->SetDefaultNamespace("");
 
 
     // enum TraversalMode | File: ../UI/UIElement.h
     // enum TraversalMode | File: ../UI/UIElement.h
     engine->RegisterEnum("TraversalMode");
     engine->RegisterEnum("TraversalMode");

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

@@ -15848,14 +15848,14 @@ template <class T> void RegisterMembers_Node(asIScriptEngine* engine, const char
     // Vector2 Node::LocalToWorld2D(const Vector2& vector) const
     // Vector2 Node::LocalToWorld2D(const Vector2& vector) const
     engine->RegisterObjectMethod(className, "Vector2 LocalToWorld2D(const Vector2&in) const", AS_METHODPR(T, LocalToWorld2D, (const Vector2&) const, Vector2), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "Vector2 LocalToWorld2D(const Vector2&in) const", AS_METHODPR(T, LocalToWorld2D, (const Vector2&) const, Vector2), AS_CALL_THISCALL);
 
 
-    // bool Node::LookAt(const Vector3& target, const Vector3& up = Vector3::UP, TransformSpace space = TS_WORLD)
-    engine->RegisterObjectMethod(className, "bool LookAt(const Vector3&in, const Vector3&in = Vector3::UP, TransformSpace = TS_WORLD)", AS_METHODPR(T, LookAt, (const Vector3&, const Vector3&, TransformSpace), bool), AS_CALL_THISCALL);
+    // bool Node::LookAt(const Vector3& target, const Vector3& up = Vector3::UP, TransformSpace space = TransformSpace::World)
+    engine->RegisterObjectMethod(className, "bool LookAt(const Vector3&in, const Vector3&in = Vector3::UP, TransformSpace = TransformSpace::World)", AS_METHODPR(T, LookAt, (const Vector3&, const Vector3&, TransformSpace), bool), AS_CALL_THISCALL);
 
 
     // void Node::MarkDirty()
     // void Node::MarkDirty()
     engine->RegisterObjectMethod(className, "void MarkDirty()", AS_METHODPR(T, MarkDirty, (), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void MarkDirty()", AS_METHODPR(T, MarkDirty, (), void), AS_CALL_THISCALL);
 
 
-    // void Node::Pitch(float angle, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Pitch(float, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Pitch, (float, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Pitch(float angle, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Pitch(float, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Pitch, (float, TransformSpace), void), AS_CALL_THISCALL);
 
 
     // void Node::PrepareNetworkUpdate()
     // void Node::PrepareNetworkUpdate()
     engine->RegisterObjectMethod(className, "void PrepareNetworkUpdate()", AS_METHODPR(T, PrepareNetworkUpdate, (), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void PrepareNetworkUpdate()", AS_METHODPR(T, PrepareNetworkUpdate, (), void), AS_CALL_THISCALL);
@@ -15905,20 +15905,20 @@ template <class T> void RegisterMembers_Node(asIScriptEngine* engine, const char
     // void Node::ResetScene()
     // void Node::ResetScene()
     engine->RegisterObjectMethod(className, "void ResetScene()", AS_METHODPR(T, ResetScene, (), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void ResetScene()", AS_METHODPR(T, ResetScene, (), void), AS_CALL_THISCALL);
 
 
-    // void Node::Roll(float angle, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Roll(float, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Roll, (float, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Roll(float angle, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Roll(float, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Roll, (float, TransformSpace), void), AS_CALL_THISCALL);
 
 
-    // void Node::Rotate(const Quaternion& delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Rotate(const Quaternion&in, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Rotate, (const Quaternion&, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Rotate(const Quaternion& delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Rotate(const Quaternion&in, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Rotate, (const Quaternion&, TransformSpace), void), AS_CALL_THISCALL);
 
 
-    // void Node::Rotate2D(float delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Rotate2D(float, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Rotate2D, (float, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Rotate2D(float delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Rotate2D(float, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Rotate2D, (float, TransformSpace), void), AS_CALL_THISCALL);
 
 
-    // void Node::RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void RotateAround(const Vector3&in, const Quaternion&in, TransformSpace = TS_LOCAL)", AS_METHODPR(T, RotateAround, (const Vector3&, const Quaternion&, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void RotateAround(const Vector3&in, const Quaternion&in, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, RotateAround, (const Vector3&, const Quaternion&, TransformSpace), void), AS_CALL_THISCALL);
 
 
-    // void Node::RotateAround2D(const Vector2& point, float delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void RotateAround2D(const Vector2&in, float, TransformSpace = TS_LOCAL)", AS_METHODPR(T, RotateAround2D, (const Vector2&, float, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::RotateAround2D(const Vector2& point, float delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void RotateAround2D(const Vector2&in, float, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, RotateAround2D, (const Vector2&, float, TransformSpace), void), AS_CALL_THISCALL);
 
 
     // bool Node::SaveJSON(Serializer& dest, const String& indentation = "\t") const
     // bool Node::SaveJSON(Serializer& dest, const String& indentation = "\t") const
     engine->RegisterObjectMethod(className, "bool SaveJSON(Serializer&, const String&in = \"\t\") const", AS_METHODPR(T, SaveJSON, (Serializer&, const String&) const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool SaveJSON(Serializer&, const String&in = \"\t\") const", AS_METHODPR(T, SaveJSON, (Serializer&, const String&) const, bool), AS_CALL_THISCALL);
@@ -16103,11 +16103,11 @@ template <class T> void RegisterMembers_Node(asIScriptEngine* engine, const char
     // void Node::SetWorldTransform2D(const Vector2& position, float rotation, const Vector2& scale)
     // void Node::SetWorldTransform2D(const Vector2& position, float rotation, const Vector2& scale)
     engine->RegisterObjectMethod(className, "void SetWorldTransform2D(const Vector2&in, float, const Vector2&in)", AS_METHODPR(T, SetWorldTransform2D, (const Vector2&, float, const Vector2&), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetWorldTransform2D(const Vector2&in, float, const Vector2&in)", AS_METHODPR(T, SetWorldTransform2D, (const Vector2&, float, const Vector2&), void), AS_CALL_THISCALL);
 
 
-    // void Node::Translate(const Vector3& delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Translate(const Vector3&in, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Translate, (const Vector3&, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Translate(const Vector3& delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Translate(const Vector3&in, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Translate, (const Vector3&, TransformSpace), void), AS_CALL_THISCALL);
 
 
-    // void Node::Translate2D(const Vector2& delta, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Translate2D(const Vector2&in, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Translate2D, (const Vector2&, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Translate2D(const Vector2& delta, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Translate2D(const Vector2&in, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Translate2D, (const Vector2&, TransformSpace), void), AS_CALL_THISCALL);
 
 
     // Vector3 Node::WorldToLocal(const Vector3& position) const
     // Vector3 Node::WorldToLocal(const Vector3& position) const
     engine->RegisterObjectMethod(className, "Vector3 WorldToLocal(const Vector3&in) const", AS_METHODPR(T, WorldToLocal, (const Vector3&) const, Vector3), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "Vector3 WorldToLocal(const Vector3&in) const", AS_METHODPR(T, WorldToLocal, (const Vector3&) const, Vector3), AS_CALL_THISCALL);
@@ -16118,8 +16118,8 @@ template <class T> void RegisterMembers_Node(asIScriptEngine* engine, const char
     // Vector2 Node::WorldToLocal2D(const Vector2& vector) const
     // Vector2 Node::WorldToLocal2D(const Vector2& vector) const
     engine->RegisterObjectMethod(className, "Vector2 WorldToLocal2D(const Vector2&in) const", AS_METHODPR(T, WorldToLocal2D, (const Vector2&) const, Vector2), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "Vector2 WorldToLocal2D(const Vector2&in) const", AS_METHODPR(T, WorldToLocal2D, (const Vector2&) const, Vector2), AS_CALL_THISCALL);
 
 
-    // void Node::Yaw(float angle, TransformSpace space = TS_LOCAL)
-    engine->RegisterObjectMethod(className, "void Yaw(float, TransformSpace = TS_LOCAL)", AS_METHODPR(T, Yaw, (float, TransformSpace), void), AS_CALL_THISCALL);
+    // void Node::Yaw(float angle, TransformSpace space = TransformSpace::Local)
+    engine->RegisterObjectMethod(className, "void Yaw(float, TransformSpace = TransformSpace::Local)", AS_METHODPR(T, Yaw, (float, TransformSpace), void), AS_CALL_THISCALL);
 
 
     // template <class T> T* Node::CreateComponent(CreateMode mode = REPLICATED, ComponentId id = 0)
     // template <class T> T* Node::CreateComponent(CreateMode mode = REPLICATED, ComponentId id = 0)
     // Not registered because template
     // Not registered because template

+ 2 - 2
Source/Urho3D/Graphics/View.cpp

@@ -2742,7 +2742,7 @@ void View::QuantizeDirLightShadowCamera(Camera* shadowCamera, Light* light, cons
     // Center shadow camera to the view space bounding box
     // Center shadow camera to the view space bounding box
     Quaternion rot(shadowCameraNode->GetWorldRotation());
     Quaternion rot(shadowCameraNode->GetWorldRotation());
     Vector3 adjust(center.x_, center.y_, 0.0f);
     Vector3 adjust(center.x_, center.y_, 0.0f);
-    shadowCameraNode->Translate(rot * adjust, TS_WORLD);
+    shadowCameraNode->Translate(rot * adjust, TransformSpace::World);
 
 
     // If the shadow map viewport is known, snap to whole texels
     // If the shadow map viewport is known, snap to whole texels
     if (shadowMapWidth > 0.0f)
     if (shadowMapWidth > 0.0f)
@@ -2752,7 +2752,7 @@ void View::QuantizeDirLightShadowCamera(Camera* shadowCamera, Light* light, cons
         float invActualSize = 1.0f / (shadowMapWidth - 2.0f);
         float invActualSize = 1.0f / (shadowMapWidth - 2.0f);
         Vector2 texelSize(viewSize.x_ * invActualSize, viewSize.y_ * invActualSize);
         Vector2 texelSize(viewSize.x_ * invActualSize, viewSize.y_ * invActualSize);
         Vector3 snap(-fmodf(viewPos.x_, texelSize.x_), -fmodf(viewPos.y_, texelSize.y_), 0.0f);
         Vector3 snap(-fmodf(viewPos.x_, texelSize.x_), -fmodf(viewPos.y_, texelSize.y_), 0.0f);
-        shadowCameraNode->Translate(rot * snap, TS_WORLD);
+        shadowCameraNode->Translate(rot * snap, TransformSpace::World);
     }
     }
 }
 }
 
 

+ 12 - 12
Source/Urho3D/Scene/Node.cpp

@@ -538,16 +538,16 @@ void Node::Translate(const Vector3& delta, TransformSpace space)
 {
 {
     switch (space)
     switch (space)
     {
     {
-    case TS_LOCAL:
+    case TransformSpace::Local:
         // Note: local space translation disregards local scale for scale-independent movement speed
         // Note: local space translation disregards local scale for scale-independent movement speed
         position_ += rotation_ * delta;
         position_ += rotation_ * delta;
         break;
         break;
 
 
-    case TS_PARENT:
+    case TransformSpace::Parent:
         position_ += delta;
         position_ += delta;
         break;
         break;
 
 
-    case TS_WORLD:
+    case TransformSpace::World:
         position_ += (parent_ == scene_ || !parent_) ? delta : parent_->GetWorldTransform().Inverse() * Vector4(delta, 0.0f);
         position_ += (parent_ == scene_ || !parent_) ? delta : parent_->GetWorldTransform().Inverse() * Vector4(delta, 0.0f);
         break;
         break;
     }
     }
@@ -561,15 +561,15 @@ void Node::Rotate(const Quaternion& delta, TransformSpace space)
 {
 {
     switch (space)
     switch (space)
     {
     {
-    case TS_LOCAL:
+    case TransformSpace::Local:
         rotation_ = (rotation_ * delta).Normalized();
         rotation_ = (rotation_ * delta).Normalized();
         break;
         break;
 
 
-    case TS_PARENT:
+    case TransformSpace::Parent:
         rotation_ = (delta * rotation_).Normalized();
         rotation_ = (delta * rotation_).Normalized();
         break;
         break;
 
 
-    case TS_WORLD:
+    case TransformSpace::World:
         if (parent_ == scene_ || !parent_)
         if (parent_ == scene_ || !parent_)
             rotation_ = (delta * rotation_).Normalized();
             rotation_ = (delta * rotation_).Normalized();
         else
         else
@@ -592,17 +592,17 @@ void Node::RotateAround(const Vector3& point, const Quaternion& delta, Transform
 
 
     switch (space)
     switch (space)
     {
     {
-    case TS_LOCAL:
+    case TransformSpace::Local:
         parentSpacePoint = GetTransform() * point;
         parentSpacePoint = GetTransform() * point;
         rotation_ = (rotation_ * delta).Normalized();
         rotation_ = (rotation_ * delta).Normalized();
         break;
         break;
 
 
-    case TS_PARENT:
+    case TransformSpace::Parent:
         parentSpacePoint = point;
         parentSpacePoint = point;
         rotation_ = (delta * rotation_).Normalized();
         rotation_ = (delta * rotation_).Normalized();
         break;
         break;
 
 
-    case TS_WORLD:
+    case TransformSpace::World:
         if (parent_ == scene_ || !parent_)
         if (parent_ == scene_ || !parent_)
         {
         {
             parentSpacePoint = point;
             parentSpacePoint = point;
@@ -646,15 +646,15 @@ bool Node::LookAt(const Vector3& target, const Vector3& up, TransformSpace space
 
 
     switch (space)
     switch (space)
     {
     {
-    case TS_LOCAL:
+    case TransformSpace::Local:
         worldSpaceTarget = GetWorldTransform() * target;
         worldSpaceTarget = GetWorldTransform() * target;
         break;
         break;
 
 
-    case TS_PARENT:
+    case TransformSpace::Parent:
         worldSpaceTarget = (parent_ == scene_ || !parent_) ? target : parent_->GetWorldTransform() * target;
         worldSpaceTarget = (parent_ == scene_ || !parent_) ? target : parent_->GetWorldTransform() * target;
         break;
         break;
 
 
-    case TS_WORLD:
+    case TransformSpace::World:
         worldSpaceTarget = target;
         worldSpaceTarget = target;
         break;
         break;
     }
     }

+ 14 - 14
Source/Urho3D/Scene/Node.h

@@ -30,11 +30,11 @@ enum CreateMode
 };
 };
 
 
 /// Transform space for translations and rotations.
 /// Transform space for translations and rotations.
-enum TransformSpace
+enum class TransformSpace
 {
 {
-    TS_LOCAL = 0,
-    TS_PARENT,
-    TS_WORLD
+    Local = 0,
+    Parent,
+    World
 };
 };
 
 
 using ComponentId = id32;
 using ComponentId = id32;
@@ -239,34 +239,34 @@ public:
     }
     }
 
 
     /// Move the scene node in the chosen transform space.
     /// Move the scene node in the chosen transform space.
-    void Translate(const Vector3& delta, TransformSpace space = TS_LOCAL);
+    void Translate(const Vector3& delta, TransformSpace space = TransformSpace::Local);
 
 
     /// Move the scene node in the chosen transform space (for Urho2D).
     /// Move the scene node in the chosen transform space (for Urho2D).
-    void Translate2D(const Vector2& delta, TransformSpace space = TS_LOCAL) { Translate(Vector3(delta), space); }
+    void Translate2D(const Vector2& delta, TransformSpace space = TransformSpace::Local) { Translate(Vector3(delta), space); }
 
 
     /// Rotate the scene node in the chosen transform space.
     /// Rotate the scene node in the chosen transform space.
-    void Rotate(const Quaternion& delta, TransformSpace space = TS_LOCAL);
+    void Rotate(const Quaternion& delta, TransformSpace space = TransformSpace::Local);
 
 
     /// Rotate the scene node in the chosen transform space (for Urho2D).
     /// Rotate the scene node in the chosen transform space (for Urho2D).
-    void Rotate2D(float delta, TransformSpace space = TS_LOCAL) { Rotate(Quaternion(delta), space); }
+    void Rotate2D(float delta, TransformSpace space = TransformSpace::Local) { Rotate(Quaternion(delta), space); }
 
 
     /// Rotate around a point in the chosen transform space.
     /// Rotate around a point in the chosen transform space.
-    void RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TS_LOCAL);
+    void RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TransformSpace::Local);
 
 
     /// Rotate around a point in the chosen transform space (for Urho2D).
     /// Rotate around a point in the chosen transform space (for Urho2D).
-    void RotateAround2D(const Vector2& point, float delta, TransformSpace space = TS_LOCAL)
+    void RotateAround2D(const Vector2& point, float delta, TransformSpace space = TransformSpace::Local)
     {
     {
         RotateAround(Vector3(point), Quaternion(delta), space);
         RotateAround(Vector3(point), Quaternion(delta), space);
     }
     }
 
 
     /// Rotate around the X axis.
     /// Rotate around the X axis.
-    void Pitch(float angle, TransformSpace space = TS_LOCAL);
+    void Pitch(float angle, TransformSpace space = TransformSpace::Local);
     /// Rotate around the Y axis.
     /// Rotate around the Y axis.
-    void Yaw(float angle, TransformSpace space = TS_LOCAL);
+    void Yaw(float angle, TransformSpace space = TransformSpace::Local);
     /// Rotate around the Z axis.
     /// Rotate around the Z axis.
-    void Roll(float angle, TransformSpace space = TS_LOCAL);
+    void Roll(float angle, TransformSpace space = TransformSpace::Local);
     /// Look at a target position in the chosen transform space. Note that the up vector is always specified in world space. Return true if successful, or false if resulted in an illegal rotation, in which case the current rotation remains.
     /// Look at a target position in the chosen transform space. Note that the up vector is always specified in world space. Return true if successful, or false if resulted in an illegal rotation, in which case the current rotation remains.
-    bool LookAt(const Vector3& target, const Vector3& up = Vector3::UP, TransformSpace space = TS_WORLD);
+    bool LookAt(const Vector3& target, const Vector3& up = Vector3::UP, TransformSpace space = TransformSpace::World);
     /// Modify scale in parent space uniformly.
     /// Modify scale in parent space uniformly.
     void Scale(float scale);
     void Scale(float scale);
     /// Modify scale in parent space.
     /// Modify scale in parent space.

+ 1 - 1
bin/Data/Scripts/07_Billboards.as

@@ -241,7 +241,7 @@ void AnimateScene(float timeStep)
 
 
     // Rotate the lights around the world Y-axis
     // Rotate the lights around the world Y-axis
     for (uint i = 0; i < lightNodes.length; ++i)
     for (uint i = 0; i < lightNodes.length; ++i)
-        lightNodes[i].Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
+        lightNodes[i].Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TransformSpace::World);
 
 
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (uint i = 0; i < billboardNodes.length; ++i)
     for (uint i = 0; i < billboardNodes.length; ++i)

+ 2 - 2
bin/Data/Scripts/45_InverseKinematics.as

@@ -230,7 +230,7 @@ void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventDa
         float footOffset = leftFoot_.worldPosition.y - jackNode_.worldPosition.y;
         float footOffset = leftFoot_.worldPosition.y - jackNode_.worldPosition.y;
         leftEffector_.targetPosition = result.position + result.normal * footOffset;
         leftEffector_.targetPosition = result.position + result.normal * footOffset;
         // Rotate foot according to normal
         // Rotate foot according to normal
-        leftFoot_.Rotate(Quaternion(Vector3(0, 1, 0), result.normal), TS_WORLD);
+        leftFoot_.Rotate(Quaternion(Vector3(0, 1, 0), result.normal), TransformSpace::World);
     }
     }
 
 
     // Same deal with the right foot
     // Same deal with the right foot
@@ -240,7 +240,7 @@ void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventDa
         result = scene_.physicsWorld.RaycastSingle(Ray(rightFootPosition + result.normal, -result.normal), 2);
         result = scene_.physicsWorld.RaycastSingle(Ray(rightFootPosition + result.normal, -result.normal), 2);
         float footOffset = rightFoot_.worldPosition.y - jackNode_.worldPosition.y;
         float footOffset = rightFoot_.worldPosition.y - jackNode_.worldPosition.y;
         rightEffector_.targetPosition = result.position + result.normal * footOffset;
         rightEffector_.targetPosition = result.position + result.normal * footOffset;
-        rightFoot_.Rotate(Quaternion(Vector3(0, 1, 0), result.normal), TS_WORLD);
+        rightFoot_.Rotate(Quaternion(Vector3(0, 1, 0), result.normal), TransformSpace::World);
     }
     }
 
 
     solver_.Solve();
     solver_.Solve();

+ 1 - 1
bin/Data/Scripts/Editor/EditorScene.as

@@ -901,7 +901,7 @@ bool SceneSmartDuplicateNode()
     Node@ newInstance = parent.children[parent.numChildren-1];
     Node@ newInstance = parent.children[parent.numChildren-1];
     SelectNode(newInstance, false);
     SelectNode(newInstance, false);
     newInstance.worldPosition = lastInstancePosition;
     newInstance.worldPosition = lastInstancePosition;
-    newInstance.Translate(offset, TS_WORLD);
+    newInstance.Translate(offset, TransformSpace::World);
     newInstance.name = parent.name + "Instance" + String(parent.numChildren-1);
     newInstance.name = parent.name + "Instance" + String(parent.numChildren-1);
 
 
     lastOffsetForSmartDuplicate = offset;
     lastOffsetForSmartDuplicate = offset;

+ 1 - 1
bin/Data/Scripts/Editor/EditorView.as

@@ -1579,7 +1579,7 @@ void CameraMoveForward(Vector3 trans)
 {
 {
     cameraSmoothInterpolate.Stop();
     cameraSmoothInterpolate.Stop();
     
     
-    cameraNode.Translate(trans, TS_PARENT);
+    cameraNode.Translate(trans, TransformSpace::Parent);
 }
 }
 
 
 void CameraRotateAroundLookAt(Quaternion rot)
 void CameraRotateAroundLookAt(Quaternion rot)