GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/node-drawable.h Lines: 2 7 28.6 %
Date: 2024-04-14 11:13:22 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
 private:
21
  void init();
22
23
 protected:
24
  ::osg::ShapeDrawableRefPtr shape_drawable_ptr_;
25
26
  void redrawShape();
27
28
  /** Constructor */
29
1
  NodeDrawable(const std::string& name) : Node(name) { init(); }
30
31
  /** Copy constructor */
32
  NodeDrawable(const Node& other) : Node(other) { init(); }
33
34
 public:
35
  virtual void setAlpha(const float& alpha) {
36
    osgVector4 color = this->getColor();
37
    color[3] = alpha;
38
    this->setColor(color);
39
  }
40
41
  float getAlpha() const { return getColor()[3]; }
42
43
  virtual void setColor(const osgVector4& color);
44
45
  virtual osgVector4 getColor() const;
46
47
  virtual void setTexture(const std::string& image_path);
48
49
  /** Destructor */
50
2
  virtual ~NodeDrawable() {}
51
};
52
} /* namespace viewer */
53
} /* namespace gepetto */
54
55
#endif /* GEPETTO_VIEWER_NODEDRAWABLE_HH */