GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-mesh.h Lines: 0 2 0.0 %
Date: 2020-05-14 11:23:33 Branches: 0 2 0.0 %

Line Branch Exec Source
1
//
2
//  leaf-node-mesh.h
3
//  gepetto-viewer
4
//
5
//  Created by Olivier Stasse, Justin Carpentier, Anthony Couret, Mathieu Geisert in November 2014.
6
//  Copyright (c) 2016 LAAS-CNRS. All rights reserved.
7
//
8
9
#ifndef GEPETTO_VIEWER_LEAFNODEMESH_HH
10
#define GEPETTO_VIEWER_LEAFNODEMESH_HH
11
12
#include <gepetto/viewer/node.h>
13
#include <osg/PrimitiveSet>
14
#include <osg/Geometry>
15
16
namespace gepetto {
17
namespace viewer {
18
    DEF_CLASS_SMART_PTR(LeafNodeMesh)
19
20
    /** Implementation of the Mesh GraphicalObject in OSG render */
21
    class LeafNodeMesh : public Node
22
    {
23
    private:
24
25
        /** Associated weak pointer */
26
        LeafNodeMeshWeakPtr weak_ptr_;
27
28
        /** Associated mesh geometry */
29
	osg::GeometryRefPtr  mesh_geometry_ptr_;
30
31
        void init();
32
33
        /* Default constructor */
34
        LeafNodeMesh(const std::string &name);
35
        /* Copy constructor */
36
        LeafNodeMesh(const LeafNodeMesh& other);
37
        LeafNodeMesh(const std::string &name,const osgVector4 & color);
38
39
        /** Initialize weak_ptr */
40
        void initWeakPtr (LeafNodeMeshWeakPtr other_weak_ptr);
41
42
43
    protected:
44
    public:
45
        /** Static method which create a new LeafNodeCollada
46
         */
47
        static LeafNodeMeshPtr_t create(const std:: string &name);
48
    static LeafNodeMeshPtr_t create(const std::string &name, const osgVector4& color);
49
50
        /** Static method for creating a clone of LeafNodeMesh other
51
         */
52
        static LeafNodeMeshPtr_t createCopy(LeafNodeMeshPtr_t other);
53
54
        /** Proceed to a clonage of the current object defined by the copy constructor
55
         */
56
        virtual LeafNodeMeshPtr_t clone(void) const;
57
58
59
        /** Copy
60
         \brief Proceed to a copy of the currend object as clone
61
         */
62
        virtual LeafNodeMeshPtr_t copy() const { return clone(); }
63
64
        /** Return a shared pointer of the current object
65
         */
66
        LeafNodeMeshPtr_t self(void) const;
67
68
	void setColor(const osgVector4& color_diffuse);
69
70
        void setColor(const osgVector4& color_diffuse,
71
		      const osgVector4& color_specular,
72
		      const osgVector4& color_emissive);
73
74
        void setTexture(const std::string& image_path);
75
76
	virtual void setAlpha(const float& alpha);
77
	virtual osg::ref_ptr<osg::Node> getOsgNode() const;
78
79
        SCENE_VIEWER_ACCEPT_VISITOR;
80
81
	/** Add geometric data */
82
	/** Set the vertices of the mesh */
83
	void setVertexArray(osg::Vec3ArrayRefPtr arrayOfVertices);
84
85
	/** Add a primitive set to the mesh */
86
	void addPrimitiveSet(osg::DrawElementsUInt * aSetOfColors);
87
88
        void setColorBinding(osg::Geometry::AttributeBinding aColorBinding);
89
	/** Add colors */
90
	void setColorArray(osg::Vec4ArrayRefPtr colors);
91
92
        /** Add normals */
93
        void setNormalArray(osg::Vec3ArrayRefPtr normals);
94
        void setNormalBinding(osg::Geometry::AttributeBinding aNormalBinding);
95
        /** Destructor */
96
        virtual ~LeafNodeMesh();
97
98
    };
99
} /* namespace viewer */
100
} /* namespace gepetto */
101
102
#endif /* GEPETTO_VIEWER_LEAFNODECOLLADA_HH */