--- a/ccdemos/common_sdl.h Fri May 02 13:27:47 2008 +0200
+++ b/ccdemos/common_sdl.h Mon May 05 15:31:14 2008 +0200
@@ -30,7 +30,6 @@
Uint32 *bufp = (Uint32 *)screen->pixels;
for (Float *fd = render_buffer; fd != render_buffer + w*h*3; fd += 3)
{
-#ifdef NO_SSE
unsigned char c[3];
for (int i = 0; i < 3; i++)
{
@@ -40,11 +39,6 @@
c[i] = (unsigned char)(fd[i] * 255.0);
}
*bufp = SDL_MapRGB(screen->format, c[0], c[1], c[2]);
-#else
- __m64 m = _mm_cvtps_pi16(_mm_mul_ps(_mm_set_ps1(255.0),
- _mm_min_ps(mOne, _mm_set_ps(0, fd[2],fd[1],fd[0]))));
- *bufp = SDL_MapRGB(screen->format, ((char*)&m)[0], ((char*)&m)[2], ((char*)&m)[4]);
-#endif
bufp++;
}
@@ -108,27 +102,27 @@
break;
}
if (event.key.keysym.sym == SDLK_DOWN) {
- rotx = +0.01;
+ rotx = +0.01f;
break;
}
if (event.key.keysym.sym == SDLK_UP) {
- rotx = -0.01;
+ rotx = -0.01f;
break;
}
if (event.key.keysym.sym == SDLK_w) {
- move = +0.5;
+ move = +0.5f;
break;
}
if (event.key.keysym.sym == SDLK_s) {
- move = -0.5;
+ move = -0.5f;
break;
}
if (event.key.keysym.sym == SDLK_c) {
// print camera coordinates
- cout << "Camera: eye=" << cam.eye
- << ", p=" << cam.p
- << ", u=" << cam.u
- << ", v=" << cam.v
+ cout << "Camera: eye=" << cam.getEye()
+ << ", p=" << cam.getp()
+ << ", u=" << cam.getu()
+ << ", v=" << cam.getv()
<< endl;
break;
}
@@ -156,15 +150,17 @@
}
}
cam.rotate(Quaternion(cos(roty),0,sin(roty),0).normalize());
- cam.rotate(Quaternion(cos(rotx),cam.u[0]*sin(rotx),0,cam.u[2]*sin(rotx)).normalize());
- cam.u.y = 0;
- cam.u.normalize();
+ cam.rotate(Quaternion(cos(rotx),
+ cam.getu()[0]*sin(rotx),0,cam.getu()[2]*sin(rotx)).normalize());
+ //cam.u.y = 0;
+ //cam.u.normalize();
if (move != 0.0)
cam.move(move,0,0);
if (update_callback != NULL)
update_callback(render_buffer);
update(rt, screen, render_buffer);
}
+
free(render_buffer);
Uint32 fp100s_aver = fp10s_acc*10/fp10s_acc_samples;