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_blend 5 #define tools_sg_blend 6 7 #include "node" 8 #include "sf_vec3f" 9 #include "render_action" 10 11 #include "../colorfs" 12 13 namespace tools { 14 namespace sg { 15 16 class blend : public node { 17 TOOLS_NODE(blend,tools::sg::blend,node) 18 public: 19 sf<bool> on; 20 public: 21 virtual const desc_fields& node_desc_fields() const { 22 TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::blend) 23 static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count. 24 TOOLS_ARG_FIELD_DESC(on) 25 ); 26 return s_v; 27 } 28 private: 29 void add_fields(){ 30 add_field(&on); 31 } 32 public: 33 virtual void render(render_action& a_action) { 34 state& state = a_action.state(); 35 state.m_GL_BLEND = on.value(); 36 a_action.set_blend(state.m_GL_BLEND); 37 } 38 public: 39 blend() 40 :parent() 41 ,on(false) 42 { 43 add_fields(); 44 } 45 virtual ~blend(){} 46 public: 47 blend(const blend& a_from) 48 :parent(a_from) 49 ,on(a_from.on) 50 { 51 add_fields(); 52 } 53 blend& operator=(const blend& a_from){ 54 parent::operator=(a_from); 55 on = a_from.on; 56 return *this; 57 } 58 }; 59 60 }} 61 62 #endif