Browse Source

Remove Node's Lua scalar transform functions, like SetPositionXYZ.

aster2013 11 years ago
parent
commit
293cd434fb

+ 4 - 6
Bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -51,9 +51,9 @@ function CreateScene()
     local NUM_OBJECTS = 2000
     for i = 1, NUM_OBJECTS do
         local boxNode = scene_:CreateChild("Box")
-        boxNode:SetPositionXYZ(Random(200.0) - 100.0, Random(200.0) - 100.0, Random(200.0) - 100.0)
+        boxNode.position = Vector3(Random(200.0) - 100.0, Random(200.0) - 100.0, Random(200.0) - 100.0)
         -- Orient using random pitch, yaw and roll Euler angles
-        boxNode:SetRotationXYZ(Random(360.0), Random(360.0), Random(360.0))
+        boxNode.rotation = Quaternion(Random(360.0), Random(360.0), Random(360.0))
         local boxObject = boxNode:CreateComponent("StaticModel")
         boxObject.model = cache:GetResource("Model", "Models/Box.mdl")
         boxObject.material = cache:GetResource("Material", "Materials/Stone.xml")
@@ -117,7 +117,7 @@ function MoveCamera(timeStep)
     pitch = Clamp(pitch, -90.0, 90.0)
 
     -- Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode:SetRotationXYZ(pitch, yaw, 0.0)
+    cameraNode.rotation = Quaternion(pitch, yaw, 0.0)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     local delta = MOVE_SPEED * timeStep
@@ -148,8 +148,6 @@ function HandleUpdate(eventType, eventData)
     MoveCamera(timeStep)
 end
 
-
-
 -- Rotator script object class. Script objects to be added to a scene node must implement the empty ScriptObject interface
 Rotator = ScriptObject()
 
@@ -161,5 +159,5 @@ function Rotator:Update(timeStep)
     local x = self.rotationSpeed[1] * timeStep
     local y = self.rotationSpeed[2] * timeStep
     local z = self.rotationSpeed[3] * timeStep
-    self.node:RotateXYZ(x, y, z)
+    self.node:Rotate(Quaternion(x, y, z))
 end

+ 6 - 3
Bin/Data/LuaScripts/10_RenderToTexture.lua

@@ -60,7 +60,7 @@ function CreateScene()
         -- Add our custom Rotator component which will rotate the scene node each frame, when the scene sends its update event.
         -- Simply set same rotation speed for all objects
         local rotator = boxNode:CreateScriptObject("Rotator")
-        rotator.rotationSpeed = Vector3(10.0, 20.0, 30.0)
+        rotator.rotationSpeed = { 10.0, 20.0, 30.0 }
     end
 
     -- Create a camera for the render-to-texture scene. Simply leave it at the world origin and let it observe the scene
@@ -222,10 +222,13 @@ end
 Rotator = ScriptObject()
 
 function Rotator:Start()
-    self.rotationSpeed = Vector3(0.0, 0.0, 0.0)
+    self.rotationSpeed = {0.0, 0.0, 0.0}
 end
 
 -- Update is called during the variable timestep scene update
 function Rotator:Update(timeStep)
-    self.node:RotateXYZ(self.rotationSpeed.x * timeStep, self.rotationSpeed.y * timeStep, self.rotationSpeed.z * timeStep)
+    local x = self.rotationSpeed[1] * timeStep
+    local y = self.rotationSpeed[2] * timeStep
+    local z = self.rotationSpeed[3] * timeStep
+    self.node:Rotate(Quaternion(x, y, z))
 end

+ 1 - 1
Bin/Data/LuaScripts/Rotator.lua

@@ -13,5 +13,5 @@ function Rotator:Update(timeStep)
     local x = self.rotationSpeed.x * timeStep
     local y = self.rotationSpeed.y * timeStep
     local z = self.rotationSpeed.z * timeStep
-    self.node:RotateXYZ(x, y, z)
+    self.node:Rotate(Quaternion(x, y, z))
 end

+ 4 - 229
Source/Engine/LuaScript/pkgs/Scene/Node.pkg

@@ -27,20 +27,13 @@ class Node : public Animatable
     
     void SetPosition(const Vector3& position);
     void SetPosition(const Vector2& position);
-    tolua_outside void NodeSetPositionXYZ @ SetPositionXYZ(float x, float y, float z);
-    
     void SetRotation(const Quaternion& rotation);
     void SetRotation(float rotation);
-    tolua_outside void NodeSetRotationXYZ @ SetRotationXYZ(float x, float y, float z);
-    
     void SetDirection(const Vector3& direction);
-    tolua_outside void NodeSetDirectionXYZ @ SetDirectionXYZ(float x, float y, float z);
-    
     void SetScale(float scale);
     void SetScale(const Vector3& scale);
     void SetScale(const Vector2& scale);
-    tolua_outside void NodeSetScaleXYZ @ SetScaleXYZ(float x, float y, float z);
-    
+
     void SetTransform(const Vector3& position, const Quaternion& rotation);
     void SetTransform(const Vector2& position, float rotation);
     void SetTransform(const Vector3& position, const Quaternion& rotation, float scale);
@@ -50,20 +43,13 @@ class Node : public Animatable
     
     void SetWorldPosition(const Vector3& position);
     void SetWorldPosition(const Vector2& position);
-    tolua_outside void NodeSetWorldPositionXYZ @ SetWorldPositionXYZ(float x, float y, float z);
-    
     void SetWorldRotation(const Quaternion& rotation);
     void SetWorldRotation(float rotation);
-    tolua_outside void NodeSetWorldRotationXYZ @ SetWorldRotationXYZ(float x, float y, float z);
-    
     void SetWorldDirection(const Vector3& direction);
-    tolua_outside void NodeSetWorldDirectionXYZ @ SetWorldDirectionXYZ(float x, float y, float z);
-    
     void SetWorldScale(float scale);
     void SetWorldScale(const Vector3& scale);
     void SetWorldScale(const Vector2& scale);
-    tolua_outside void NodeSetWorldScaleXYZ @ SetWorldScaleXYZ(float x, float y, float z);
-
+    
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation);
     void SetWorldTransform(const Vector2& position, float rotation);
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, float scale);
@@ -73,27 +59,20 @@ class Node : public Animatable
     
     void Translate(const Vector3& delta, TransformSpace space = TS_LOCAL);
     void Translate(const Vector2& delta, TransformSpace space = TS_LOCAL);
-    tolua_outside void NodeTranslateXYZ @ TranslateXYZ(float x, float y, float z, TransformSpace space = TS_LOCAL);
-
     void Rotate(const Quaternion& delta, TransformSpace space = TS_LOCAL);
     void Rotate(float delta, TransformSpace space = TS_LOCAL);
-    tolua_outside void NodeRotateXYZ @ RotateXYZ(float x, float y, float z, TransformSpace space = TS_LOCAL);
-
     void RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TS_LOCAL);
     void RotateAround(const Vector2& point, float delta, TransformSpace space = TS_LOCAL);
-    tolua_outside void NodeRotateAroundXYZ @ RotateAroundXYZ(float pX, float pY, float pZ, float dX, float dY, float dZ, TransformSpace space = TS_LOCAL);
 
     void Pitch(float angle, TransformSpace space = TS_LOCAL);
     void Yaw(float angle, TransformSpace space = TS_LOCAL);
     void Roll(float angle, TransformSpace space = TS_LOCAL);
     
     bool LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP, TransformSpace space = TS_WORLD);
-    tolua_outside bool NodeLookAtXYZ @ LookAtXYZ(float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f, TransformSpace space = TS_WORLD);
-
+    
     void Scale(float scale);
     void Scale(const Vector3& scale);
     void Scale(const Vector2& scale);
-    tolua_outside void NodeScaleXYZ @ ScaleXYZ(float x, float y, float z);
     
     void SetEnabled(bool enable);
     void SetEnabled(bool enable, bool recursive);
@@ -139,45 +118,20 @@ class Node : public Animatable
     Connection* GetOwner() const;
     
     const Vector3& GetPosition() const;
-    tolua_outside void NodeGetPositionXYZ @ GetPositionXYZ(float* x = 0.0f, float* y = 0.0f, float* z = 0.0f) const;
-    
     const Quaternion& GetRotation() const;
-    tolua_outside void NodeGetRotationXYZ @ GetRotationXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-    tolua_outside void NodeGetRotationWXYZ @ GetRotationWXYZ(float* *w = 0.0f, float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-    
     Vector3 GetDirection() const;
-    tolua_outside void NodeGetDirectionXYZ @ GetDirectionXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
     Vector3 GetUp() const;
-    tolua_outside void NodeGetUpXYZ @ GetUpXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-  
     Vector3 GetRight() const;
-    tolua_outside void NodeGetRightXYZ @ GetRightXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
     const Vector3& GetScale() const;
-    tolua_outside void NodeGetScaleXYZ @ GetScaleXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
     
     Matrix3x4 GetTransform() const;
-    
     Vector3 GetWorldPosition() const;
-    tolua_outside void NodeGetWorldPositionXYZ @ GetWorldPositionXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-    
     Quaternion GetWorldRotation() const;
-    tolua_outside void NodeGetWorldRotationXYZ @ GetWorldRotationXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-    tolua_outside void NodeGetWorldRotationWXYZ @ GetWorldRotationWXYZ(float* *w = 0.0f, float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-    
     Vector3 GetWorldDirection() const;
-    tolua_outside void NodeGetWorldDirectionXYZ @ GetWorldDirectionXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
     Vector3 GetWorldUp() const;
-    tolua_outside void NodeGetWorldUpXYZ @ GetWorldUpXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
     Vector3 GetWorldRight() const;
-    tolua_outside void NodeGetWorldRightXYZ @ GetWorldRightXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
     Vector3 GetWorldScale() const;
-    tolua_outside void NodeGetWorldScaleXYZ @ GetWorldScaleXYZ(float* *x = 0.0f, float* *y = 0.0f, float* *z = 0.0f) const;
-
+    
     const Matrix3x4& GetWorldTransform() const;
     Vector3 LocalToWorld(const Vector3& position) const;
     Vector3 LocalToWorld(const Vector4& vector) const;
@@ -258,185 +212,6 @@ static bool NodeSaveXML(const Node* node, File* file)
     return file ? node->SaveXML(*file) : false;
 }
 
-static void NodeSetPositionXYZ(Node* node, float x, float y, float z)
-{
-    node->SetPosition(Vector3(x, y, z));
-}
-
-static void NodeSetRotationXYZ(Node* node, float x, float y, float z)
-{
-    node->SetRotation(Quaternion(x, y, z));
-}
-
-static void NodeSetDirectionXYZ(Node* node, float x, float y, float z)
-{
-    node->SetDirection(Vector3(x, y, z));
-}
-
-static void NodeSetScaleXYZ(Node* node, float x, float y, float z)
-{
-    node->SetScale(Vector3(x, y, z));
-}
-
-static void NodeSetWorldPositionXYZ(Node* node, float x, float y, float z)
-{
-    node->SetWorldPosition(Vector3(x, y, z));
-}
-
-static void NodeSetWorldRotationXYZ(Node* node, float x, float y, float z)
-{
-    node->SetWorldRotation(Quaternion(x, y, z));
-}
-
-static void NodeSetWorldDirectionXYZ(Node* node, float x, float y, float z)
-{
-    node->SetWorldDirection(Vector3(x, y, z));
-}
-
-static void NodeSetWorldScaleXYZ(Node* node, float x, float y, float z)
-{
-    node->SetWorldScale(Vector3(x, y, z));
-}
-
-static void NodeTranslateXYZ(Node* node, float x, float y, float z, TransformSpace space = TS_LOCAL)
-{
-    node->Translate(Vector3(x, y, z), space);
-}
-
-static void NodeRotateXYZ(Node* node, float x, float y, float z, TransformSpace space = TS_LOCAL)
-{
-    node->Rotate(Quaternion(x, y, z), space);
-}
-
-static void NodeRotateAroundXYZ(Node* node, float pX, float pY, float pZ, float rX, float rY, float rZ, TransformSpace space = TS_LOCAL)
-{
-    node->RotateAround(Vector3(pX, pY, pZ), Quaternion(rX, rY, rZ), space);
-}
-
-static bool NodeLookAtXYZ(Node* node, float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f, TransformSpace space = TS_WORLD)
-{
-    return node->LookAt(Vector3(x, y, z), Vector3(upX, upY, upZ), space);
-}
-
-static void NodeScaleXYZ(Node* node, float x, float y, float z)
-{
-    node->Scale(Vector3(x, y, z));
-}
-
-static void NodeGetPositionXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Vector3& position = node->GetPosition();
-    *x =  position.x_;
-    *y =  position.y_;
-    *z =  position.z_;
-}
-
-static void NodeGetRotationXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Quaternion& rotation = node->GetRotation();
-    *x =  rotation.x_;
-    *y =  rotation.y_;
-    *z =  rotation.z_;
-}
-
-static void NodeGetRotationWXYZ(const Node* node, float* w, float* x, float* y, float* z)
-{
-    const Quaternion& rotation = node->GetRotation();
-    *w =  rotation.w_;
-    *x =  rotation.x_;
-    *y =  rotation.y_;
-    *z =  rotation.z_;
-}
-
-static void NodeGetDirectionXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Vector3& direction = node->GetDirection();
-    *x =  direction.x_;
-    *y =  direction.y_;
-    *z =  direction.z_;
-}
-
-static void NodeGetUpXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Vector3& up = node->GetUp();
-    *x =  up.x_;
-    *y =  up.y_;
-    *z =  up.z_;
-}
-
-static void NodeGetRightXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Vector3& right = node->GetRight();
-    *x =  right.x_;
-    *y =  right.y_;
-    *z =  right.z_;
-}
-
-static void NodeGetScaleXYZ(const Node* node, float* x, float* y, float* z)
-{
-    const Vector3& scale = node->GetScale();
-    *x =  scale.x_;
-    *y =  scale.y_;
-    *z =  scale.z_;
-}
-
-static void NodeGetWorldPositionXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Vector3 worldPosition = node->GetWorldPosition();
-    *x =  worldPosition.x_;
-    *y =  worldPosition.y_;
-    *z =  worldPosition.z_;
-}
-
-static void NodeGetWorldRotationXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Quaternion worldRotation = node->GetWorldRotation();
-    *x =  worldRotation.x_;
-    *y =  worldRotation.y_;
-    *z =  worldRotation.z_;
-}
-
-static void NodeGetWorldRotationWXYZ(const Node* node, float* w, float* x, float* y, float* z)
-{
-    Quaternion worldRotation = node->GetWorldRotation();
-    *w =  worldRotation.w_;
-    *x =  worldRotation.x_;
-    *y =  worldRotation.y_;
-    *z =  worldRotation.z_;
-}
-
-static void NodeGetWorldDirectionXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Vector3 worldDirection = node->GetWorldDirection();
-    *x =  worldDirection.x_;
-    *y =  worldDirection.y_;
-    *z =  worldDirection.z_;
-}
-
-static void NodeGetWorldUpXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Vector3 worldUp = node->GetWorldUp();
-    *x =  worldUp.x_;
-    *y =  worldUp.y_;
-    *z =  worldUp.z_;
-}
-
-static void NodeGetWorldRightXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Vector3 worldRight = node->GetWorldRight();
-    *x =  worldRight.x_;
-    *y =  worldRight.y_;
-    *z =  worldRight.z_;
-}
-
-static void NodeGetWorldScaleXYZ(const Node* node, float* x, float* y, float* z)
-{
-    Vector3 worldScale = node->GetWorldScale();
-    *x =  worldScale.x_;
-    *y =  worldScale.y_;
-    *z =  worldScale.z_;
-}
-
 // Disable generated CreateComponent function.
 #define TOLUA_DISABLE_tolua_SceneLuaAPI_Node_CreateComponent00