ccdemos/spheres_shadow.cc
branchpyrit
changeset 92 9af5c039b678
parent 91 9d66d323c354
child 100 c005054bf4c1
--- a/ccdemos/spheres_shadow.cc	Fri May 02 13:27:47 2008 +0200
+++ b/ccdemos/spheres_shadow.cc	Mon May 05 15:31:14 2008 +0200
@@ -4,20 +4,20 @@
 #include "common_sdl.h"
 
 Camera cam;
-Light light(Vector(-2.0, 10.0, -2.0), Colour(0.9, 0.9, 0.9));
+Light light(Vector(-2.0f, 10.0f, -2.0f), Colour(0.9f, 0.9f, 0.9f));
 
 Float lx, ly, lz, cf;
 
 void update_callback(Float*)
 {
-	if (lx != 0.0)
+	if (lx != 0.0f)
 		light.pos.x += lx;
-	if (ly != 0.0)
+	if (ly != 0.0f)
 		light.pos.y += ly;
-	if (lz != 0.0)
+	if (lz != 0.0f)
 		light.pos.z += lz;
-	if (cf != 0.0)
-		cam.F += cf;
+	if (cf != 0.0f)
+		cam.setF(cam.getF() + cf);
 }
 
 void key_callback(int key, int down)
@@ -25,29 +25,29 @@
 	switch (key)
 	{
 		case SDLK_r:
-			lx = -0.1 * down;
+			lx = -0.1f * down;
 			break;
 		case SDLK_t:
-			lx = +0.1 * down;
+			lx = +0.1f * down;
 			break;
 		case SDLK_f:
-			ly = -0.1 * down;
+			ly = -0.1f * down;
 			break;
 		case SDLK_g:
-			ly = +0.1 * down;
+			ly = +0.1f * down;
 			break;
 		case SDLK_v:
-			lz = -0.1 * down;
+			lz = -0.1f * down;
 			break;
 		case SDLK_b:
-			lz = +0.1 * down;
+			lz = +0.1f * down;
 			break;
 
 		case SDLK_z:
-			cf = -0.02 * down;
+			cf = -0.02f * down;
 			break;
 		case SDLK_x:
-			cf = +0.02 * down;
+			cf = +0.02f * down;
 			break;
 	}
 }
@@ -91,10 +91,10 @@
 
 	top.optimize();
 
-	cam.setEye(Vector(-2.28908, 4.30992, 12.3051));
-	cam.p = Vector(0.0988566, -0.139543, -0.985269);
-	cam.u = Vector(-0.995004, 0, -0.0998334);
-	cam.v = Vector(0.0139311, 0.990216, -0.138846);
+	cam.setEye(Vector(-2.28908f, 4.30992f, 12.3051f));
+	cam.setp(Vector(0.0988566f, -0.139543f, -0.985269f));
+	cam.setu(Vector(-0.995004f, 0.0f, -0.0998334f));
+	cam.setv(Vector(0.0139311f, 0.990216f, -0.138846f));
 	rt.setCamera(&cam);
 
 	w = 800;
@@ -113,4 +113,6 @@
 		rt.render();
 		sampler.getPixmap().writePNG("spheres_shadow.png");
 	}
+
+	return 0;
 }