gKit2 light
Public Member Functions | Protected Attributes | List of all members

#include <draw.h>

Public Member Functions

 DrawParam ()
 constructeur par defaut. More...
 
DrawParammodel (const Transform &m)
 modifie la transformation model utilisee pour afficher l'objet. More...
 
DrawParamview (const Transform &m)
 modifie la transformation view utilisee pour afficher l'objet. More...
 
DrawParamprojection (const Transform &m)
 modifie la transformation projection utilisee pour afficher l'objet. More...
 
DrawParamcamera (const Orbiter &o)
 utilise les transformations view et projection definies par une camera. More...
 
DrawParamcamera (const Orbiter &o, const float width, const float height, const float fov)
 utilise les transformations view et projection definies par une camera. parametres explicites de la projection. More...
 
DrawParamlight (const Point &p, const Color &c=White())
 eclaire l'objet avec une source ponctuelle, de position p et de couleur c. More...
 
DrawParamtexture (const GLuint t)
 plaque une texture a la surface de l'objet. More...
 
void draw (Mesh &mesh) const
 dessine l'objet avec l'ensemble des parametres definis. More...
 
const Pointlight () const
 renvoie la position de la lumière More...
 

Protected Attributes

Transform m_model
 
Transform m_view
 
Transform m_projection
 
bool m_use_light
 
Point m_light
 
Color m_light_color
 
bool m_use_texture
 
GLuint m_texture
 

Detailed Description

representation des options / parametres d'un draw. permet de donner tous les parametres d'un draw de maniere flexible.

exemple :

Mesh objet= { ... };
DrawParam param;
param.light(Point(0, 20, 0), Red());
param.camera(orbiter);
param.draw(objet);

ou de maniere encore plus compacte :

DrawParam().light(Point(0, 20, 0), Red()).model(m).camera(orbiter).draw(objet);

les parametres peuvent etre decrits dans un ordre quelconque, mais DrawParam::draw() doit etre appele en dernier.

Definition at line 50 of file draw.h.

Constructor & Destructor Documentation

DrawParam::DrawParam ( )
inline

constructeur par defaut.

Definition at line 54 of file draw.h.

54 : m_model(), m_view(), m_projection(), m_use_light(false), m_light(), m_light_color(), m_use_texture(false), m_texture(0) {}

Member Function Documentation

DrawParam& DrawParam::model ( const Transform m)
inline

modifie la transformation model utilisee pour afficher l'objet.

Definition at line 57 of file draw.h.

57 { m_model= m; return *this; }
DrawParam& DrawParam::view ( const Transform m)
inline

modifie la transformation view utilisee pour afficher l'objet.

Definition at line 59 of file draw.h.

59 { m_view= m; return *this; }
DrawParam& DrawParam::projection ( const Transform m)
inline

modifie la transformation projection utilisee pour afficher l'objet.

Definition at line 61 of file draw.h.

61 { m_projection= m; return *this; }
DrawParam& DrawParam::camera ( const Orbiter o)
inline

utilise les transformations view et projection definies par une camera.

Definition at line 64 of file draw.h.

64 { m_view= o.view(); m_projection= o.projection((float) window_width(), (float) window_height(), 45); return *this; }
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
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
DrawParam& DrawParam::camera ( const Orbiter o,
const float  width,
const float  height,
const float  fov 
)
inline

utilise les transformations view et projection definies par une camera. parametres explicites de la projection.

Definition at line 66 of file draw.h.

66 { m_view= o.view(); m_projection= o.projection(width, height, fov); return *this; }
Transform view() const
renvoie la transformation vue.
Definition: orbiter.cpp:40
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
DrawParam& DrawParam::light ( const Point p,
const Color c = White() 
)
inline

eclaire l'objet avec une source ponctuelle, de position p et de couleur c.

Definition at line 68 of file draw.h.

68 { m_use_light= true; m_light= p; m_light_color=c; return *this; }
DrawParam& DrawParam::texture ( const GLuint  t)
inline

plaque une texture a la surface de l'objet.

Definition at line 70 of file draw.h.

70 { m_use_texture= true; m_texture= t; return *this; }
void DrawParam::draw ( Mesh mesh) const

dessine l'objet avec l'ensemble des parametres definis.

Definition at line 41 of file draw.cpp.

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 }
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
const Point& DrawParam::light ( ) const
inline

renvoie la position de la lumière

Definition at line 76 of file draw.h.

76 { return m_light; }

The documentation for this class was generated from the following files: