gepetto-viewer  4.12.1
An user-friendly Graphical Interface
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 
26 
27  osgVector4 color1_;
28  osgVector4 color2_;
29 
31  LeafNodeGroundWeakPtr weak_ptr_;
32 
34  ::osg::Vec3ArrayRefPtr vertices_array_ptr_;
35  ::osg::Vec4ArrayRefPtr colors_array_ptr_;
36 
38  ::osg::GeometryRefPtr grid_geometry_ptr_;
39  ::osg::ref_ptr< ::osg::DrawArrays > draw_array_ptr_;
40 
42  void init();
43 
44  void updateVertices();
45 
53  LeafNodeGround(const std::string& name, int nX, int nY,
54  float square_length, float square_width, const osgVector4& color1, const osgVector4& color2);
55 
57  void initWeakPtr( const LeafNodeGroundWeakPtr& other_weak_ptr );
58 
59  protected:
60  public:
61 
70  static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY,
71  float square_length, float square_width);
72 
73  static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY, float square_length, float square_width, const osgVector4& color1, const osgVector4& color2);
74 
75  static LeafNodeGroundPtr_t create(const std::string& name);
76 
77 
81  LeafNodeGroundPtr_t self(void) const;
82 
86  void setColor (const osgVector4 &color);
87 
92  virtual void setColor1(const osgVector4 &color1);
93 
94  const osgVector4& getColor1() const
95  {
96  return color1_;
97  }
98 
103  virtual void setColor2(const osgVector4 &color2);
104 
105  const osgVector4& getColor2() const
106  {
107  return color2_;
108  }
114  virtual void setColors(const osgVector4 &color1 , const osgVector4 &color2);
115 
120  //virtual void setShadowMode (const ShadowMode& shadow_state) {
121  // Node::setShadowMode ( shadow_state );
122  //}
123 
125 
127  virtual ~LeafNodeGround();
128  };
129 } /* namespace viewer */
130 } /* namespace gepetto */
131 
132 #endif /* GEPETTO_VIEWER_LEAFNODEGROUND_HH */
Definition: leaf-node-ground.h:18
::osg::Vec4f osgVector4
Definition: config-osg.h:110
Definition: action-search-bar.hh:27
const osgVector4 & getColor2() const
Definition: leaf-node-ground.h:105
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
const osgVector4 & getColor1() const
Definition: leaf-node-ground.h:94
Abstract base class of 3D objects in a scene.
Definition: node.h:28
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:124