gKit2 light
Loading...
Searching...
No Matches
tuto_transformations.cpp File Reference
#include "wavefront.h"
#include "texture.h"
#include "orbiter.h"
#include "draw.h"
#include "app_camera.h"

Go to the source code of this file.

Classes

class  TP

Functions

Mesh make_grid (const int n=10)
int main (int argc, char **argv)

Function Documentation

◆ make_grid()

Mesh make_grid ( const int n = 10)

Definition at line 15 of file tuto_transformations.cpp.

16{
17 Mesh grid= Mesh(GL_LINES);
18
19 // grille
20 grid.color(White());
21 float w= float(n-1) / 2;
22 for(int x= 0; x < n; x++)
23 {
24 grid.vertex(x -w, 0, -w);
25 grid.vertex(x -w, 0, w);
26 }
27
28 for(int z= 0; z < n; z++)
29 {
30 grid.vertex(-w, 0, z -w);
31 grid.vertex( w, 0, z -w);
32 }
33
34 // axes XYZ
35 grid.color(Red());
36 grid.vertex(0, .1, 0);
37 grid.vertex(1, .1, 0);
38
39 grid.color(Green());
40 grid.vertex(0, .1, 0);
41 grid.vertex(0, 1, 0);
42
43 grid.color(Blue());
44 grid.vertex(0, .1, 0);
45 grid.vertex(0, .1, 1);
46
47 glLineWidth(2);
48
49 return grid;
50}
representation d'un objet / maillage.
Definition mesh.h:121
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:97
Mesh & color(const vec4 &c)
definit la couleur du prochain sommet.
Definition mesh.cpp:66
Color Red()
utilitaire. renvoie une couleur rouge.
Definition color.cpp:28
Color Blue()
utilitaire. renvoie une couleur bleue.
Definition color.cpp:38
Color Green()
utilitaire. renvoie une couleur verte.
Definition color.cpp:33
Color White()
utilitaire. renvoie une couleur blanche.
Definition color.cpp:23

◆ main()

int main ( int argc,
char ** argv )

Definition at line 163 of file tuto_transformations.cpp.

164{
165 // il ne reste plus qu'a creer un objet application et la lancer
166 TP tp;
167 tp.run();
168
169 return 0;
170}
int run()
execution de l'application.
Definition app.cpp:36
Definition alpha.cpp:58