gKit2 light
List of all members

representation d'un objet / maillage. More...

#include <mesh.h>

Public Member Functions

construction.
 Mesh ()
 constructeur par defaut. More...
 
 Mesh (const GLenum primitives)
 constructeur. More...
 
int create (const GLenum primitives)
 construit les objets openGL. More...
 
int create (const GLenum primitives, const std::vector< vec3 > &positions)
 construit les objets openGL. a partir d'un ensemble de positions. More...
 
int create (const GLenum primitives, const std::vector< vec3 > &positions, const std::vector< unsigned > &indices)
 construit les objets openGL. a partir d'un ensemble de positions indexees. More...
 
int create (const GLenum primitives, const std::vector< vec3 > &positions, const std::vector< vec2 > &texcoords, const std::vector< vec3 > &normals, const std::vector< vec4 > &colors, const std::vector< unsigned > &indices)
 construit les objets openGL. a partir d'un ensemble de positions + attributs indexes. More...
 
void release ()
 detruit les objets openGL. More...
 
description des attributs des sommets.
Meshcolor (const vec4 &c)
 definit la couleur du prochain sommet. More...
 
Meshcolor (const Color &c)
 definit la couleur du prochain sommet. More...
 
Meshcolor (const float r, const float g, const float b, const float a=1)
 definit la couleur du prochain sommet. More...
 
Meshnormal (const vec3 &n)
 definit la normale du prochain sommet. More...
 
Meshnormal (const Vector &n)
 definit la normale du prochain sommet. More...
 
Meshnormal (const float x, const float y, const float z)
 definit la normale du prochain sommet. More...
 
Meshtexcoord (const vec2 &uv)
 definit les coordonnees de texture du prochain sommet. More...
 
Meshtexcoord (const float x, const float y)
 definit les coordonnees de texture du prochain sommet. More...
 
unsigned int vertex (const vec3 &p)
 insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet. More...
 
unsigned int vertex (const Point &p)
 insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet. More...
 
unsigned int vertex (const float x, const float y, const float z)
 insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet. More...
 
void clear ()
 vide la description. More...
 
description de triangles indexes.
Meshtriangle (const unsigned int a, const unsigned int b, const unsigned int c)
 
Meshtriangle_last (const int a, const int b, const int c)
 
Meshrestart_strip ()
 demarre un nouveau strip. a utiliser avec un objet composes de GL_TRIANGLE_STRIP, doit aussi fonctionner avec GL_TRIANGLE_FAN, GL_LINE_STRIP, GL_LINE_LOOP, etc. More...
 
Meshindex (const int a)
 
modification des attributs des sommets.
Meshcolor (const unsigned int id, const vec4 &c)
 modifie la couleur du sommet d'indice id. More...
 
Meshcolor (const unsigned int id, const Color &c)
 modifie la couleur du sommet d'indice id. More...
 
Meshcolor (const unsigned int id, const float r, const float g, const float b, const float a=1)
 modifie la couleur du sommet d'indice id. More...
 
Meshnormal (const unsigned int id, const vec3 &n)
 modifie la normale du sommet d'indice id. More...
 
Meshnormal (const unsigned int id, const Vector &n)
 modifie la normale du sommet d'indice id. More...
 
Meshnormal (const unsigned int id, const float x, const float y, const float z)
 modifie la normale du sommet d'indice id. More...
 
Meshtexcoord (const unsigned int id, const vec2 &uv)
 modifie les coordonnees du sommet d'indice id. More...
 
Meshtexcoord (const unsigned int id, const float x, const float y)
 modifie les coordonnees du sommet d'indice id. More...
 
void vertex (const unsigned int id, const vec3 &p)
 modifie la position du sommet d'indice id. More...
 
void vertex (const unsigned int id, const Point &p)
 modifie la position du sommet d'indice id. More...
 
void vertex (const unsigned int id, const float x, const float y, const float z)
 modifie la position du sommet d'indice id. More...
 
description des matieres.
const Materialsmaterials () const
 renvoie la description des matieres. More...
 
Materialsmaterials ()
 renvoie la description des matieres. More...
 
void materials (const Materials &materials)
 remplace la description des matieres. More...
 
const std::vector< unsigned int > & material_indices () const
 renvoie les indices des matieres des triangles. More...
 
Meshmaterial (const unsigned int id)
 definit la matiere du prochain triangle. id est l'indice d'une matiere ajoutee dans materials(), cf la classe Materials. ne fonctionne que pour les primitives GL_TRIANGLES, indexees ou pas. More...
 
description des triangles d'un maillage.
int triangle_count () const
 renvoie le nombre de triangles. More...
 
TriangleData triangle (const unsigned int id) const
 renvoie un triangle. More...
 
int triangle_material_index (const unsigned int id) const
 renvoie l'indice de la matiere d'un triangle. More...
 
const Materialtriangle_material (const unsigned int id) const
 renvoie la matiere d'un triangle. More...
 
std::vector< TriangleGroupgroups ()
 renvoie les groupes de triangles de meme matiere. re-organise les triangles. permet d'afficher l'objet matiere par matiere. More...
 
std::vector< TriangleGroupgroups (const std::vector< unsigned int > &triangle_properties)
 renvoie les groupes de triangles de meme 'propriete'. re-organise les triangles. More...
 
void bounds (Point &pmin, Point &pmax) const
 renvoie min et max les coordonnees des extremites des positions des sommets de l'objet (boite englobante alignee sur les axes, aabb). More...
 
Color default_color () const
 renvoie la couleur par defaut du mesh, utilisee si les sommets n'ont pas de couleur associee. More...
 
Meshdefault_color (const Color &color)
 modifie la couleur par defaut, utilisee si les sommets n'ont pas de couleur associee. More...
 
manipulation des buffers d'attributs.
int vertex_count () const
 renvoie le nombre de sommets. More...
 
int index_count () const
 renvoie le nombre d'indices de sommets. More...
 
const float * vertex_buffer () const
 renvoie l'adresse de la position du premier sommet. permet de construire les vertex buffers openGL. par convention, la position est un vec3, 3 GL_FLOAT. More...
 
std::size_t vertex_buffer_size () const
 renvoie la longueur (en octets) du vertex buffer. More...
 
const float * normal_buffer () const
 renvoie l'adresse de la normale du premier sommet. par convention, la normale est un vec3, 3 GL_FLOAT. More...
 
std::size_t normal_buffer_size () const
 renvoie la longueur (en octets) du normal buffer. More...
 
const float * texcoord_buffer () const
 renvoie l'adresse des coordonnees de textures du premier sommet. par convention, c'est un vec2, 2 GL_FLOAT. More...
 
std::size_t texcoord_buffer_size () const
 renvoie la taille (en octets) du texcoord buffer. More...
 
const float * color_buffer () const
 renvoie l'adresse de la couleur du premier sommet. par convention, la couleur est un vec4, 4 GL_FLOAT. More...
 
std::size_t color_buffer_size () const
 renvoie la taille (en octets) du color buffer. More...
 
const void * index_buffer () const
 renvoie l'adresse du premier indice du premier triangle. par convention c'est un uint, 1, GL_UNSIGNED_INT. More...
 
std::size_t index_buffer_size () const
 renvoie la taille (en octets) de l'index buffer. More...
 
const std::vector< vec3 > & positions () const
 
const std::vector< vec2 > & texcoords () const
 
const std::vector< vec3 > & normals () const
 
const std::vector< vec4 > & colors () const
 
const std::vector< unsigned int > & indices () const
 
bool has_position () const
 verifie que les attributs sont decrits de maniere coherente. More...
 
bool has_texcoord () const
 
bool has_normal () const
 
bool has_color () const
 
bool has_material_index () const
 
GLenum primitives () const
 renvoie le type de primitives. More...
 

gestion d'erreur.

bool operator== (const Mesh &m) const
 
GLuint create_buffers (const bool use_texcoord, const bool use_normal, const bool use_color, const bool use_material_index)
 construit les buffers et le vertex array object necessaires pour dessiner l'objet avec openGL. utilitaire. detruit par release( ). More...
 
void draw (const GLuint program, const bool use_position, const bool use_texcoord, const bool use_normal, const bool use_color, const bool use_material_index)
 dessine l'objet avec un shader program. More...
 
void draw (const int first, const int n, const GLuint program, const bool use_position, const bool use_texcoord, const bool use_normal, const bool use_color, const bool use_material_index)
 dessine une partie de l'objet avec un shader program. More...
 
static Mesherror ()
 

Detailed Description

representation d'un objet / maillage.

Definition at line 111 of file mesh.h.

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Mesh::Mesh ( )
inline

constructeur par defaut.

Definition at line 117 of file mesh.h.

117  : m_positions(), m_texcoords(), m_normals(), m_colors(), m_indices(),
118  m_color(White()), m_primitives(GL_POINTS), m_vao(0), m_buffer(0), m_index_buffer(0), m_vertex_buffer_size(0), m_index_buffer_size(0), m_update_buffers(false) {}
Color White()
utilitaire. renvoie une couleur blanche.
Definition: color.cpp:36

◆ Mesh() [2/2]

Mesh::Mesh ( const GLenum  primitives)
inline

constructeur.

Definition at line 121 of file mesh.h.

121  : m_positions(), m_texcoords(), m_normals(), m_colors(), m_indices(),
122  m_color(White()), m_primitives(primitives), m_vao(0), m_buffer(0), m_index_buffer(0), m_vertex_buffer_size(0), m_index_buffer_size(0), m_update_buffers(false) {}
GLenum primitives() const
renvoie le type de primitives.
Definition: mesh.h:336

Member Function Documentation

◆ create() [1/4]

int Mesh::create ( const GLenum  primitives)

construit les objets openGL.

Definition at line 16 of file mesh.cpp.

17 {
18  m_primitives= primitives;
19  return 0;
20 }

◆ create() [2/4]

int Mesh::create ( const GLenum  primitives,
const std::vector< vec3 > &  positions 
)

construit les objets openGL. a partir d'un ensemble de positions.

Definition at line 22 of file mesh.cpp.

23 {
24  clear();
25  m_primitives= primitives;
26  m_positions= positions;
27  return 0;
28 }
void clear()
vide la description.
Definition: mesh.cpp:176

◆ create() [3/4]

int Mesh::create ( const GLenum  primitives,
const std::vector< vec3 > &  positions,
const std::vector< unsigned > &  indices 
)

construit les objets openGL. a partir d'un ensemble de positions indexees.

Definition at line 30 of file mesh.cpp.

31 {
32  clear();
33  m_primitives= primitives;
34  m_positions= positions;
35  m_indices= indices;
36  return 0;
37 }

◆ create() [4/4]

int Mesh::create ( const GLenum  primitives,
const std::vector< vec3 > &  positions,
const std::vector< vec2 > &  texcoords,
const std::vector< vec3 > &  normals,
const std::vector< vec4 > &  colors,
const std::vector< unsigned > &  indices 
)

construit les objets openGL. a partir d'un ensemble de positions + attributs indexes.

Definition at line 39 of file mesh.cpp.

44 {
45  clear();
46  if(texcoords.size() > 0 && texcoords.size() != positions.size()) return -1;
47  if(normals.size() > 0 && normals.size() != positions.size()) return -1;
48  if(colors.size() > 0 && colors.size() != positions.size()) return -1;
49 
50  m_primitives= primitives;
51  m_positions= positions;
52  m_indices= indices;
53  m_texcoords= texcoords;
54  m_normals= normals;
55  m_colors= colors;
56 
57  return 0;
58 }

◆ release()

void Mesh::release ( )

detruit les objets openGL.

Definition at line 62 of file mesh.cpp.

63 {
64  printf("mesh release %d\n", m_vao);
65 
66  glDeleteVertexArrays(1, &m_vao);
67  glDeleteBuffers(1, &m_buffer);
68  glDeleteBuffers(1, &m_index_buffer);
69 }
void printf(Text &text, const int px, const int py, const char *format,...)
affiche un texte a la position x, y. meme utilisation que printf().
Definition: text.cpp:140

◆ color() [1/6]

Mesh & Mesh::color ( const vec4 c)

definit la couleur du prochain sommet.

Definition at line 78 of file mesh.cpp.

79 {
80  if(m_colors.size() <= m_positions.size())
81  m_colors.push_back(color);
82  else
83  m_colors.back()= color;
84  m_update_buffers= true;
85  return *this;
86 }
Mesh & color(const vec4 &c)
definit la couleur du prochain sommet.
Definition: mesh.cpp:78

◆ color() [2/6]

Mesh& Mesh::color ( const Color c)
inline

definit la couleur du prochain sommet.

Definition at line 147 of file mesh.h.

147 { return color(vec4(c.r, c.g, c.b, c.a)); }
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition: vec.h:168

◆ color() [3/6]

Mesh& Mesh::color ( const float  r,
const float  g,
const float  b,
const float  a = 1 
)
inline

definit la couleur du prochain sommet.

Definition at line 149 of file mesh.h.

149 { return color(vec4(r, g, b, a)); }

◆ normal() [1/6]

Mesh & Mesh::normal ( const vec3 n)

definit la normale du prochain sommet.

Definition at line 88 of file mesh.cpp.

89 {
90  if(m_normals.size() <= m_positions.size())
91  m_normals.push_back(normal);
92  else
93  m_normals.back()= normal;
94  m_update_buffers= true;
95  return *this;
96 }
Mesh & normal(const vec3 &n)
definit la normale du prochain sommet.
Definition: mesh.cpp:88

◆ normal() [2/6]

Mesh& Mesh::normal ( const Vector n)
inline

definit la normale du prochain sommet.

Definition at line 154 of file mesh.h.

154 { return normal(vec3(n)); }
vecteur generique, utilitaire.
Definition: vec.h:146

◆ normal() [3/6]

Mesh& Mesh::normal ( const float  x,
const float  y,
const float  z 
)
inline

definit la normale du prochain sommet.

Definition at line 156 of file mesh.h.

156 { return normal(vec3(x, y, z)); }

◆ texcoord() [1/4]

Mesh & Mesh::texcoord ( const vec2 uv)

definit les coordonnees de texture du prochain sommet.

Definition at line 98 of file mesh.cpp.

99 {
100  if(m_texcoords.size() <= m_positions.size())
101  m_texcoords.push_back(uv);
102  else
103  m_texcoords.back()= uv;
104  m_update_buffers= true;
105  return *this;
106 }

◆ texcoord() [2/4]

Mesh& Mesh::texcoord ( const float  x,
const float  y 
)
inline

definit les coordonnees de texture du prochain sommet.

Definition at line 161 of file mesh.h.

161 { return texcoord(vec2(x, y)); }
Mesh & texcoord(const vec2 &uv)
definit les coordonnees de texture du prochain sommet.
Definition: mesh.cpp:98
vecteur generique, utilitaire.
Definition: vec.h:131

◆ vertex() [1/6]

unsigned int Mesh::vertex ( const vec3 p)

insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet.

Definition at line 109 of file mesh.cpp.

110 {
111  m_update_buffers= true;
112  m_positions.push_back(position);
113 
114  // copie les autres attributs du sommet, uniquement s'ils sont definis
115  if(m_texcoords.size() > 0 && m_texcoords.size() != m_positions.size())
116  m_texcoords.push_back(m_texcoords.back());
117  if(m_normals.size() > 0 && m_normals.size() != m_positions.size())
118  m_normals.push_back(m_normals.back());
119  if(m_colors.size() > 0 && m_colors.size() != m_positions.size())
120  m_colors.push_back(m_colors.back());
121 
122  // copie la matiere courante, uniquement si elle est definie
123  if(m_triangle_materials.size() > 0 && int(m_triangle_materials.size()) < triangle_count())
124  m_triangle_materials.push_back(m_triangle_materials.back());
125 
126  unsigned int index= m_positions.size() -1;
127  // construction de l'index buffer pour les strip
128  switch(m_primitives)
129  {
130  case GL_LINE_STRIP:
131  case GL_LINE_LOOP:
132  case GL_TRIANGLE_STRIP:
133  case GL_TRIANGLE_FAN:
134  m_indices.push_back(index);
135  break;
136  default:
137  break;
138  }
139 
140  // renvoie l'indice du sommet
141  return index;
142 }
int triangle_count() const
renvoie le nombre de triangles.
Definition: mesh.cpp:433
Mesh & index(const int a)
Definition: mesh.cpp:239

◆ vertex() [2/6]

unsigned int Mesh::vertex ( const Point p)
inline

insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet.

Definition at line 166 of file mesh.h.

166 { return vertex(vec3(p)); }
unsigned int vertex(const vec3 &p)
insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(),...
Definition: mesh.cpp:109

◆ vertex() [3/6]

unsigned int Mesh::vertex ( const float  x,
const float  y,
const float  z 
)
inline

insere un sommet de position p, et ses attributs (s'ils sont definis par color(), texcoord(), normal()), dans l'objet. renvoie l'indice du sommet.

Definition at line 168 of file mesh.h.

168 { return vertex(vec3(x, y, z)); }

◆ clear()

void Mesh::clear ( )

vide la description.

Definition at line 176 of file mesh.cpp.

177 {
178  m_update_buffers= true;
179 
180  m_positions.clear();
181  m_texcoords.clear();
182  m_normals.clear();
183  m_colors.clear();
184  m_indices.clear();
185  //~ m_materials.clear();
186  m_triangle_materials.clear();
187 }

◆ triangle() [1/2]

Mesh & Mesh::triangle ( const unsigned int  a,
const unsigned int  b,
const unsigned int  c 
)

insere un triangle. a, b, c sont les indices des sommets deja inseres dans l'objet. ne fonctionne pas avec les strips et les fans.

Mesh m(GL_TRIANGLES);
unsigned int a= m.vertex( Point(ax, ay, az) );
unsigned int b= m.vertex( Point(bx, by, bz) );
unsigned int c= m.vertex( Point(cx, cy, cz) );
m.triangle(a, b, c);
representation d'un objet / maillage.
Definition: mesh.h:112
representation d'un point 3d.
Definition: vec.h:21

Definition at line 190 of file mesh.cpp.

191 {
192  assert(a < m_positions.size());
193  assert(b < m_positions.size());
194  assert(c < m_positions.size());
195  m_update_buffers= true;
196  m_indices.push_back(a);
197  m_indices.push_back(b);
198  m_indices.push_back(c);
199 
200  // copie la matiere courante, uniquement si elle est definie
201  if(m_triangle_materials.size() > 0 && int(m_triangle_materials.size()) < triangle_count())
202  m_triangle_materials.push_back(m_triangle_materials.back());
203 
204  m_update_buffers= true;
205  return *this;
206 }

◆ triangle_last()

Mesh & Mesh::triangle_last ( const int  a,
const int  b,
const int  c 
)

insere un triangle, a, b, c sont les indices des sommets deja inseres dans l'objet, en comptant en partant du dernier. ne fonctionne pas avec les strips et les fans.

Mesh m(GL_TRIANGLES);
m.vertex( Point(ax, ay, az) );
m.vertex( Point(bx, by, bz) );
m.vertex( Point(cx, cy, cz) );
m.triangle_last(-3, -2, -1);

Definition at line 208 of file mesh.cpp.

209 {
210  assert(a < 0);
211  assert(b < 0);
212  assert(c < 0);
213  m_update_buffers= true;
214  m_indices.push_back(int(m_positions.size()) + a);
215  m_indices.push_back(int(m_positions.size()) + b);
216  m_indices.push_back(int(m_positions.size()) + c);
217 
218  // copie la matiere courante, uniquement si elle est definie
219  if(m_triangle_materials.size() > 0 && int(m_triangle_materials.size()) < triangle_count())
220  m_triangle_materials.push_back(m_triangle_materials.back());
221 
222  m_update_buffers= true;
223  return *this;
224 }

◆ restart_strip()

Mesh & Mesh::restart_strip ( )

demarre un nouveau strip. a utiliser avec un objet composes de GL_TRIANGLE_STRIP, doit aussi fonctionner avec GL_TRIANGLE_FAN, GL_LINE_STRIP, GL_LINE_LOOP, etc.

Definition at line 226 of file mesh.cpp.

227 {
228  m_update_buffers= true;
229  m_indices.push_back(~0u); // ~0u plus grand entier non signe representable, ou UINT_MAX...
230 #if 1
231  glPrimitiveRestartIndex(~0u);
232  glEnable(GL_PRIMITIVE_RESTART);
233 #else
234  glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX); // n'existe pas sur mac ?!
235 #endif
236  return *this;
237 }

◆ index()

Mesh & Mesh::index ( const int  a)

insere un indice de sommet.

Mesh m(GL_TRIANGLES);
unsigned int a= m.vertex( Point(ax, ay, az) );
unsigned int b= m.vertex( Point(bx, by, bz) );
unsigned int c= m.vertex( Point(cx, cy, cz) );
// insere le triangle abc
m.index(a);
m.index(b);
m.index(c);

Definition at line 239 of file mesh.cpp.

240 {
241  if(a < 0)
242  m_indices.push_back(int(m_positions.size()) + a);
243  else if(a < int(m_positions.size()))
244  m_indices.push_back(a);
245  else
246  {
247  printf("[error] Mesh::index(): invalid index...\n");
248  return *this; // erreur
249  }
250 
251  // copie la matiere courante, uniquement si elle est definie
252  if(m_triangle_materials.size() > 0 && int(m_triangle_materials.size()) < triangle_count())
253  m_triangle_materials.push_back(m_triangle_materials.back());
254 
255  m_update_buffers= true;
256  return *this;
257 }

◆ color() [4/6]

Mesh & Mesh::color ( const unsigned int  id,
const vec4 c 
)

modifie la couleur du sommet d'indice id.

Definition at line 145 of file mesh.cpp.

146 {
147  assert(id < m_colors.size());
148  m_update_buffers= true;
149  m_colors[id]= c;
150  return *this;
151 }

◆ color() [5/6]

Mesh& Mesh::color ( const unsigned int  id,
const Color c 
)
inline

modifie la couleur du sommet d'indice id.

Definition at line 222 of file mesh.h.

222 { return color(id, vec4(c.r, c.g, c.b, c.a)); }

◆ color() [6/6]

Mesh& Mesh::color ( const unsigned int  id,
const float  r,
const float  g,
const float  b,
const float  a = 1 
)
inline

modifie la couleur du sommet d'indice id.

Definition at line 224 of file mesh.h.

224 { return color(id, vec4(r, g, b, a)); }

◆ normal() [4/6]

Mesh & Mesh::normal ( const unsigned int  id,
const vec3 n 
)

modifie la normale du sommet d'indice id.

Definition at line 153 of file mesh.cpp.

154 {
155  assert(id < m_normals.size());
156  m_update_buffers= true;
157  m_normals[id]= n;
158  return *this;
159 }

◆ normal() [5/6]

Mesh& Mesh::normal ( const unsigned int  id,
const Vector n 
)
inline

modifie la normale du sommet d'indice id.

Definition at line 229 of file mesh.h.

229 { return normal(id, vec3(n)); }

◆ normal() [6/6]

Mesh& Mesh::normal ( const unsigned int  id,
const float  x,
const float  y,
const float  z 
)
inline

modifie la normale du sommet d'indice id.

Definition at line 231 of file mesh.h.

231 { return normal(id, vec3(x, y, z)); }

◆ texcoord() [3/4]

Mesh & Mesh::texcoord ( const unsigned int  id,
const vec2 uv 
)

modifie les coordonnees du sommet d'indice id.

Definition at line 161 of file mesh.cpp.

162 {
163  assert(id < m_texcoords.size());
164  m_update_buffers= true;
165  m_texcoords[id]= uv;
166  return *this;
167 }

◆ texcoord() [4/4]

Mesh& Mesh::texcoord ( const unsigned int  id,
const float  x,
const float  y 
)
inline

modifie les coordonnees du sommet d'indice id.

Definition at line 236 of file mesh.h.

236 { return texcoord(id, vec2(x, y)); }

◆ vertex() [4/6]

void Mesh::vertex ( const unsigned int  id,
const vec3 p 
)

modifie la position du sommet d'indice id.

Definition at line 169 of file mesh.cpp.

170 {
171  assert(id < m_positions.size());
172  m_update_buffers= true;
173  m_positions[id]= p;
174 }

◆ vertex() [5/6]

void Mesh::vertex ( const unsigned int  id,
const Point p 
)
inline

modifie la position du sommet d'indice id.

Definition at line 241 of file mesh.h.

241 { vertex(id, vec3(p)); }

◆ vertex() [6/6]

void Mesh::vertex ( const unsigned int  id,
const float  x,
const float  y,
const float  z 
)
inline

modifie la position du sommet d'indice id.

Definition at line 243 of file mesh.h.

243 { vertex(id, vec3(x, y, z)); }

◆ materials() [1/3]

const Materials & Mesh::materials ( ) const

renvoie la description des matieres.

Definition at line 265 of file mesh.cpp.

266 {
267  return m_materials;
268 }

◆ materials() [2/3]

Materials & Mesh::materials ( )

renvoie la description des matieres.

Definition at line 260 of file mesh.cpp.

261 {
262  return m_materials;
263 }

◆ materials() [3/3]

void Mesh::materials ( const Materials materials)

remplace la description des matieres.

Definition at line 270 of file mesh.cpp.

271 {
272  m_materials= materials;
273 }
const Materials & materials() const
renvoie la description des matieres.
Definition: mesh.cpp:265

◆ material_indices()

const std::vector< unsigned int > & Mesh::material_indices ( ) const

renvoie les indices des matieres des triangles.

Definition at line 285 of file mesh.cpp.

286 {
287  return m_triangle_materials;
288 }

◆ material()

Mesh & Mesh::material ( const unsigned int  id)

definit la matiere du prochain triangle. id est l'indice d'une matiere ajoutee dans materials(), cf la classe Materials. ne fonctionne que pour les primitives GL_TRIANGLES, indexees ou pas.

Definition at line 275 of file mesh.cpp.

276 {
277  if(int(m_triangle_materials.size()) <= triangle_count())
278  m_triangle_materials.push_back(id);
279  else
280  m_triangle_materials.back()= id;
281  m_update_buffers= true;
282  return *this;
283 }

◆ triangle_count()

int Mesh::triangle_count ( ) const

renvoie le nombre de triangles.

Definition at line 433 of file mesh.cpp.

434 {
435  if(m_primitives != GL_TRIANGLES)
436  return 0;
437 
438  if(m_indices.size() > 0)
439  return int(m_indices.size() / 3);
440  else
441  return int(m_positions.size() / 3);
442 }

◆ triangle() [2/2]

TriangleData Mesh::triangle ( const unsigned int  id) const

renvoie un triangle.

Definition at line 444 of file mesh.cpp.

445 {
446  unsigned int a, b, c;
447  if(m_indices.size() > 0)
448  {
449  assert((size_t) id*3+2 < m_indices.size());
450  a= m_indices[id*3];
451  b= m_indices[id*3 +1];
452  c= m_indices[id*3 +2];
453  }
454  else
455  {
456  assert((size_t) id*3+2 < m_positions.size());
457  a= id*3;
458  b= id*3 +1;
459  c= id*3 +2;
460  }
461 
463  triangle.a= m_positions[a];
464  triangle.b= m_positions[b];
465  triangle.c= m_positions[c];
466 
467  if(m_normals.size() == m_positions.size())
468  {
469  triangle.na= m_normals[a];
470  triangle.nb= m_normals[b];
471  triangle.nc= m_normals[c];
472  }
473  else
474  {
475  // calculer la normale geometrique
476  Vector ab= Point(m_positions[b]) - Point(m_positions[a]);
477  Vector ac= Point(m_positions[c]) - Point(m_positions[a]);
478  Vector n= normalize(cross(ab, ac));
479  triangle.na= vec3(n);
480  triangle.nb= vec3(n);
481  triangle.nc= vec3(n);
482  }
483 
484  if(m_texcoords.size() == m_positions.size())
485  {
486  triangle.ta= m_texcoords[a];
487  triangle.tb= m_texcoords[b];
488  triangle.tc= m_texcoords[c];
489  }
490  else
491  {
492  // coordonnees barycentriques des sommets, convention p(u, v)= w*a + u*b + v*c, avec w= 1 - u -v
493  triangle.ta= vec2(0, 0); // w= 1
494  triangle.tb= vec2(1, 0); // w= 0
495  triangle.tc= vec2(0, 1); // w= 0
496  }
497 
498  return triangle;
499 }
Mesh & triangle(const unsigned int a, const unsigned int b, const unsigned int c)
Definition: mesh.cpp:190
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
Definition: vec.cpp:123
Vector cross(const Vector &u, const Vector &v)
renvoie le produit vectoriel de 2 vecteurs.
Definition: vec.cpp:129
representation d'un triangle.
Definition: mesh.h:95
representation d'un vecteur 3d.
Definition: vec.h:59

◆ triangle_material_index()

int Mesh::triangle_material_index ( const unsigned int  id) const

renvoie l'indice de la matiere d'un triangle.

Definition at line 290 of file mesh.cpp.

291 {
292  assert((size_t) id < m_triangle_materials.size());
293  return m_triangle_materials[id];
294 }

◆ triangle_material()

const Material & Mesh::triangle_material ( const unsigned int  id) const

renvoie la matiere d'un triangle.

Definition at line 296 of file mesh.cpp.

297 {
298  assert((size_t) id < m_triangle_materials.size());
299  return m_materials.material(m_triangle_materials[id]);
300 }
const Material & material(const int id) const
renvoie la ieme matiere.
Definition: materials.h:102

◆ groups() [1/2]

std::vector< TriangleGroup > Mesh::groups ( )

renvoie les groupes de triangles de meme matiere. re-organise les triangles. permet d'afficher l'objet matiere par matiere.

Definition at line 303 of file mesh.cpp.

304 {
305  return groups(m_triangle_materials);
306 }
std::vector< TriangleGroup > groups()
renvoie les groupes de triangles de meme matiere. re-organise les triangles. permet d'afficher l'obje...
Definition: mesh.cpp:303

◆ groups() [2/2]

std::vector< TriangleGroup > Mesh::groups ( const std::vector< unsigned int > &  triangle_properties)

renvoie les groupes de triangles de meme 'propriete'. re-organise les triangles.

Definition at line 308 of file mesh.cpp.

309 {
310  if(m_primitives != GL_TRIANGLES)
311  return {};
312 
313  // pas le bon nombre d'infos, renvoyer un seul groupe
314  if(int(triangle_properties.size()) != triangle_count())
315  {
316  if(m_indices.size())
317  return { {0, 0, int(m_indices.size())} };
318  else
319  return { {0, 0, int(m_positions.size())} };
320  }
321 
322  // trie les triangles
323  std::vector<int> remap(triangle_count());
324  for(unsigned i= 0; i < remap.size(); i++)
325  remap[i]= i;
326 
327  struct triangle_sort
328  {
329  const std::vector<unsigned int>& properties;
330 
331  triangle_sort( const std::vector<unsigned int>& _properties ) : properties(_properties) {}
332 
333  bool operator() ( const int& a, const int& b ) const
334  {
335  return properties[a] < properties[b];
336  }
337  };
338 
339  std::stable_sort(remap.begin(), remap.end(), triangle_sort(triangle_properties));
340 
341  // re-organise les triangles, et construit les groupes
342  std::vector<TriangleGroup> groups;
343  if(m_indices.size())
344  {
345  int first= 0;
346  int property_id= triangle_properties[remap[0]];
347 
348  // re-organise l'index buffer...
349  std::vector<unsigned int> indices;
350  std::vector<unsigned int> material_indices;
351  for(unsigned i= 0; i < remap.size(); i++)
352  {
353  int id= triangle_properties[remap[i]];
354  if(id != property_id)
355  {
356  groups.push_back( {property_id, first, int(3*i) - first} );
357  first= 3*i;
358  property_id= id;
359  }
360 
361  indices.push_back(m_indices[3*remap[i]]);
362  indices.push_back(m_indices[3*remap[i]+1]);
363  indices.push_back(m_indices[3*remap[i]+2]);
364 
365  material_indices.push_back(m_triangle_materials[remap[i]]);
366  }
367 
368  // dernier groupe
369  groups.push_back( {property_id, first, int(3 * remap.size()) - first} );
370 
371  std::swap(m_indices, indices);
372  std::swap(m_triangle_materials, material_indices);
373  }
374  else
375  {
376  int first= 0;
377  int property_id= triangle_properties[remap[0]];
378 
379  // re-organise les attributs !!
380  std::vector<vec3> positions;
381  std::vector<vec2> texcoords;
382  std::vector<vec3> normals;
383  std::vector<vec4> colors;
384  std::vector<unsigned int> material_indices;
385  for(unsigned i= 0; i < remap.size(); i++)
386  {
387  int id= triangle_properties[remap[i]];
388  if(id != property_id)
389  {
390  groups.push_back( {property_id, first, int(3*i) - first} );
391  first= 3*i;
392  property_id= id;
393  }
394 
395  positions.push_back(m_positions[3*remap[i]]);
396  positions.push_back(m_positions[3*remap[i]+1]);
397  positions.push_back(m_positions[3*remap[i]+2]);
398  if(has_texcoord())
399  {
400  texcoords.push_back(m_texcoords[3*remap[i]]);
401  texcoords.push_back(m_texcoords[3*remap[i]+1]);
402  texcoords.push_back(m_texcoords[3*remap[i]+2]);
403  }
404  if(has_normal())
405  {
406  normals.push_back(m_normals[3*remap[i]]);
407  normals.push_back(m_normals[3*remap[i]+1]);
408  normals.push_back(m_normals[3*remap[i]+2]);
409  }
410  if(has_color())
411  {
412  colors.push_back(m_colors[3*remap[i]]);
413  colors.push_back(m_colors[3*remap[i]+1]);
414  colors.push_back(m_colors[3*remap[i]+2]);
415  }
416 
417  material_indices.push_back(m_triangle_materials[remap[i]]);
418  }
419 
420  // dernier groupe
421  groups.push_back( {property_id, first, int(3 * remap.size()) - first} );
422 
423  std::swap(m_positions, positions);
424  std::swap(m_texcoords, texcoords);
425  std::swap(m_normals, normals);
426  std::swap(m_colors, colors);
427  std::swap(m_triangle_materials, material_indices);
428  }
429 
430  return groups;
431 }
const std::vector< unsigned int > & material_indices() const
renvoie les indices des matieres des triangles.
Definition: mesh.cpp:285
void normals(MeshData &data)
(re-) calcule les normales des sommets. utiliser avant les reindexations, cf indices() et vertices().
Definition: mesh_data.cpp:307

◆ bounds()

void Mesh::bounds ( Point pmin,
Point pmax 
) const

renvoie min et max les coordonnees des extremites des positions des sommets de l'objet (boite englobante alignee sur les axes, aabb).

Definition at line 501 of file mesh.cpp.

502 {
503  if(m_positions.size() < 1)
504  return;
505 
506  pmin= Point(m_positions[0]);
507  pmax= pmin;
508 
509  for(unsigned i= 1; i < m_positions.size(); i++)
510  {
511  vec3 p= m_positions[i];
512  pmin= Point( std::min(pmin.x, p.x), std::min(pmin.y, p.y), std::min(pmin.z, p.z) );
513  pmax= Point( std::max(pmax.x, p.x), std::max(pmax.y, p.y), std::max(pmax.z, p.z) );
514  }
515 }
Point max(const Point &a, const Point &b)
renvoie la plus grande composante de chaque point. x, y, z= max(a.x, b.x), max(a.y,...
Definition: vec.cpp:35
Point min(const Point &a, const Point &b)
renvoie la plus petite composante de chaque point. x, y, z= min(a.x, b.x), min(a.y,...
Definition: vec.cpp:30

◆ default_color() [1/2]

Color Mesh::default_color ( ) const
inline

renvoie la couleur par defaut du mesh, utilisee si les sommets n'ont pas de couleur associee.

Definition at line 284 of file mesh.h.

284 { return m_color; }

◆ default_color() [2/2]

Mesh & Mesh::default_color ( const Color color)

modifie la couleur par defaut, utilisee si les sommets n'ont pas de couleur associee.

Definition at line 72 of file mesh.cpp.

73 {
74  m_color= color;
75  return *this;
76 }

◆ vertex_count()

int Mesh::vertex_count ( ) const
inline

renvoie le nombre de sommets.

Definition at line 291 of file mesh.h.

291 { return (int) m_positions.size(); }

◆ index_count()

int Mesh::index_count ( ) const
inline

renvoie le nombre d'indices de sommets.

Definition at line 293 of file mesh.h.

293 { return (int) m_indices.size(); }

◆ vertex_buffer()

const float* Mesh::vertex_buffer ( ) const
inline

renvoie l'adresse de la position du premier sommet. permet de construire les vertex buffers openGL. par convention, la position est un vec3, 3 GL_FLOAT.

Definition at line 296 of file mesh.h.

296 { return &m_positions.front().x; }

◆ vertex_buffer_size()

std::size_t Mesh::vertex_buffer_size ( ) const
inline

renvoie la longueur (en octets) du vertex buffer.

Definition at line 298 of file mesh.h.

298 { return m_positions.size() * sizeof(vec3); }

◆ normal_buffer()

const float* Mesh::normal_buffer ( ) const
inline

renvoie l'adresse de la normale du premier sommet. par convention, la normale est un vec3, 3 GL_FLOAT.

Definition at line 301 of file mesh.h.

301 { return &m_normals.front().x; }

◆ normal_buffer_size()

std::size_t Mesh::normal_buffer_size ( ) const
inline

renvoie la longueur (en octets) du normal buffer.

Definition at line 303 of file mesh.h.

303 { return m_normals.size() * sizeof(vec3); }

◆ texcoord_buffer()

const float* Mesh::texcoord_buffer ( ) const
inline

renvoie l'adresse des coordonnees de textures du premier sommet. par convention, c'est un vec2, 2 GL_FLOAT.

Definition at line 306 of file mesh.h.

306 { return &m_texcoords.front().x; }

◆ texcoord_buffer_size()

std::size_t Mesh::texcoord_buffer_size ( ) const
inline

renvoie la taille (en octets) du texcoord buffer.

Definition at line 308 of file mesh.h.

308 { return m_texcoords.size() * sizeof(vec2); }

◆ color_buffer()

const float* Mesh::color_buffer ( ) const
inline

renvoie l'adresse de la couleur du premier sommet. par convention, la couleur est un vec4, 4 GL_FLOAT.

Definition at line 311 of file mesh.h.

311 { return &m_colors.front().x; }

◆ color_buffer_size()

std::size_t Mesh::color_buffer_size ( ) const
inline

renvoie la taille (en octets) du color buffer.

Definition at line 313 of file mesh.h.

313 { return m_colors.size() * sizeof(vec4); }

◆ index_buffer()

const void* Mesh::index_buffer ( ) const
inline

renvoie l'adresse du premier indice du premier triangle. par convention c'est un uint, 1, GL_UNSIGNED_INT.

Definition at line 316 of file mesh.h.

316 { return &m_indices.front(); }

◆ index_buffer_size()

std::size_t Mesh::index_buffer_size ( ) const
inline

renvoie la taille (en octets) de l'index buffer.

Definition at line 318 of file mesh.h.

318 { return m_indices.size() * sizeof(unsigned int); }

◆ has_position()

bool Mesh::has_position ( ) const
inline

verifie que les attributs sont decrits de maniere coherente.

Definition at line 328 of file mesh.h.

328 { return !m_positions.empty(); }

◆ primitives()

GLenum Mesh::primitives ( ) const
inline

renvoie le type de primitives.

Definition at line 336 of file mesh.h.

336 { return m_primitives; }

◆ error()

static Mesh& Mesh::error ( )
inlinestatic

sentinelle pour la gestion d'erreur lors du chargement d'un fichier. exemple :

Mesh mesh= read_mesh("data/bigguy.obj");
if(mesh == Mesh::error())
return "erreur de chargement";
static Mesh & error()
Definition: mesh.h:348
Mesh read_mesh(const char *filename)
charge un fichier wavefront .obj et renvoie un mesh compose de triangles non indexes....
Definition: wavefront.cpp:14

Definition at line 348 of file mesh.h.

349  {
350  static Mesh mesh;
351  return mesh;
352  }

◆ create_buffers()

GLuint Mesh::create_buffers ( const bool  use_texcoord,
const bool  use_normal,
const bool  use_color,
const bool  use_material_index 
)

construit les buffers et le vertex array object necessaires pour dessiner l'objet avec openGL. utilitaire. detruit par release( ).

Definition at line 579 of file mesh.cpp.

580 {
581  if(m_positions.size() == 0)
582  return 0;
583 
584 #if 1
585  if(use_texcoord && !has_texcoord())
586  printf("[oops] mesh: no texcoord array...\n");
587  if(use_normal && !has_normal())
588  printf("[oops] mesh: no normal array...\n");
589  if(use_color && !has_color())
590  printf("[oops] mesh: no color array...\n");
591  if(use_material_index && !has_material_index())
592  printf("[oops] mesh: no material index array...\n");
593 #endif
594 
595  if(m_vao)
596  // c'est deja fait...
597  return m_vao;
598 
599  // configuration du format de sommet
600  glGenVertexArrays(1, &m_vao);
601  glBindVertexArray(m_vao);
602 
603  // determine la taille du buffer pour stocker tous les attributs et les indices
604  m_vertex_buffer_size= vertex_buffer_size();
605  if(use_texcoord && has_texcoord())
606  m_vertex_buffer_size+= texcoord_buffer_size();
607  if(use_normal && has_normal())
608  m_vertex_buffer_size+= normal_buffer_size();
609  if(use_color && has_color())
610  m_vertex_buffer_size+= color_buffer_size();
611  if(use_material_index && has_material_index())
612  m_vertex_buffer_size+= m_positions.size() * sizeof(unsigned char);
613 
614  // alloue le buffer
615  glGenBuffers(1, &m_buffer);
616  glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
617  glBufferData(GL_ARRAY_BUFFER, m_vertex_buffer_size, nullptr, GL_STATIC_DRAW);
618 
619  // index buffer
620  m_index_buffer_size= index_buffer_size();
621  if(m_index_buffer_size)
622  {
623  glGenBuffers(1, &m_index_buffer);
624  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_index_buffer);
625  glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_index_buffer_size, index_buffer(), GL_STATIC_DRAW);
626  }
627 
628  // transfere les donnees dans les buffers
629  update_buffers(use_texcoord, use_normal, use_color, use_material_index);
630 
631  return m_vao;
632 }
std::size_t texcoord_buffer_size() const
renvoie la taille (en octets) du texcoord buffer.
Definition: mesh.h:308
std::size_t index_buffer_size() const
renvoie la taille (en octets) de l'index buffer.
Definition: mesh.h:318
std::size_t vertex_buffer_size() const
renvoie la longueur (en octets) du vertex buffer.
Definition: mesh.h:298
const void * index_buffer() const
renvoie l'adresse du premier indice du premier triangle. par convention c'est un uint,...
Definition: mesh.h:316
std::size_t normal_buffer_size() const
renvoie la longueur (en octets) du normal buffer.
Definition: mesh.h:303
std::size_t color_buffer_size() const
renvoie la taille (en octets) du color buffer.
Definition: mesh.h:313

◆ draw() [1/2]

void Mesh::draw ( const GLuint  program,
const bool  use_position,
const bool  use_texcoord,
const bool  use_normal,
const bool  use_color,
const bool  use_material_index 
)

dessine l'objet avec un shader program.

Definition at line 768 of file mesh.cpp.

769 {
770  if(m_indices.size())
771  draw(0, int(m_indices.size()), program, use_position, use_texcoord, use_normal, use_color, use_material_index);
772  else
773  draw(0, int(m_positions.size()), program, use_position, use_texcoord, use_normal, use_color, use_material_index);
774 }
void draw(const GLuint program, const bool use_position, const bool use_texcoord, const bool use_normal, const bool use_color, const bool use_material_index)
dessine l'objet avec un shader program.
Definition: mesh.cpp:768

◆ draw() [2/2]

void Mesh::draw ( const int  first,
const int  n,
const GLuint  program,
const bool  use_position,
const bool  use_texcoord,
const bool  use_normal,
const bool  use_color,
const bool  use_material_index 
)

dessine une partie de l'objet avec un shader program.

Definition at line 776 of file mesh.cpp.

777 {
778  if(program == 0)
779  {
780  printf("[oops] no program... can't draw !!\n");
781  return;
782  }
783 
784  // transfere toutes les donnees disponibles (et correctement definies)
785  // le meme mesh peut etre dessine avec plusieurs shaders utilisant des attributs differents...
786  if(m_vao == 0)
787  create_buffers(has_texcoord(), has_normal(), has_color(), has_material_index());
788  assert(m_vao != 0);
789 
790  if(m_update_buffers)
791  update_buffers(has_texcoord(), has_normal(), has_color(), has_material_index());
792 
793  glBindVertexArray(m_vao);
794 
795  #ifndef GK_RELEASE
796  {
797  char label[2048]= { 0 };
798  #ifdef GL_VERSION_4_3
799  {
800  char tmp[1024];
801  glGetObjectLabel(GL_PROGRAM, program, sizeof(tmp), nullptr, tmp);
802  sprintf(label, "program( %u '%s' )", program, tmp);
803  }
804  #else
805  sprintf(label, "program( %u )", program);
806  #endif
807 
808  // verifie que le program est selectionne
809  GLuint current;
810  glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *) &current);
811  if(current != program)
812  printf("[oops] %s: not active... undefined draw !!\n", label);
813 
814  // verifie que les attributs necessaires a l'execution du shader sont presents dans le mesh...
815  // etape 1 : recuperer le nombre d'attributs
816  GLint n= 0;
817  glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &n);
818 
819  // etape 2 : recuperer les infos de chaque attribut
820  char name[1024];
821  for(int index= 0; index < n; index++)
822  {
823  GLint glsl_size;
824  GLenum glsl_type;
825  glGetActiveAttrib(program, index, sizeof(name), nullptr, &glsl_size, &glsl_type, name);
826 
827  GLint location= glGetAttribLocation(program, name);
828  if(location == 0) // attribut position necessaire a l'execution du shader
829  {
830  if(!use_position || !has_position())
831  printf("[oops] position attribute '%s' in %s: no data... undefined draw !!\n", name, label);
832  if(glsl_size != 1 || glsl_type != GL_FLOAT_VEC3)
833  printf("[oops] position attribute '%s' is not declared as a vec3 in %s... undefined draw !!\n", name, label);
834  }
835  else if(location == 1) // attribut texcoord necessaire
836  {
837  if(!use_texcoord || !has_texcoord())
838  printf("[oops] texcoord attribute '%s' in %s: no data... undefined draw !!\n", name, label);
839  if(glsl_size != 1 || glsl_type != GL_FLOAT_VEC2)
840  printf("[oops] texcoord attribute '%s' is not declared as a vec2 in %s... undefined draw !!\n", name, label);
841  }
842  else if(location == 2) // attribut normal necessaire
843  {
844  if(!use_normal || !has_normal())
845  printf("[oops] normal attribute '%s' in %s: no data... undefined draw !!\n", name, label);
846  if(glsl_size != 1 || glsl_type != GL_FLOAT_VEC3)
847  printf("[oops] attribute '%s' is not declared as a vec3 in %s... undefined draw !!\n", name, label);
848  }
849  else if(location == 3) // attribut color necessaire
850  {
851  if(!use_color || !has_color())
852  printf("[oops] color attribute '%s' in %s: no data... undefined draw !!\n", name, label);
853  if(glsl_size != 1 || glsl_type != GL_FLOAT_VEC4)
854  printf("[oops] attribute '%s' is not declared as a vec4 in %s... undefined draw !!\n", name, label);
855  }
856  else if(location == 4) // attribut material_index necessaire
857  {
858  if(!use_material_index || !has_material_index())
859  printf("[oops] material_index attribute '%s' in %s: no data... undefined draw !!\n", name, label);
860  if(glsl_size != 1 || glsl_type != GL_UNSIGNED_INT)
861  printf("[oops] attribute '%s' is not declared as a uint in %s... undefined draw !!\n", name, label);
862  }
863  }
864  }
865  #endif
866 
867  if(m_indices.size() > 0)
868  glDrawElements(m_primitives, n, GL_UNSIGNED_INT, (void *) (first * sizeof(unsigned)));
869  else
870  glDrawArrays(m_primitives, first, n);
871 }
GLuint create_buffers(const bool use_texcoord, const bool use_normal, const bool use_color, const bool use_material_index)
construit les buffers et le vertex array object necessaires pour dessiner l'objet avec openGL....
Definition: mesh.cpp:579
bool has_position() const
verifie que les attributs sont decrits de maniere coherente.
Definition: mesh.h:328
void label(Widgets &w, const char *format,...)
cree un texte. meme fonctionnement que printf().
Definition: widgets.cpp:142

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