// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_sg_normal #define tools_sg_normal #include "node" #include "sf_vec" #include "render_action" #include namespace tools { namespace sg { class normal : public node { TOOLS_NODE(normal,tools::sg::normal,node) public: sf_vec vec; public: virtual const std::vector& node_fields() const { TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::normal) static std::vector s_v; if(s_v.empty()) { s_v = parent::node_fields(); TOOLS_ADD_FIELD_DESC(vec) } return s_v; } private: void add_fields(){ add_field(&vec); } public: virtual void render(render_action& a_action) { a_action.normal(vec.value()); } public: normal() :parent() ,vec(vec3f(0,0,1)) { add_fields(); } virtual ~normal(){} public: normal(const normal& a_from) :parent(a_from) ,vec(a_from.vec) { add_fields(); } normal& operator=(const normal& a_from){ parent::operator=(a_from); vec = a_from.vec; return *this; } }; }} #endif