gKit2 light
Loading...
Searching...
No Matches
tuto7_camera.cpp File Reference

reprise de tuto7.cpp mais en derivant AppCamera, avec gestion automatique d'une camera. More...

#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)

Detailed Description

reprise de tuto7.cpp mais en derivant AppCamera, avec gestion automatique d'une camera.

Definition in file tuto7_camera.cpp.

Function Documentation

◆ make_grid()

Mesh make_grid ( const int n = 10)

Definition at line 14 of file tuto7_camera.cpp.

15{
16 Mesh grid= Mesh(GL_LINES);
17
18 // grille
19 grid.color(White());
20 float w= float(n-1) / 2;
21 for(int x= 0; x < n; x++)
22 {
23 grid.vertex(x -w, 0, -w);
24 grid.vertex(x -w, 0, w);
25 }
26
27 for(int z= 0; z < n; z++)
28 {
29 grid.vertex(-w, 0, z -w);
30 grid.vertex( w, 0, z -w);
31 }
32
33 // axes XYZ
34 grid.color(Red());
35 grid.vertex(Point(0, .1, 0));
36 grid.vertex(Point(1, .1, 0));
37
38 grid.color(Green());
39 grid.vertex(Point(0, .1, 0));
40 grid.vertex(Point(0, 1, 0));
41
42 grid.color(Blue());
43 grid.vertex(Point(0, .1, 0));
44 grid.vertex(Point(0, .1, 1));
45
46 glLineWidth(2);
47
48 return grid;
49}
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
representation d'un point 3d.
Definition vec.h:21

◆ main()

int main ( int argc,
char ** argv )

Definition at line 125 of file tuto7_camera.cpp.

126{
127 // il ne reste plus qu'a creer un objet application et la lancer
128 TP tp;
129 tp.run();
130
131 return 0;
132}
int run()
execution de l'application.
Definition app.cpp:36
Definition alpha.cpp:58