cleaning up script and component implementations
This commit is contained in:
parent
c207493454
commit
a5dea1ede1
6 changed files with 44 additions and 17 deletions
|
@ -30,8 +30,6 @@ public:
|
|||
protected:
|
||||
|
||||
node* _node;
|
||||
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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<ref> _path;
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef PW_SCRIPTING_SCRIPT_HPP
|
||||
#define PW_SCRIPTING_SCRIPT_HPP
|
||||
|
||||
|
||||
#include <pw/core/globals.hpp>
|
||||
|
||||
#include <string>
|
||||
|
@ -18,6 +17,7 @@ public:
|
|||
|
||||
struct state {
|
||||
virtual int run(const std::string& script) = 0;
|
||||
virtual ~state() = default;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
@ -62,7 +62,11 @@ void lua_state::load_modules() {
|
|||
"x", scripting::property(scripting::resolve<const Scalar&() const>(&quaterniond::x), &quaterniond::set_x),
|
||||
"y", scripting::property(scripting::resolve<const Scalar&() const>(&quaterniond::y), &quaterniond::set_y),
|
||||
"z", scripting::property(scripting::resolve<const Scalar&() const>(&quaterniond::z), &quaterniond::set_z),
|
||||
"w", scripting::property(scripting::resolve<const Scalar&() const>(&quaterniond::w), &quaterniond::set_w)
|
||||
"w", scripting::property(scripting::resolve<const Scalar&() const>(&quaterniond::w), &quaterniond::set_w),
|
||||
"dot",&quaterniond::dot,
|
||||
"inverse",&quaterniond::inverse,
|
||||
"normalized",&quaterniond::normalized,
|
||||
"lerp",&quaterniond::lerp
|
||||
// "v",&vector3d::values,
|
||||
// "clone",&vector3d::clone
|
||||
);
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue