gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
leaf-node-line.h
Go to the documentation of this file.
1//
2// leaf-node-line.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_LEAFNODELINE_HH
10#define GEPETTO_VIEWER_LEAFNODELINE_HH
11
14
15namespace gepetto {
16namespace viewer {
17DEF_CLASS_SMART_PTR(LeafNodeLine)
18
19class LeafNodeLine : public Node {
20 private:
22 LeafNodeLineWeakPtr weak_ptr_;
23
25 ::osg::GeometryRefPtr beam_ptr_;
26 ::osg::ref_ptr< ::osg::DrawArrays> drawArray_ptr_;
27 ::osg::Vec3ArrayRefPtr points_ptr_;
28 ::osg::Vec4ArrayRefPtr color_ptr_;
29
30 BackfaceDrawingProperty backfaceDrawing_;
31
32 void init();
33
34 /* Default constructor */
35 LeafNodeLine(const std::string& name, const osgVector3& start_point,
36 const osgVector3& end_point);
37 LeafNodeLine(const std::string& name, const osgVector3& start_point,
38 const osgVector3& end_point, const osgVector4& color);
39 LeafNodeLine(const std::string& name, const ::osg::Vec3ArrayRefPtr& points,
40 const osgVector4& color);
41
42 /* Copy constructor */
43 LeafNodeLine(const LeafNodeLine& other);
44
46 void initWeakPtr(LeafNodeLineWeakPtr other_weak_ptr);
47
48 protected:
49 public:
52 static LeafNodeLinePtr_t create(const std::string& name,
53 const osgVector3& start_point,
54 const osgVector3& end_point);
55 static LeafNodeLinePtr_t create(const std::string& name,
56 const osgVector3& start_point,
57 const osgVector3& end_point,
58 const osgVector4& color);
59 static LeafNodeLinePtr_t create(const std::string& name,
60 const ::osg::Vec3ArrayRefPtr& points,
61 const osgVector4& color);
62
65 static LeafNodeLinePtr_t createCopy(LeafNodeLinePtr_t other);
66
69 virtual LeafNodeLinePtr_t clone(void) const;
70
74 virtual NodePtr_t copy() const { return clone(); }
75
78 LeafNodeLinePtr_t self(void) const;
79
85 virtual void setStartPoint(const osgVector3& start_point);
86
88
91 virtual void setEndPoint(const osgVector3& end_point);
92
94
99 virtual void setMode(const GLenum& mode);
100
101 GLenum getMode() const;
102
105 virtual void setPoints(const osgVector3& start_point,
106 const osgVector3& end_point);
107
108 virtual void setPoints(const ::osg::Vec3ArrayRefPtr& points);
109
112 void setPointsSubset(const int first, const std::size_t count);
113
114 ::osg::Vec3ArrayRefPtr getPoints() { return points_ptr_; }
115
116 void setColor(const osgVector4& color);
117 void setColors(const ::osg::Vec4ArrayRefPtr& color);
118
120 ::osg::Vec4ArrayRefPtr color_array_ptr =
121 dynamic_cast<osg::Vec4Array*>(beam_ptr_->getColorArray());
122 ASSERT(color_array_ptr,
123 "Problem of dynamic casting from VecArray to Vec4Array");
124
125 return color_array_ptr->at(0);
126 }
127
128 ::osg::GeometryRefPtr geometry() const { return beam_ptr_; }
129
131
133 virtual ~LeafNodeLine();
134};
135
136} /* namespace viewer */
137} /* namespace gepetto */
138
139#endif /* GEPETTO_VIEWER_LEAFNODELINE_HH */
Definition leaf-node-line.h:19
virtual void setStartPoint(const osgVector3 &start_point)
void setColors(const ::osg::Vec4ArrayRefPtr &color)
virtual void setPoints(const ::osg::Vec3ArrayRefPtr &points)
LeafNodeLinePtr_t self(void) const
osgVector3 getEndPoint() const
void setPointsSubset(const int first, const std::size_t count)
static LeafNodeLinePtr_t createCopy(LeafNodeLinePtr_t other)
osgVector3 getStartPoint() const
static LeafNodeLinePtr_t create(const std::string &name, const ::osg::Vec3ArrayRefPtr &points, const osgVector4 &color)
osgVector4 getColor() const
Definition leaf-node-line.h:119
static LeafNodeLinePtr_t create(const std::string &name, const osgVector3 &start_point, const osgVector3 &end_point)
virtual void setEndPoint(const osgVector3 &end_point)
SCENE_VIEWER_ACCEPT_VISITOR
Definition leaf-node-line.h:130
void setColor(const osgVector4 &color)
virtual void setPoints(const osgVector3 &start_point, const osgVector3 &end_point)
virtual void setMode(const GLenum &mode)
::osg::GeometryRefPtr geometry() const
Definition leaf-node-line.h:128
static LeafNodeLinePtr_t create(const std::string &name, const osgVector3 &start_point, const osgVector3 &end_point, const osgVector4 &color)
virtual LeafNodeLinePtr_t clone(void) const
virtual NodePtr_t copy() const
Proceed to a copy of the currend object as clone.
Definition leaf-node-line.h:74
::osg::Vec3ArrayRefPtr getPoints()
Definition leaf-node-line.h:114
Abstract base class of 3D objects in a scene.
Definition node.h:25
::osg::Vec3f osgVector3
Definition config-osg.h:99
::osg::Vec4f osgVector4
Definition config-osg.h:100
#define ASSERT(condition, message)
Definition macros.h:40
#define DEF_CLASS_SMART_PTR(className)
Definition macros.h:51
Definition action-search-bar.hh:27