Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/rgba is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_rgba
0005 #define tools_sg_rgba
0006 
0007 #include "node"
0008 
0009 #include "sf_vec"
0010 #include "render_action"
0011 #include "../colorfs"
0012 
0013 namespace tools {
0014 namespace sg {
0015 
0016 class rgba : public node {
0017   TOOLS_NODE(rgba,tools::sg::rgba,node)
0018 public:
0019   sf_vec<colorf,float> color;
0020 public:
0021   virtual const desc_fields& node_desc_fields() const {
0022     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::rgba)
0023     static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
0024       TOOLS_ARG_FIELD_DESC(color)
0025     );
0026     return s_v;
0027   }
0028 private:
0029   void add_fields(){
0030     add_field(&color);
0031   }
0032 public:
0033   virtual void render(render_action& a_action) {
0034     state& state = a_action.state();
0035     state.m_color = color.value();
0036     a_action.color4f(state.m_color);
0037   }
0038 public:
0039   rgba()
0040   :parent()
0041   ,color(colorf_grey())
0042   {
0043     add_fields();
0044   }
0045   virtual ~rgba(){}
0046 public:
0047   rgba(const rgba& a_from)
0048   :parent(a_from)
0049   ,color(a_from.color)
0050   {
0051     add_fields();
0052   }
0053   rgba& operator=(const rgba& a_from){
0054     parent::operator=(a_from);
0055     color = a_from.color;
0056     return *this;
0057   }
0058 };
0059 
0060 }}
0061 
0062 #endif