Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 3 4 #ifndef tools_sg_normal 5 #define tools_sg_normal 6 7 #include "node" 8 #include "sf_vec3f" 9 #include "render_action" 10 11 #include <vector> 12 13 namespace tools { 14 namespace sg { 15 16 class normal : public node { 17 TOOLS_NODE(normal,tools::sg::normal,node) 18 public: 19 sf_vec3f vec; 20 public: 21 virtual const desc_fields& node_desc_fields() const { 22 TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::normal) 23 static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count. 24 TOOLS_ARG_FIELD_DESC(vec) 25 ); 26 return s_v; 27 } 28 private: 29 void add_fields(){ 30 add_field(&vec); 31 } 32 public: 33 virtual void render(render_action& a_action) { 34 state& state = a_action.state(); 35 state.m_normal = vec.value(); 36 a_action.normal(state.m_normal); 37 } 38 public: 39 normal() 40 :parent() 41 ,vec(vec3f(0,0,1)) 42 { 43 add_fields(); 44 } 45 virtual ~normal(){} 46 public: 47 normal(const normal& a_from) 48 :parent(a_from) 49 ,vec(a_from.vec) 50 { 51 add_fields(); 52 } 53 normal& operator=(const normal& a_from){ 54 parent::operator=(a_from); 55 vec = a_from.vec; 56 return *this; 57 } 58 }; 59 60 }} 61 62 #endif