fixed 6dof camera
[o2demo] / src / parts / example.c
index d52f20f..8b9f58f 100644 (file)
@@ -33,7 +33,7 @@ struct screen *example_screen(void)
 
 static int init(void)
 {
-       if(gen_torus_mesh(&torus, 1.0f, 0.35, 24, 12) == -1) {
+       if(gen_torus_mesh(&torus, 1.0f, 0.15, 24, 12) == -1) {
                return -1;
        }
        return 0;
@@ -64,10 +64,11 @@ static void draw(void)
 
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
-       glMultMatrixf(sball_inv_matrix);
-       glTranslatef(0, 0, -cam_dist);
+       /*glTranslatef(0, 0, -cam_dist);
        glRotatef(cam_phi, 1, 0, 0);
-       glRotatef(cam_theta, 0, 1, 0);
+       glRotatef(cam_theta, 0, 1, 0);*/
+
+       glMultMatrixf(sball_cam_matrix);
 
        /* draw floor */
        glPushMatrix();
@@ -80,10 +81,10 @@ static void draw(void)
 
        glBegin(GL_QUADS);
        glNormal3f(0, 1, 0);
-       glVertex3f(-2, 0, 2);
-       glVertex3f(2, 0, 2);
-       glVertex3f(2, 0, -2);
-       glVertex3f(-2, 0, -2);
+       glVertex3f(-4, 0, 4);
+       glVertex3f(4, 0, 4);
+       glVertex3f(4, 0, -4);
+       glVertex3f(-4, 0, -4);
        glEnd();
 
        glPopMatrix();
@@ -100,6 +101,10 @@ static void draw(void)
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
 
        draw_mesh(&torus);
+       glRotatef(90, 1, 0, 0);
+       draw_mesh(&torus);
+       glRotatef(90, 0, 0, 1);
+       draw_mesh(&torus);
 
        glPopMatrix();
 }