GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-collada.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-collada.h
3
//  gepetto-viewer
4
//
5
//  Created by Justin Carpentier, Anthony Couret, Mathieu Geisert in November 2014.
6
//  Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7
//
8
9
#ifndef GEPETTO_VIEWER_LEAFNODECOLLADA_HH
10
#define GEPETTO_VIEWER_LEAFNODECOLLADA_HH
11
12
#include <gepetto/viewer/node.h>
13
#include <osgDB/ReadFile>
14
15
16
namespace gepetto {
17
namespace viewer {
18
    DEF_CLASS_SMART_PTR(LeafNodeCollada)
19
20
    /** Implementation of the Collada GraphicalObject in OSG render */
21
    class LeafNodeCollada : public Node
22
    {
23
    private:
24
25
        std::string collada_file_path_;
26
        std::string texture_file_path_;
27
28
        /** Associated weak pointer */
29
        LeafNodeColladaWeakPtr weak_ptr_;
30
31
        /** Associated Node Shape */
32
        ::osg::GroupRefPtr group_ptr_;
33
        ::osg::NodeRefPtr collada_ptr_;
34
35
        void init();
36
37
        /* Default constructor */
38
        LeafNodeCollada(const std::string& name, const std::string& collada_file_path);
39
        LeafNodeCollada(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
40
        LeafNodeCollada(const std::string& name, const ::osg::NodeRefPtr& node, const std::string& collada_file_path);
41
        /* Copy constructor */
42
        LeafNodeCollada(const LeafNodeCollada& other);
43
44
        /** Initialize weak_ptr */
45
        void initWeakPtr (LeafNodeColladaWeakPtr other_weak_ptr);
46
47
        //static void setColor(osg::NodeRefPtr osgNode_ptr,const osgVector4& color);
48
49
    protected:
50
    public:
51
        /** Static method which create a new LeafNodeCollada
52
         */
53
        static LeafNodeColladaPtr_t create(const std::string& name, ::osg::NodeRefPtr mesh, const std::string& collada_file_path);
54
        static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path);
55
        static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
56
57
        /** Static method for creating a clone of LeafNodeCollada other
58
         */
59
        static LeafNodeColladaPtr_t createCopy(LeafNodeColladaPtr_t other);
60
61
        /** Proceed to a clonage of the current object defined by the copy constructor
62
         */
63
        virtual LeafNodeColladaPtr_t clone(void) const;
64
65
        /** Returns a pointer to the NodeRefPtr  */
66
        ::osg::NodeRefPtr getColladaPtr(void);
67
68
        /** Copy
69
         \brief Proceed to a copy of the currend object as clone
70
         */
71
        virtual LeafNodeColladaPtr_t copy() const { return clone(); }
72
73
        /** Return a shared pointer of the current object
74
         */
75
        LeafNodeColladaPtr_t self(void) const;
76
77
        void setColor(const osgVector4& color);
78
79
        osgVector4 getColor () const;
80
81
        void setTexture(const std::string& image_path);
82
83
        const std::string& meshFilePath () const;
84
85
        const std::string& textureFilePath () const;
86
87
	virtual void setAlpha(const float& alpha);
88
	virtual osg::ref_ptr<osg::Node> getOsgNode() const;
89
90
        /// Remove any osg::LightSource of this mesh.
91
        void removeLightSources ();
92
93
        SCENE_VIEWER_ACCEPT_VISITOR;
94
95
        /** Destructor */
96
        virtual ~LeafNodeCollada();
97
98
    };
99
} /* namespace viewer */
100
} /* namespace gepetto */
101
102
#endif /* GEPETTO_VIEWER_LEAFNODECOLLADA_HH */