Aldebaran documentation
|
C++ Libraries
|
index
libalmath
2.8.7.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
almath
scenegraph
scenebuilder.h
Go to the documentation of this file.
1
/*
2
* Copyright 2015 Aldebaran. All rights reserved.
3
*
4
*/
5
6
#ifndef LIB_ALMATH_SCENEGRAPH_SCENEBUILDER_H
7
#define LIB_ALMATH_SCENEGRAPH_SCENEBUILDER_H
8
9
#include <Eigen/Geometry>
10
#include <almath/api.h>
11
12
namespace
AL {
13
class
Mesh;
14
15
namespace
Math {
16
struct
Transform;
17
class
Sphere;
18
class
RoundedRectangle;
19
class
Pill;
20
class
Shape3D;
21
}
22
// Interface for a simple Scene builder.
23
//
24
// The scene is indeed simple:
25
//
26
// * all meshes have the same material
27
// * each node binds a single mesh, and a mesh is bound by a single node
28
// * there is no node hierarchy
29
// * there is no texture support (yet?)
30
//
31
//
32
// Possible future developments:
33
//
34
// * add texture support
35
// * add support for external meshes
36
// * add support for debugging markers (arrows, frames, lines, points)
37
// * add ids (and maybe scoped ids) to nodes so that one can target them later
38
// (maybe add an id for individual shapes color)
39
// * add animation support: let one
40
// * move
41
// * change color
42
// * toggle visibility
43
// of stuff at specific time
44
//
45
// One can imagine several implementations of this interface:
46
//
47
// * build the scene in a collada file
48
// * animate a collada scene by dumping collada animations
49
// (though we lack a nice portable collada animation viewer, maybe blender
50
// would fit the bill for specifically created collada files?)
51
// * build the scene in a node of the Ogre scene graph (we do not need to
52
// build the whole Ogre scene)
53
// * animate an ogre scene
54
// * idem with renderwidget?
55
// * write the animation in a ros bag
56
class
ALMATH_API
SceneBuilder
{
57
public
:
58
class
Color
{
59
public
:
60
Color
() : r(0.5f), g(0.5f), b(0.5f), a(0.5f) {}
61
float
r
, g, b, a;
62
};
63
64
// a class for configuration which can be used by the SceneBuilder
65
// implementations
66
class
Config
{
67
public
:
68
Config
() : nbArcVertices(2) {}
69
Color
color
;
70
// the number of intermediate vertices on the are of a rounded box
71
int
nbArcVertices
;
72
};
73
74
SceneBuilder
(
const
Config
&_config);
75
SceneBuilder
(
const
SceneBuilder
&other);
76
77
virtual
~
SceneBuilder
();
78
79
const
Config
&getConfig()
const
;
80
81
void
add(
const
Mesh
&mesh,
const
Eigen::Affine3f &tf);
82
void
add(
const
Mesh
&mesh,
const
Math::Transform
&tf);
83
void
add(
const
Math::Sphere
&shape,
const
Math::Transform
&tf);
84
void
add(
const
Math::RoundedRectangle
&shape,
const
Math::Transform
&tf);
85
void
add(
const
Math::Pill
&shape,
const
Math::Transform
&tf);
86
87
void
add(
const
Math::Shape3D
&shape,
const
Math::Transform
&tf);
88
89
protected
:
90
virtual
void
xAddMesh(
const
Mesh
&mesh,
const
Eigen::Affine3f &tf) = 0;
91
92
private
:
93
Config
_config;
94
};
95
}
96
97
#endif
AL::SceneBuilder::Color::Color
Color()
Definition:
scenebuilder.h:60
AL::SceneBuilder
Definition:
scenebuilder.h:56
AL::SceneBuilder::Config::color
Color color
Definition:
scenebuilder.h:69
AL::SceneBuilder::Config::Config
Config()
Definition:
scenebuilder.h:68
AL::SceneBuilder::Config::nbArcVertices
int nbArcVertices
Definition:
scenebuilder.h:71
AL::Math::Shape3D
Definition:
shapes3d.h:19
AL::Math::Sphere
Definition:
shapes3d.h:26
AL::Math::RoundedRectangle
Definition:
shapes3d.h:47
AL::SceneBuilder::Color
Definition:
scenebuilder.h:58
AL::SceneBuilder::Color::r
float r
Definition:
scenebuilder.h:61
AL::Mesh
Definition:
mesh.h:89
AL::Math::Pill
Definition:
shapes3d.h:76
AL::Math::Transform
A homogenous transformation matrix.
Definition:
altransform.h:23
AL::SceneBuilder::Config
Definition:
scenebuilder.h:66
Copyright Aldebaran Robotics