GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-face.h Lines: 0 3 0.0 %
Date: 2020-05-14 11:23:33 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
    {
22
    private:
23
        /** Associated weak pointer */
24
        LeafNodeFaceWeakPtr weak_ptr_;
25
26
        /** Associated Geometry for face*/
27
        ::osg::GeometryRefPtr face_ptr_;
28
        ::osg::Vec3ArrayRefPtr vertices_;
29
        ::osg::Vec4ArrayRefPtr color_ptr_;
30
31
        void init ();
32
33
34
        /* Default constructor */
35
        LeafNodeFace(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3);
36
        LeafNodeFace(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector4& color);
37
        LeafNodeFace(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector3& point4);
38
        LeafNodeFace(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector3& point4, const osgVector4& color);
39
40
        /* Copy constructor */
41
        LeafNodeFace(const LeafNodeFace& other);
42
43
        /** Initialize weak_ptr */
44
        void initWeakPtr(LeafNodeFaceWeakPtr other_weak_ptr);
45
46
    protected:
47
    public:
48
        void addVertex (const osgVector3& vertex);
49
        /** Static method which create a new box defined by the half_axis vector
50
         */
51
        static LeafNodeFacePtr_t create(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3);
52
        static LeafNodeFacePtr_t create(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector4& color);
53
        static LeafNodeFacePtr_t create(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector3& point4);
54
        static LeafNodeFacePtr_t create(const std::string& name, const osgVector3& point1, const osgVector3& point2, const osgVector3& point3, const osgVector3& point4, const osgVector4& color);
55
56
        /** Static method for creating a clone of box other with the copy constructor
57
         */
58
        static LeafNodeFacePtr_t createCopy(LeafNodeFacePtr_t other);
59
60
        /** Proceed to a clonage of the current object defined by the copy constructor
61
         */
62
        virtual LeafNodeFacePtr_t clone(void) const;
63
64
        /** Copy
65
         \brief Proceed to a copy of the currend object as clone
66
         */
67
        virtual NodePtr_t copy() const { return clone(); }
68
69
        /** Return a shared pointer of the current object
70
         */
71
        LeafNodeFacePtr_t self(void) const;
72
73
        // set color
74
        void setColor (const osgVector4& color);
75
76
        void setTexture(const std::string& image_path);
77
78
	/// Get number of vertices
79
	std::size_t nbVertices () const { return vertices_->size ();}
80
81
        SCENE_VIEWER_ACCEPT_VISITOR;
82
83
        /** Destructor */
84
        virtual ~LeafNodeFace();
85
86
    };
87
} /* namespace viewer */
88
} /* namespace gepetto */
89
90
#endif /* GEPETTO_VIEWER_LEAFNODEFACE_HH */