Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
coordinateaxes.hpp
Go to the documentation of this file.
1 
23 #ifndef __COORDINATEAXES__
24 #define __COORDINATEAXES__
25 
26 #include <tucano/mesh.hpp>
27 #include <tucano/shapes/arrow.hpp>
28 #include <Eigen/Dense>
29 #include <cmath>
30 
31 namespace Tucano
32 {
33 
34 namespace Shapes
35 {
36 
37 
44 class CoordinateAxes : public Tucano::Model {
45 
46 private:
47 
49 
50 public:
51 
56  {
58  cout << "creating arrow from axes" << endl;
59  arrow = Arrow(0.05, 0.8, 0.12, 0.2);
60  cout << "done arrow from axes" << endl;
61  }
62 
67  void render (const Tucano::Camera &camera, const Tucano::Camera &light)
68  {
69  glEnable(GL_DEPTH_TEST);
70 
71  arrow.resetModelMatrix();
72  arrow.modelMatrix()->scale(0.2);
73  arrow.modelMatrix()->rotate(this->modelMatrix()->rotation());
74 
75  arrow.setColor(Eigen::Vector4f(0.0, 0.0, 1.0, 1.0));
76  arrow.render(camera, light);
77 
78  arrow.modelMatrix()->rotate(Eigen::AngleAxisf(-M_PI*0.5, Eigen::Vector3f::UnitX()));
79  arrow.setColor(Eigen::Vector4f(0.0, 1.0, 0.0, 1.0));
80  arrow.render(camera, light);
81 
82  arrow.modelMatrix()->rotate(Eigen::AngleAxisf(M_PI*0.5, Eigen::Vector3f::UnitX()));
83  arrow.modelMatrix()->rotate(Eigen::AngleAxisf(M_PI*0.5, Eigen::Vector3f::UnitY()));
84  arrow.setColor(Eigen::Vector4f(1.0, 0.0, 0.0, 1.0));
85  arrow.render(camera, light);
86  }
87 
88 };
89 }
90 }
91 #endif
void setColor(const Eigen::Vector4f c)
Sets the arrow color.
Definition: arrow.hpp:134
Eigen::Affine3f * modelMatrix(void)
Returns a pointer to the model matrix.
Definition: model.hpp:112
Tucano::Shapes::Arrow arrow
Definition: coordinateaxes.hpp:48
Definition: bufferobject.hpp:34
The Model class is a holder for any kind of model, such as meshes, point clouds, surfaces ...
Definition: model.hpp:16
void render(const Tucano::Camera &camera, const Tucano::Camera &light)
Render camera representation.
Definition: coordinateaxes.hpp:67
Visual representation of a 3D coordinate axes.
Definition: coordinateaxes.hpp:44
CoordinateAxes()
Default Constructor.
Definition: coordinateaxes.hpp:55
void resetModelMatrix(void)
Resets the model matrix.
Definition: model.hpp:159
void render(const Tucano::Camera &camera, const Tucano::Camera &light)
Render arrow.
Definition: arrow.hpp:142
Defines an abstract camera with a projection and view matrices.
Definition: camera.hpp:37
A rounded arrow shape defined by a arrow and a cone.
Definition: arrow.hpp:85