From a0db41689cf797f2a56b0da69ad02b70083e7ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Tue, 13 Feb 2018 16:19:44 +0100 Subject: [PATCH] Change the test demo --- main_bounce.cpp | 5 ++--- render/GlutRender.cpp | 12 +++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/main_bounce.cpp b/main_bounce.cpp index 3edefc1..8ea9ff6 100644 --- a/main_bounce.cpp +++ b/main_bounce.cpp @@ -12,14 +12,13 @@ int main(int argc, char** argv) { GlutRender& render = GlutRender::get_instance(); render.init(&argc, argv, 640, 480, "Bouncing stuff"); - Ball ball(Point(0, 10, 0), 0.25, 0.25, 0, 1, 1); + Ball ball(Point(0, 5, 0), 0.75, -.5, -1, 1, 1); Cuboid bbox = ball.get_surface()->max_bounding_box(); printf("%.2lf %.2lf %.2lf | %.2lf %.2lf %.2lf\n", bbox.low(0), bbox.low(1), bbox.low(2), bbox.high(0), bbox.high(1), bbox.high(2)); - render.add_surface(ball.get_surface(), - ball.get_surface()->max_bounding_box()); + render.add_surface(ball.get_surface(), bbox); render.set_idle_func(periodic_update); init_periodic_static(&ball); diff --git a/render/GlutRender.cpp b/render/GlutRender.cpp index 331bc84..33b9417 100644 --- a/render/GlutRender.cpp +++ b/render/GlutRender.cpp @@ -31,10 +31,10 @@ void GlutRender::init(int* argc, char** argv, glutReshapeFunc(reshape_handle); // ==== Lighting ==== - GLfloat light0_pos[] = {2., 10., 2.}; + GLfloat light0_pos[] = {10., 15., 10.}; GLfloat light0_ambient[] = {0., 0., 0., 1.}; - GLfloat light0_diffuse[] = {1., 1., 1., 1.}; - GLfloat light0_specular[] = {1., 1., 1., 1.}; + GLfloat light0_diffuse[] = {1., 1., .65, 1.}; + GLfloat light0_specular[] = {1., 1., .65, 1.}; glLightfv(GL_LIGHT0, GL_POSITION, light0_pos); glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse); @@ -159,8 +159,6 @@ void GlutRender::display_mesh(Mesh& mesh) const { n1 = mesh.get_normal(face[1]), n2 = mesh.get_normal(face[2]); - glColor3f(rand_color(), rand_color(), rand_color()); - glNormal3f(n0[0], n0[1], n0[2]); glVertex3f(p0[0], p0[1], p0[2]); glNormal3f(n1[0], n1[1], n1[2]); glVertex3f(p1[0], p1[1], p1[2]); glNormal3f(n2[0], n2[1], n2[2]); glVertex3f(p2[0], p2[1], p2[2]); @@ -175,8 +173,8 @@ void GlutRender::display() { // Camera position and orientation glLoadIdentity(); //glTranslatef(1., 2., -10.); - gluLookAt(0, 5, -20, - 0, 5, 0, + gluLookAt(0, 2.5, -10, + 0, 2.5, 0, 0, 1, 0); for(Mesh* mesh: meshes) {