gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
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
14namespace gepetto {
15namespace viewer {
16DEF_CLASS_SMART_PTR(LeafNodeGround)
17
18class LeafNodeGround : public Node {
19 private:
24
25 osgVector4 color1_;
26 osgVector4 color2_;
27
29 LeafNodeGroundWeakPtr weak_ptr_;
30
32 ::osg::Vec3ArrayRefPtr vertices_array_ptr_;
33 ::osg::Vec4ArrayRefPtr colors_array_ptr_;
34
36 ::osg::GeometryRefPtr grid_geometry_ptr_;
37 ::osg::ref_ptr< ::osg::DrawArrays> draw_array_ptr_;
38
40 void init();
41
42 void updateVertices();
43
51 LeafNodeGround(const std::string& name, int nX, int nY, float square_length,
52 float square_width, const osgVector4& color1,
53 const osgVector4& color2);
54
56 void initWeakPtr(const LeafNodeGroundWeakPtr& other_weak_ptr);
57
58 protected:
59 public:
68 static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY,
69 float square_length, float square_width);
70
71 static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY,
72 float square_length, float square_width,
73 const osgVector4& color1,
74 const osgVector4& color2);
75
76 static LeafNodeGroundPtr_t create(const std::string& name);
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 { return color1_; }
95
100 virtual void setColor2(const osgVector4& color2);
101
102 const osgVector4& getColor2() const { return color2_; }
108 virtual void setColors(const osgVector4& color1, const osgVector4& color2);
109
114 // virtual void setShadowMode (const ShadowMode& shadow_state) {
115 // Node::setShadowMode ( shadow_state );
116 // }
117
119
122};
123} /* namespace viewer */
124} /* namespace gepetto */
125
126#endif /* GEPETTO_VIEWER_LEAFNODEGROUND_HH */
Definition leaf-node-ground.h:18
const osgVector4 & getColor1() const
Definition leaf-node-ground.h:94
void setColor(const osgVector4 &color)
LeafNodeGroundPtr_t self(void) const
Returns a shared pointer of the object itself.
virtual void setColor2(const osgVector4 &color2)
Allow to define color2.
const osgVector4 & getColor2() const
Definition leaf-node-ground.h:102
static LeafNodeGroundPtr_t create(const std::string &name, int nX, int nY, float square_length, float square_width, const osgVector4 &color1, const osgVector4 &color2)
static LeafNodeGroundPtr_t create(const std::string &name, int nX, int nY, float square_length, float square_width)
Constructor with all useful parameters.
virtual void setColor1(const osgVector4 &color1)
Allow to define color1.
virtual void setColors(const osgVector4 &color1, const osgVector4 &color2)
Allow to define both colors.
static LeafNodeGroundPtr_t create(const std::string &name)
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:118
Abstract base class of 3D objects in a scene.
Definition node.h:25
Definition node-property.h:522
::osg::Vec4f osgVector4
Definition config-osg.h:100
#define DEF_CLASS_SMART_PTR(className)
Definition macros.h:51
Definition action-search-bar.hh:27