GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/node-drawable.h Lines: 2 9 22.2 %
Date: 2020-05-14 11:23:33 Branches: 1 6 16.7 %

Line Branch Exec Source
1
//
2
//  node-drawable.h
3
//  gepetto-viewer
4
//
5
//  Created by Joseph Mirabel in 2018
6
//  Copyright (c) 2018 LAAS-CNRS. All rights reserved.
7
//
8
9
#ifndef GEPETTO_VIEWER_NODEDRAWABLE_HH
10
#define GEPETTO_VIEWER_NODEDRAWABLE_HH
11
12
#include <gepetto/viewer/node.h>
13
14
namespace gepetto {
15
namespace viewer {
16
    DEF_CLASS_SMART_PTR(NodeDrawable)
17
18
    /** Implementation of the drawable object in OSG render engine */
19
    class NodeDrawable : public Node
20
    {
21
    private:
22
        void init ();
23
24
    protected:
25
        ::osg::ShapeDrawableRefPtr shape_drawable_ptr_;
26
27
        void redrawShape ();
28
29
        /** Constructor */
30
1
        NodeDrawable (const std::string& name) : Node (name) { init (); }
31
32
        /** Copy constructor */
33
        NodeDrawable (const Node& other) : Node (other) { init (); }
34
35
    public:
36
        virtual void setAlpha (const float& alpha)
37
        {
38
          osgVector4 color = this->getColor();
39
          color[3] = alpha;
40
          this->setColor (color);
41
        }
42
43
	float getAlpha() const
44
        {
45
          return getColor () [3];
46
        }
47
48
        virtual void setColor(const osgVector4 &color);
49
50
        virtual osgVector4 getColor() const;
51
52
        virtual void setTexture(const std::string& image_path);
53
54
        /** Destructor */
55
1
        virtual ~NodeDrawable() {}
56
    };
57
} /* namespace viewer */
58
} /* namespace gepetto */
59
60
#endif /* GEPETTO_VIEWER_NODEDRAWABLE_HH */