moved component out and about
This commit is contained in:
parent
75d55faa31
commit
75fb4c27f7
7 changed files with 59 additions and 29 deletions
|
@ -104,9 +104,11 @@ public:
|
|||
return vector<4,T>(x(),y(),z(),w);
|
||||
}
|
||||
|
||||
#if _GCC_STUPID_
|
||||
inline std::tuple<T,T,T> values() const {
|
||||
return std::make_tuple(x(),y(),z());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ int main(int argc,char **argv) {
|
|||
|
||||
std::cout << "m = " << pw::serialize::matrix(m) << std::endl;
|
||||
|
||||
|
||||
std::cout << "row_stride() : " << m.row_stride() << std::endl;
|
||||
std::cout << "col_stride() : " << m.col_stride() << std::endl;
|
||||
std::cout << "rows() : " << m.rows() << std::endl;
|
||||
|
|
29
src/scene/include/pw/scene/component.hpp
Normal file
29
src/scene/include/pw/scene/component.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef PW_SCENE_COMPONENT_HPP
|
||||
#define PW_SCENE_COMPONENT_HPP
|
||||
|
||||
#include <pw/core/globals.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace pw {
|
||||
|
||||
/**
|
||||
* @brief components represent attributes of the scene nodes
|
||||
*/
|
||||
class component {
|
||||
public:
|
||||
|
||||
typedef std::shared_ptr<component> ref;
|
||||
typedef std::vector<ref> array;
|
||||
|
||||
//! only very few components can be attached multiple times
|
||||
virtual bool singular() const { return true; }
|
||||
protected:
|
||||
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -2,14 +2,16 @@
|
|||
#define PW_SCENE_NODE_HPP
|
||||
|
||||
#include <pw/core/globals.hpp>
|
||||
#include <pw/scene/component.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace pw {
|
||||
|
||||
class component;
|
||||
|
||||
/**
|
||||
* @brief nodes are representing the hierarchical structore fo the scene graph
|
||||
*/
|
||||
class node {
|
||||
public:
|
||||
|
||||
|
@ -54,6 +56,8 @@ protected:
|
|||
ref_array _children;
|
||||
ptr_array _parents;
|
||||
|
||||
component::array _components;
|
||||
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
set(hdrs
|
||||
../include/pw/scene/component.hpp
|
||||
../include/pw/scene/node.hpp
|
||||
)
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
#include "pw/scene/component.hpp"
|
||||
|
||||
#include <pw/core/vector.hpp>
|
||||
#include <pw/core/quaternion.hpp>
|
||||
|
||||
|
@ -5,14 +8,6 @@
|
|||
|
||||
namespace pw {
|
||||
|
||||
class component {
|
||||
|
||||
std::string _name;
|
||||
|
||||
//! only very few components can be attached multiple times
|
||||
virtual bool singular() const { return true; }
|
||||
};
|
||||
|
||||
class transform : public component {
|
||||
|
||||
matrix44d _local;
|
||||
|
|
|
@ -53,7 +53,7 @@ void lua_state::load_modules() {
|
|||
"x", scripting::property(scripting::resolve<const Scalar&() const>(&vector3d::x), &vector3d::set_x),
|
||||
"y", scripting::property(scripting::resolve<const Scalar&() const>(&vector3d::y), &vector3d::set_y),
|
||||
"z", scripting::property(scripting::resolve<const Scalar&() const>(&vector3d::z), &vector3d::set_z),
|
||||
"v",&vector3d::values,
|
||||
// "v",&vector3d::values,
|
||||
"clone",&vector3d::clone
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue