GCC Code Coverage Report


Directory: ./
File: include/gepetto/viewer/leaf-node-face.h
Date: 2024-08-14 11:04:57
Exec Total Coverage
Lines: 0 3 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 //
2 // leaf-node-face.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_LEAFNODEFACE_HH
10 #define GEPETTO_VIEWER_LEAFNODEFACE_HH
11
12 #include <gepetto/viewer/node.h>
13
14 namespace gepetto {
15 namespace viewer {
16
17 DEF_CLASS_SMART_PTR(LeafNodeFace)
18
19 /** Implementation of the Face GraphicalObject in OSG render */
20 class LeafNodeFace : public Node {
21 private:
22 /** Associated weak pointer */
23 LeafNodeFaceWeakPtr weak_ptr_;
24
25 /** Associated Geometry for face*/
26 ::osg::GeometryRefPtr face_ptr_;
27 ::osg::Vec3ArrayRefPtr vertices_;
28 ::osg::Vec4ArrayRefPtr color_ptr_;
29
30 void init();
31
32 /* Default constructor */
33 LeafNodeFace(const std::string& name, const osgVector3& point1,
34 const osgVector3& point2, const osgVector3& point3);
35 LeafNodeFace(const std::string& name, const osgVector3& point1,
36 const osgVector3& point2, const osgVector3& point3,
37 const osgVector4& color);
38 LeafNodeFace(const std::string& name, const osgVector3& point1,
39 const osgVector3& point2, const osgVector3& point3,
40 const osgVector3& point4);
41 LeafNodeFace(const std::string& name, const osgVector3& point1,
42 const osgVector3& point2, const osgVector3& point3,
43 const osgVector3& point4, const osgVector4& color);
44
45 /* Copy constructor */
46 LeafNodeFace(const LeafNodeFace& other);
47
48 /** Initialize weak_ptr */
49 void initWeakPtr(LeafNodeFaceWeakPtr other_weak_ptr);
50
51 protected:
52 public:
53 void addVertex(const osgVector3& vertex);
54 /** Static method which create a new box defined by the half_axis vector
55 */
56 static LeafNodeFacePtr_t create(const std::string& name,
57 const osgVector3& point1,
58 const osgVector3& point2,
59 const osgVector3& point3);
60 static LeafNodeFacePtr_t create(const std::string& name,
61 const osgVector3& point1,
62 const osgVector3& point2,
63 const osgVector3& point3,
64 const osgVector4& color);
65 static LeafNodeFacePtr_t create(const std::string& name,
66 const osgVector3& point1,
67 const osgVector3& point2,
68 const osgVector3& point3,
69 const osgVector3& point4);
70 static LeafNodeFacePtr_t create(const std::string& name,
71 const osgVector3& point1,
72 const osgVector3& point2,
73 const osgVector3& point3,
74 const osgVector3& point4,
75 const osgVector4& color);
76
77 /** Static method for creating a clone of box other with the copy constructor
78 */
79 static LeafNodeFacePtr_t createCopy(LeafNodeFacePtr_t other);
80
81 /** Proceed to a clonage of the current object defined by the copy constructor
82 */
83 virtual LeafNodeFacePtr_t clone(void) const;
84
85 /** Copy
86 \brief Proceed to a copy of the currend object as clone
87 */
88 virtual NodePtr_t copy() const { return clone(); }
89
90 /** Return a shared pointer of the current object
91 */
92 LeafNodeFacePtr_t self(void) const;
93
94 // set color
95 void setColor(const osgVector4& color);
96
97 void setTexture(const std::string& image_path);
98
99 /// Get number of vertices
100 std::size_t nbVertices() const { return vertices_->size(); }
101
102 SCENE_VIEWER_ACCEPT_VISITOR;
103
104 /** Destructor */
105 virtual ~LeafNodeFace();
106 };
107 } /* namespace viewer */
108 } /* namespace gepetto */
109
110 #endif /* GEPETTO_VIEWER_LEAFNODEFACE_HH */
111