Amélioration de l'affichage.
This commit is contained in:
parent
26c515055a
commit
1bd696b088
29
display.c
29
display.c
|
@ -49,18 +49,6 @@ int mainLoop() {
|
|||
break;
|
||||
case SDL_KEYDOWN:
|
||||
switch(event.key.keysym.sym) {
|
||||
case SDLK_s:
|
||||
yCamera-=moveDist;
|
||||
break;
|
||||
case SDLK_z:
|
||||
yCamera+=moveDist;
|
||||
break;
|
||||
case SDLK_q:
|
||||
xCamera-=moveDist;
|
||||
break;
|
||||
case SDLK_d:
|
||||
xCamera+=moveDist;
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
ySight -= moveDist;
|
||||
break;
|
||||
|
@ -77,6 +65,16 @@ int mainLoop() {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
printf("mouse motion\n");
|
||||
xAngle = ((event.motion.x-windowWidth/2)*180/(windowWidth));
|
||||
yAngle = (event.motion.y-windowHeight/2)*180/(windowHeight);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
renderScene();
|
||||
|
@ -116,11 +114,16 @@ void renderScene() {
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
//gluLookAt(1024,512,1356,1024,512,0,0,1,0);
|
||||
gluLookAt(xCamera,yCamera,zCamera,xCamera+xSight,yCamera+ySight,zCamera+zSight,0,1,0);
|
||||
|
||||
//glClearColor(1,1,1,1); // pour un fond blanc
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
|
||||
|
||||
//gluLookAt(0,0,cameraDist, 0, 0, 0,0,1,0);
|
||||
glTranslated(-xSight,-ySight,-(zSight+cameraDist));
|
||||
glRotatef(-yAngle,1,0,0);
|
||||
glRotatef(-xAngle,0,0,1);
|
||||
|
||||
|
||||
drawAxes();
|
||||
displayQTTree(qtn);
|
||||
|
||||
|
|
12
display.h
12
display.h
|
@ -19,14 +19,12 @@ int windowWidth = 1024;
|
|||
int windowHeight = 768;
|
||||
int nbVertex = 0;
|
||||
|
||||
float xCamera = 100;
|
||||
float yCamera = -500;
|
||||
float zCamera = 3000;
|
||||
int cameraDist = 2000;
|
||||
|
||||
int xSight = 100;
|
||||
int ySight = 500;
|
||||
int zSight = -3000;
|
||||
int xSight = 0;
|
||||
int ySight = 0;
|
||||
int zSight = 0;
|
||||
|
||||
float xAngle = 0;
|
||||
float yAngle = 0;
|
||||
int moveDist = 64;
|
||||
int moveDist = 128;
|
||||
|
|
4
square.c
4
square.c
|
@ -245,7 +245,7 @@ void QT_enumerate(QTNode* first) {
|
|||
for (n = first; n != NULL; n = n->nextNode) {
|
||||
qtnode_print(n);
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
setNormal(n->vertices[QT_NE],n->vertices[QT_NO],n->vertices[QT_SE]);
|
||||
setNormal(n->vertices[QT_NE],n->vertices[QT_SO],n->vertices[QT_SE]);
|
||||
// envoyer le vertex central
|
||||
center = n->center;
|
||||
glVertex3f(center->x,center->y,center->y);
|
||||
|
@ -280,6 +280,6 @@ void QT_enumerate(QTNode* first) {
|
|||
|
||||
QTNode* QT_example() {
|
||||
QTNode* q = QT_baseNode();
|
||||
//QT_split(q);
|
||||
QT_split(q);
|
||||
return q;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user