diff --git a/src/scene/include/pw/scene/component.hpp b/src/scene/include/pw/scene/component.hpp index de091cd..a4592d9 100644 --- a/src/scene/include/pw/scene/component.hpp +++ b/src/scene/include/pw/scene/component.hpp @@ -30,8 +30,6 @@ public: protected: node* _node; - - std::string _name; }; } diff --git a/src/scene/include/pw/scene/transform.hpp b/src/scene/include/pw/scene/transform.hpp index 138f9f7..ac75209 100644 --- a/src/scene/include/pw/scene/transform.hpp +++ b/src/scene/include/pw/scene/transform.hpp @@ -8,15 +8,22 @@ namespace pw { class transform : public component { public: + using component::component; const matrix44d& local() const; void set_local(const matrix44d &local); + void set_global(const matrix44d &global); + + void update(); + protected: matrix44d _local; + matrix44d _global; + matrix44d _global_inverse; std::vector _path; diff --git a/src/scene/src/transform.cpp b/src/scene/src/transform.cpp index 5337751..4eb237d 100644 --- a/src/scene/src/transform.cpp +++ b/src/scene/src/transform.cpp @@ -13,4 +13,14 @@ void transform::set_local(const matrix44d &local) _local = local; } +void transform::set_global(const matrix44d &global) +{ + _global = global; // need to set global inverse +} + + +void transform::update() { + +} + } diff --git a/src/scripting/include/pw/scripting/script.hpp b/src/scripting/include/pw/scripting/script.hpp index b1e9f94..609d5e5 100644 --- a/src/scripting/include/pw/scripting/script.hpp +++ b/src/scripting/include/pw/scripting/script.hpp @@ -1,7 +1,6 @@ #ifndef PW_SCRIPTING_SCRIPT_HPP #define PW_SCRIPTING_SCRIPT_HPP - #include #include @@ -18,6 +17,7 @@ public: struct state { virtual int run(const std::string& script) = 0; + virtual ~state() = default; }; protected: diff --git a/src/scripting/src/script.cpp b/src/scripting/src/script.cpp index e2c50bb..fc7fc20 100644 --- a/src/scripting/src/script.cpp +++ b/src/scripting/src/script.cpp @@ -62,7 +62,11 @@ void lua_state::load_modules() { "x", scripting::property(scripting::resolve(&quaterniond::x), &quaterniond::set_x), "y", scripting::property(scripting::resolve(&quaterniond::y), &quaterniond::set_y), "z", scripting::property(scripting::resolve(&quaterniond::z), &quaterniond::set_z), - "w", scripting::property(scripting::resolve(&quaterniond::w), &quaterniond::set_w) + "w", scripting::property(scripting::resolve(&quaterniond::w), &quaterniond::set_w), + "dot",&quaterniond::dot, + "inverse",&quaterniond::inverse, + "normalized",&quaterniond::normalized, + "lerp",&quaterniond::lerp // "v",&vector3d::values, // "clone",&vector3d::clone ); diff --git a/src/scripts/demos/simple_000.lua b/src/scripts/demos/simple_000.lua index 999d9c5..d5a072f 100644 --- a/src/scripts/demos/simple_000.lua +++ b/src/scripts/demos/simple_000.lua @@ -6,27 +6,35 @@ print("hello pixwerx!") local v = pw.vector3.new() v:set(0,1,2) --- objects need to be cloned -local v2 = v:clone() - --- manipulate stuff -v.x = 0.2 -v.y = pw.pi +print("v",v.x,v.y,v.z) -print("v : ", v:v()) -print("v2: ", v2:v()) +---- objects need to be cloned +----local v2 = v:clone() +--local v2 = v + +---- manipulate stuff +--v.x = 0.2 +--v.y = pw.pi + + +--print("v : ", v:v()) +--print("v2: ", v2:v()) local q = pw.quaternion.new() - print("q",q.x,q.y,q.z,q.w) +qi = q:inverse() +print("q.inverse",qi.x,qi.y,qi.z,qi.w) -local aa = pw.axisangle.new() +qm = pw.quaternion.lerp(q,qi) +print("q.m",qm.x,qm.y,qm.z,qm.w) --- assign vector to axis -aa.axis = v +--local aa = pw.axisangle.new() -print("aa",aa.axis.x) +---- assign vector to axis +----aa.axis = v + +--print("aa",aa.axis.x) --local scene = pw:scene.new()