Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/normal 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_normal
0005 #define tools_sg_normal
0006 
0007 #include "node"
0008 #include "sf_vec3f"
0009 #include "render_action"
0010 
0011 #include <vector>
0012 
0013 namespace tools {
0014 namespace sg {
0015 
0016 class normal : public node {
0017   TOOLS_NODE(normal,tools::sg::normal,node)
0018 public:
0019   sf_vec3f vec;
0020 public:
0021   virtual const desc_fields& node_desc_fields() const {
0022     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::normal)
0023     static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
0024       TOOLS_ARG_FIELD_DESC(vec)
0025     );
0026     return s_v;
0027   }
0028 private:
0029   void add_fields(){
0030     add_field(&vec);
0031   }
0032 public:
0033   virtual void render(render_action& a_action) {
0034     state& state = a_action.state();
0035     state.m_normal = vec.value();
0036     a_action.normal(state.m_normal);
0037   }
0038 public:
0039   normal()
0040   :parent()
0041   ,vec(vec3f(0,0,1))
0042   {
0043     add_fields();
0044   }
0045   virtual ~normal(){}
0046 public:
0047   normal(const normal& a_from)
0048   :parent(a_from)
0049   ,vec(a_from.vec)
0050   {
0051     add_fields();
0052   }
0053   normal& operator=(const normal& a_from){
0054     parent::operator=(a_from);
0055     vec = a_from.vec;
0056     return *this;
0057   }
0058 };
0059 
0060 }}
0061 
0062 #endif