gKit2 light
draw.cpp
1 
2 #include "draw.h"
3 #include "window.h"
4 
5 
6 void draw( Mesh& m, const Transform& model, const Transform& view, const Transform& projection, const GLuint texture )
7 {
8  m.draw(model, view, projection, /* use light */ false, Point(), White(), /* use texture */ true, texture);
9 }
10 
11 void draw( Mesh& m, const Transform& model, const Transform& view, const Transform& projection )
12 {
13  m.draw(model, view, projection, /* use light */ false, Point(), White(), /* use texture */ false, 0);
14 }
15 
16 void draw( Mesh& m, const Transform& model, const Orbiter& camera, const GLuint texture )
17 {
18  // recupere les transformations
19  Transform view= camera.view();
20  Transform projection= camera.projection((float) window_width(), (float) window_height(), 45);
21 
22  // affiche l'objet
23  draw(m, model, view, projection, texture);
24 }
25 
26 void draw( Mesh& m, const Orbiter& camera, const GLuint texture )
27 {
28  draw(m, Identity(), camera, texture);
29 }
30 
31 void draw( Mesh& m, const Orbiter& camera )
32 {
33  draw(m, Identity(), camera, 0);
34 }
35 
36 void draw( Mesh& m, const Transform& model, const Orbiter& camera )
37 {
38  draw(m, model, camera, 0);
39 }
40 
41 void DrawParam::draw( Mesh& mesh ) const
42 {
43  mesh.draw(m_model, m_view, m_projection, /* use light */ m_use_light, m_light, m_light_color, /* use texture */ m_use_texture, m_texture);
44 }
45 
46 void draw( Mesh& m, const DrawParam& param )
47 {
48  param.draw(m);
49 }
representation de la camera, type orbiter, placee sur une sphere autour du centre de l'objet...
Definition: orbiter.h:16
void draw(const Transform &model, const Transform &view, const Transform &projection, const bool use_light, const Point &light, const Color &light_color, const bool use_texture, const GLuint texture)
Definition: mesh.cpp:271
representation d'un objet / maillage.
Definition: mesh.h:88
Definition: draw.h:50
Transform Identity()
construit la transformation identite.
Definition: mat.cpp:103
void draw(Mesh &m, const Transform &model, const Transform &view, const Transform &projection, const GLuint texture)
applique une texture a la surface de l'objet. ne fonctionne que si les coordonnees de textures sont f...
Definition: draw.cpp:6
Transform view() const
renvoie la transformation vue.
Definition: orbiter.cpp:40
int window_width()
renvoie la largeur de la fenetre de l'application.
Definition: window.cpp:14
Color White()
utilitaire. renvoie une couleur blanche.
Definition: color.cpp:10
void draw(Mesh &mesh) const
dessine l'objet avec l'ensemble des parametres definis.
Definition: draw.cpp:41
Transform projection(const float width, const float height, const float fov) const
renvoie la projection reglee pour une image d'aspect width / height, et une ouverture de fov degres...
Definition: orbiter.cpp:47
int window_height()
renvoie la hauteur de la fenetre de l'application.
Definition: window.cpp:18
representation d'une transformation, une matrice 4x4, organisee par ligne / row major.
Definition: mat.h:20
representation d'un point 3d.
Definition: vec.h:19