leaf-node-ground.h
Go to the documentation of this file.
1 //
2 // leaf-node-ground.h
3 // gepetto-viewer
4 //
5 // Created by Justin Carpentier, Mathieu Geisert in November 2014.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7 //
8 
9 #ifndef GEPETTO_VIEWER_LEAFNODEGROUND_HH
10 #define GEPETTO_VIEWER_LEAFNODEGROUND_HH
11 
12 #include <gepetto/viewer/node.h>
13 
14 namespace gepetto {
15 namespace viewer {
16  DEF_CLASS_SMART_PTR(LeafNodeGround)
17 
18  class LeafNodeGround : public Node
19  {
20  private:
21 
22  float length_;
23  float width_;
24  float square_length_;
25  float square_width_;
26 
27  osgVector4 color1_;
28  osgVector4 color2_;
29 
31  LeafNodeGroundWeakPtr weak_ptr_;
32 
34  ::osg::Vec4ArrayRefPtr colors_array_ptr_;
35 
37  ::osg::GeometryRefPtr grid_geometry_ptr_;
38 
40  void init();
41 
49  LeafNodeGround(const std::string& name, const float& length, const float& width,
50  const float& square_length, const float& square_width, const osgVector4& color1, const osgVector4& color2);
51 
53  LeafNodeGround(const LeafNodeGround& other);
54 
56  void initWeakPtr( const LeafNodeGroundWeakPtr& other_weak_ptr );
57 
58  protected:
59  public:
60 
65  static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width);
66 
75  static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width,
76  const float &square_length, const float &square_width);
77 
78  static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width, const float &square_length, const float &square_width, const osgVector4& color1, const osgVector4& color2);
79 
80  static LeafNodeGroundPtr_t create(const std::string& name);
81 
83  static LeafNodeGroundPtr_t createCopy( const LeafNodeGroundPtr_t &other );
84 
88  virtual LeafNodeGroundPtr_t clone(void) const;
89 
90 
94  virtual LeafNodeGroundPtr_t copy() const { return clone(); }
95 
99  LeafNodeGroundPtr_t self(void) const;
100 
104  void setColor (const osgVector4 &color);
105 
110  virtual void setColor1(const osgVector4 &color1);
111 
112  const osgVector4& getColor1() const
113  {
114  return color1_;
115  }
116 
121  virtual void setColor2(const osgVector4 &color2);
122 
123  const osgVector4& getColor2() const
124  {
125  return color2_;
126  }
132  virtual void setColors(const osgVector4 &color1 , const osgVector4 &color2);
133 
138  //virtual void setShadowMode (const ShadowMode& shadow_state) {
139  // Node::setShadowMode ( shadow_state );
140  //}
141 
143 
145  virtual ~LeafNodeGround();
146  };
147 } /* namespace viewer */
148 } /* namespace gepetto */
149 
150 #endif /* GEPETTO_VIEWER_LEAFNODEGROUND_HH */
Definition: leaf-node-ground.h:18
::osg::Vec4f osgVector4
Definition: config-osg.h:110
virtual LeafNodeGroundPtr_t copy() const
Proceed to a copy of the currend object as clone.
Definition: leaf-node-ground.h:94
Definition: action-search-bar.hh:27
const osgVector4 & getColor2() const
Definition: leaf-node-ground.h:123
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
const osgVector4 & getColor1() const
Definition: leaf-node-ground.h:112
Abstract base class of 3D objects in a scene.
Definition: node.h:27
SCENE_VIEWER_ACCEPT_VISITOR
Virtual method for setting the shadow mode of the object : receive, cast, both or no shadow...
Definition: leaf-node-ground.h:142