g4tools  5.4.0
normal
Go to the documentation of this file.
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 {
18 public:
20 public:
21  virtual const desc_fields& node_desc_fields() const {
23  static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
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:
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
node
tools::sg::state
Definition: state:25
tools::sg::normal::render
virtual void render(render_action &a_action)
Definition: normal:33
tools::sg::normal::operator=
normal & operator=(const normal &a_from)
Definition: normal:53
render_action
tools::sg::node
Definition: node:28
TOOLS_NODE
#define TOOLS_NODE(a__class, a__sclass, a__parent)
Definition: node:324
tools::sg::sf_vec3f
Definition: sf_vec3f:14
tools::sg::state::m_normal
vec3f m_normal
Definition: state:260
tools::sg::normal::vec
sf_vec3f vec
Definition: normal:19
tools::sg::normal::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: normal:21
tools::sg::desc_fields
Definition: field_desc:148
sf_vec3f
tools::sg::normal
Definition: normal:16
tools::sg::normal::normal
normal()
Definition: normal:39
tools::sg::normal::normal
normal(const normal &a_from)
Definition: normal:47
tools::vec3f
Definition: vec3f:13
tools::sg::render_action
Definition: render_action:24
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::render_action::normal
virtual void normal(float, float, float)=0
tools::sg::node::add_field
void add_field(field *a_field)
Definition: node:128
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::states::state
const sg::state & state() const
Definition: states:76
tools::sg::normal::~normal
virtual ~normal()
Definition: normal:45
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71