diff --git a/src/core/include/pw/core/vector.hpp b/src/core/include/pw/core/vector.hpp index 5b43346..e9e3425 100644 --- a/src/core/include/pw/core/vector.hpp +++ b/src/core/include/pw/core/vector.hpp @@ -104,9 +104,11 @@ public: return vector<4,T>(x(),y(),z(),w); } +#if _GCC_STUPID_ inline std::tuple values() const { return std::make_tuple(x(),y(),z()); } +#endif diff --git a/src/core/tests/pwcore_test_matrix.cpp b/src/core/tests/pwcore_test_matrix.cpp index 4b4c449..b9e3501 100644 --- a/src/core/tests/pwcore_test_matrix.cpp +++ b/src/core/tests/pwcore_test_matrix.cpp @@ -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; diff --git a/src/scene/include/pw/scene/component.hpp b/src/scene/include/pw/scene/component.hpp new file mode 100644 index 0000000..1b891fc --- /dev/null +++ b/src/scene/include/pw/scene/component.hpp @@ -0,0 +1,29 @@ +#ifndef PW_SCENE_COMPONENT_HPP +#define PW_SCENE_COMPONENT_HPP + +#include + +#include +#include + +namespace pw { + +/** + * @brief components represent attributes of the scene nodes + */ +class component { +public: + + typedef std::shared_ptr ref; + typedef std::vector array; + + //! only very few components can be attached multiple times + virtual bool singular() const { return true; } +protected: + + std::string _name; +}; + +} + +#endif diff --git a/src/scene/include/pw/scene/node.hpp b/src/scene/include/pw/scene/node.hpp index 8f921cb..0725227 100644 --- a/src/scene/include/pw/scene/node.hpp +++ b/src/scene/include/pw/scene/node.hpp @@ -2,14 +2,16 @@ #define PW_SCENE_NODE_HPP #include +#include #include #include 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; }; diff --git a/src/scene/src/CMakeLists.txt b/src/scene/src/CMakeLists.txt index 9b6f08c..6cb5e39 100644 --- a/src/scene/src/CMakeLists.txt +++ b/src/scene/src/CMakeLists.txt @@ -1,29 +1,30 @@ set(hdrs - ../include/pw/scene/node.hpp - ) + ../include/pw/scene/component.hpp + ../include/pw/scene/node.hpp + ) set(srcs - node.cpp - nodepath.cpp - component.cpp - ) + node.cpp + nodepath.cpp + component.cpp + ) add_library(pwscene - STATIC - ${hdrs} - ${srcs} - ) + STATIC + ${hdrs} + ${srcs} + ) target_include_directories( - pwscene - PUBLIC - ../include - ) + pwscene + PUBLIC + ../include + ) target_include_directories( - pwscene - PUBLIC - ) + pwscene + PUBLIC + ) target_link_libraries(pwscene pwcore) diff --git a/src/scene/src/component.cpp b/src/scene/src/component.cpp index e0088f2..436603b 100644 --- a/src/scene/src/component.cpp +++ b/src/scene/src/component.cpp @@ -1,3 +1,6 @@ + +#include "pw/scene/component.hpp" + #include #include @@ -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; diff --git a/src/scripting/src/script.cpp b/src/scripting/src/script.cpp index 758b85a..8b8e32d 100644 --- a/src/scripting/src/script.cpp +++ b/src/scripting/src/script.cpp @@ -53,7 +53,7 @@ void lua_state::load_modules() { "x", scripting::property(scripting::resolve(&vector3d::x), &vector3d::set_x), "y", scripting::property(scripting::resolve(&vector3d::y), &vector3d::set_y), "z", scripting::property(scripting::resolve(&vector3d::z), &vector3d::set_z), - "v",&vector3d::values, + // "v",&vector3d::values, "clone",&vector3d::clone );