gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
node-drawable.h
Go to the documentation of this file.
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
14namespace gepetto {
15namespace viewer {
16DEF_CLASS_SMART_PTR(NodeDrawable)
17
18
19class NodeDrawable : public Node {
20 private:
21 void init();
22
23 protected:
24 ::osg::ShapeDrawableRefPtr shape_drawable_ptr_;
25
27
29 NodeDrawable(const std::string& name) : Node(name) { init(); }
30
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
50 virtual ~NodeDrawable() {}
51};
52} /* namespace viewer */
53} /* namespace gepetto */
54
55#endif /* GEPETTO_VIEWER_NODEDRAWABLE_HH */
Definition node-drawable.h:19
virtual void setColor(const osgVector4 &color)
virtual ~NodeDrawable()
Definition node-drawable.h:50
NodeDrawable(const Node &other)
Definition node-drawable.h:32
virtual osgVector4 getColor() const
::osg::ShapeDrawableRefPtr shape_drawable_ptr_
Definition node-drawable.h:24
virtual void setTexture(const std::string &image_path)
NodeDrawable(const std::string &name)
Definition node-drawable.h:29
float getAlpha() const
Definition node-drawable.h:41
virtual void setAlpha(const float &alpha)
Definition node-drawable.h:35
Abstract base class of 3D objects in a scene.
Definition node.h:25
::osg::Vec4f osgVector4
Definition config-osg.h:100
#define DEF_CLASS_SMART_PTR(className)
Definition macros.h:51
Definition action-search-bar.hh:27