… | |
… | |
2 | #include <stdio.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
3 | #include <string.h> |
4 | #include <math.h> |
4 | #include <math.h> |
5 | |
5 | |
6 | #include "SDL.h" |
6 | #include "SDL.h" |
7 | |
|
|
8 | #include "SDL_opengl.h" |
7 | #include "SDL_opengl.h" |
9 | |
|
|
10 | /* Undefine this if you want a flat cube instead of a rainbow cube */ |
|
|
11 | #define SHADED_CUBE |
|
|
12 | |
|
|
13 | /* Define this to be the name of the logo image to use with -logo */ |
|
|
14 | #define LOGO_FILE "icon.bmp" |
|
|
15 | |
8 | |
16 | static SDL_Surface *global_image = NULL; |
9 | static SDL_Surface *global_image = NULL; |
17 | static GLuint global_texture = 0; |
10 | static GLuint global_texture = 0; |
18 | |
11 | |
|
|
12 | #include "util.h" |
19 | #include "entity.h" |
13 | #include "entity.h" |
20 | |
|
|
21 | #include "txtprt_import.h" |
14 | #include "txtprt_import.h" |
22 | |
15 | |
|
|
16 | CGcontext cgc; |
|
|
17 | CGprogram vsh, fsh; |
|
|
18 | CGparameter mv, mvp, lightpos; |
|
|
19 | CGprofile vsh_profile, fsh_profile; |
|
|
20 | |
|
|
21 | static void CheckCgError (void) |
|
|
22 | { |
|
|
23 | CGerror err = cgGetError (); |
|
|
24 | |
|
|
25 | if (err != CG_NO_ERROR) |
|
|
26 | { |
|
|
27 | printf("CG error: %s\n", cgGetErrorString (err)); |
|
|
28 | exit(1); |
|
|
29 | } |
|
|
30 | } |
|
|
31 | |
23 | /**********************************************************************/ |
32 | /**********************************************************************/ |
24 | |
33 | |
25 | view camera; |
34 | view camera; |
|
|
35 | vec3 camera_velocity; |
|
|
36 | float camera_angle, camera_angle2, camera_velocity_angle, camera_velocity_angle2; |
|
|
37 | float camera_velocity_factor = 80; |
26 | |
38 | |
27 | void |
39 | void |
28 | HotKey_ToggleFullScreen (void) |
40 | HotKey_ToggleFullScreen (void) |
29 | { |
41 | { |
30 | SDL_Surface *screen; |
42 | SDL_Surface *screen; |
… | |
… | |
89 | |
101 | |
90 | printf ("focus\n"); |
102 | printf ("focus\n"); |
91 | break; |
103 | break; |
92 | |
104 | |
93 | case SDL_KEYDOWN: |
105 | case SDL_KEYDOWN: |
94 | |
|
|
95 | if (event->key.keysym.sym == SDLK_UP) |
106 | if (event->key.keysym.sym == SDLK_UP) camera_velocity.z--; |
96 | camera.p.z -= 1; |
|
|
97 | if (event->key.keysym.sym == SDLK_DOWN) |
107 | if (event->key.keysym.sym == SDLK_DOWN) camera_velocity.z++; |
98 | camera.p.z += 1; |
|
|
99 | if (event->key.keysym.sym == SDLK_LEFT) |
|
|
100 | camera.p.x -= 1; |
|
|
101 | if (event->key.keysym.sym == SDLK_RIGHT) |
108 | if (event->key.keysym.sym == SDLK_RIGHT) camera_velocity_angle++; |
102 | camera.p.x += 1; |
109 | if (event->key.keysym.sym == SDLK_LEFT) camera_velocity_angle--; |
|
|
110 | if (event->key.keysym.sym == SDLK_PAGEUP) camera_velocity_angle2++; |
|
|
111 | if (event->key.keysym.sym == SDLK_PAGEDOWN) camera_velocity_angle2--; |
|
|
112 | if (event->key.keysym.sym == SDLK_e) camera_velocity.y--; |
|
|
113 | if (event->key.keysym.sym == SDLK_q) camera_velocity.y++; |
|
|
114 | if (event->key.keysym.sym == SDLK_v) camera_velocity_factor *= 1.5; |
|
|
115 | if (event->key.keysym.sym == SDLK_b) camera_velocity_factor /= 1.5; |
103 | |
116 | |
104 | if (event->key.keysym.sym == SDLK_ESCAPE) |
117 | if (event->key.keysym.sym == SDLK_ESCAPE) |
105 | done = 1; |
118 | done = 1; |
106 | |
119 | |
107 | if ((event->key.keysym.sym == SDLK_g) && |
120 | if ((event->key.keysym.sym == SDLK_g) && |
… | |
… | |
116 | (event->key.keysym.mod & KMOD_ALT)) |
129 | (event->key.keysym.mod & KMOD_ALT)) |
117 | HotKey_ToggleFullScreen (); |
130 | HotKey_ToggleFullScreen (); |
118 | |
131 | |
119 | break; |
132 | break; |
120 | |
133 | |
|
|
134 | case SDL_KEYUP: |
|
|
135 | if (event->key.keysym.sym == SDLK_UP) camera_velocity.z++; |
|
|
136 | if (event->key.keysym.sym == SDLK_DOWN) camera_velocity.z--; |
|
|
137 | if (event->key.keysym.sym == SDLK_LEFT) camera_velocity_angle++; |
|
|
138 | if (event->key.keysym.sym == SDLK_RIGHT) camera_velocity_angle--; |
|
|
139 | if (event->key.keysym.sym == SDLK_PAGEUP) camera_velocity_angle2--; |
|
|
140 | if (event->key.keysym.sym == SDLK_PAGEDOWN) camera_velocity_angle2++; |
|
|
141 | if (event->key.keysym.sym == SDLK_e) camera_velocity.y++; |
|
|
142 | if (event->key.keysym.sym == SDLK_q) camera_velocity.y--; |
|
|
143 | break; |
|
|
144 | |
121 | case SDL_QUIT: |
145 | case SDL_QUIT: |
122 | done = 1; |
146 | done = 1; |
123 | break; |
147 | break; |
124 | } |
148 | } |
125 | |
149 | |
126 | return (done); |
150 | return (done); |
127 | } |
151 | } |
128 | |
152 | |
129 | /* Quick utility function for texture creation */ |
153 | void draw_floor (int size, int dx, int dy, int dz) |
130 | static int |
|
|
131 | power_of_two (int input) |
|
|
132 | { |
154 | { |
133 | int value = 1; |
155 | int x, z, ry; |
134 | |
156 | |
135 | while (value < input) |
157 | for (x = 0; x < 100; x++) |
136 | { |
|
|
137 | value <<= 1; |
|
|
138 | } |
158 | { |
139 | return value; |
159 | for (z = 0; z < 100; z++) |
140 | } |
160 | { |
|
|
161 | vector<vertex2d> pts; |
|
|
162 | pts.push_back (vertex2d (point ( 0, 0, 0), vec3 (0, 1, 0), texc (0, 0))); |
|
|
163 | pts.push_back (vertex2d (point ( 0, 0, size), vec3 (0, 1, 0), texc (0, 1))); |
|
|
164 | pts.push_back (vertex2d (point (size, 0, size), vec3 (0, 1, 0), texc (1, 1))); |
|
|
165 | pts.push_back (vertex2d (point (size, 0, 0), vec3 (0, 1, 0), texc (1, 0))); |
141 | |
166 | |
142 | GLuint |
167 | geometry_quads *q = new geometry_quads; |
143 | SDL_GL_LoadTexture (SDL_Surface * surface, GLfloat * texcoord) |
168 | q->set (pts); |
144 | { |
169 | entity *e = new entity (q); |
145 | GLuint texture; |
170 | e->move (vec3 (dx + x * size, dy, dz + z * size)); |
146 | int w, h; |
171 | e->show (); |
147 | SDL_Surface *image; |
172 | } |
148 | SDL_Rect area; |
|
|
149 | Uint32 saved_flags; |
|
|
150 | Uint8 saved_alpha; |
|
|
151 | |
|
|
152 | /* Use the surface width and height expanded to powers of 2 */ |
|
|
153 | w = power_of_two (surface->w); |
|
|
154 | h = power_of_two (surface->h); |
|
|
155 | texcoord[0] = 0.0f; /* Min X */ |
|
|
156 | texcoord[1] = 0.0f; /* Min Y */ |
|
|
157 | texcoord[2] = (GLfloat) surface->w / w; /* Max X */ |
|
|
158 | texcoord[3] = (GLfloat) surface->h / h; /* Max Y */ |
|
|
159 | |
|
|
160 | image = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 32, |
|
|
161 | #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ |
|
|
162 | 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 |
|
|
163 | #else |
|
|
164 | 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF |
|
|
165 | #endif |
|
|
166 | ); |
|
|
167 | if (image == NULL) |
|
|
168 | { |
173 | } |
169 | return 0; |
174 | } |
170 | } |
|
|
171 | |
175 | |
172 | /* Save the alpha blending attributes */ |
176 | void draw_test_nurb () |
173 | saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK); |
177 | { |
174 | saved_alpha = surface->format->alpha; |
178 | geometry_nurbs *q = new geometry_nurbs; |
175 | if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
179 | q->set (); |
176 | { |
180 | entity *e = new entity (q); |
177 | SDL_SetAlpha (surface, 0, 0); |
181 | e->move (vec3 (10, 3, -4)); |
178 | } |
182 | e->show (); |
179 | |
|
|
180 | /* Copy the surface into the GL texture image */ |
|
|
181 | area.x = 0; |
|
|
182 | area.y = 0; |
|
|
183 | area.w = surface->w; |
|
|
184 | area.h = surface->h; |
|
|
185 | SDL_BlitSurface (surface, &area, image, &area); |
|
|
186 | |
|
|
187 | /* Restore the alpha blending attributes */ |
|
|
188 | if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
|
|
189 | { |
|
|
190 | SDL_SetAlpha (surface, saved_flags, saved_alpha); |
|
|
191 | } |
|
|
192 | |
|
|
193 | /* Create an OpenGL texture for the image */ |
|
|
194 | glGenTextures (1, &texture); |
|
|
195 | glBindTexture (GL_TEXTURE_2D, texture); |
|
|
196 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
|
|
197 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
|
|
198 | glTexImage2D (GL_TEXTURE_2D, |
|
|
199 | 0, |
|
|
200 | GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); |
|
|
201 | SDL_FreeSurface (image); /* No longer needed */ |
|
|
202 | |
|
|
203 | return texture; |
|
|
204 | } |
183 | } |
205 | |
184 | |
206 | int |
185 | int |
207 | RunGLTest (int argc, char *argv[], |
186 | RunGLTest (int argc, char *argv[], |
208 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
187 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
… | |
… | |
214 | int done = 0; |
193 | int done = 0; |
215 | int frames; |
194 | int frames; |
216 | Uint32 start_time, this_time; |
195 | Uint32 start_time, this_time; |
217 | Uint32 video_flags; |
196 | Uint32 video_flags; |
218 | int value; |
197 | int value; |
|
|
198 | GLenum gl_error; |
219 | |
199 | |
220 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
200 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
221 | { |
201 | { |
222 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
202 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
223 | exit (1); |
203 | exit (1); |
… | |
… | |
261 | rgb_size[0] = 8; |
241 | rgb_size[0] = 8; |
262 | rgb_size[1] = 8; |
242 | rgb_size[1] = 8; |
263 | rgb_size[2] = 8; |
243 | rgb_size[2] = 8; |
264 | break; |
244 | break; |
265 | } |
245 | } |
|
|
246 | |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
247 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
248 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
249 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
269 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); |
250 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); |
270 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
251 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
… | |
… | |
315 | |
296 | |
316 | /* Set the gamma for the window */ |
297 | /* Set the gamma for the window */ |
317 | if (gamma != 0.0) |
298 | if (gamma != 0.0) |
318 | SDL_SetGamma (gamma, gamma, gamma); |
299 | SDL_SetGamma (gamma, gamma, gamma); |
319 | |
300 | |
|
|
301 | for (int i = 0; i < 1; i++) |
|
|
302 | { |
|
|
303 | // load a entity |
|
|
304 | txtprt_parser p; |
|
|
305 | geometry *g; |
|
|
306 | try |
|
|
307 | { |
|
|
308 | g = p.read ("test.blasc"); |
|
|
309 | } |
|
|
310 | catch (txtprt_i_exception & e) |
|
|
311 | { |
|
|
312 | cout << "ERR: " << e.msg << endl; |
|
|
313 | } |
|
|
314 | |
|
|
315 | entity *e = new entity (g); |
|
|
316 | e->move (vec3 (i*5, -3, -i*10)); |
|
|
317 | e->show (); |
|
|
318 | } |
|
|
319 | |
|
|
320 | draw_floor (10, -500, -10, -1000); |
|
|
321 | //draw_test_nurb (); |
|
|
322 | |
320 | camera.orig.x = camera.orig.y = camera.orig.z = 0; |
323 | camera.orig.x = camera.orig.y = camera.orig.z = 0; |
321 | camera.p = point (0, 0, 10); |
324 | camera.p = point (0, 0, 10); |
322 | camera.d = vec3 (0, 0, -1); |
325 | camera.d = vec3 (0, 0, -1); |
323 | camera.u = vec3 (0, 1, 0); |
326 | camera.u = vec3 (0, 1, 0); |
324 | camera.w = w; camera.h = h; |
327 | camera.w = w; camera.h = h; |
325 | camera.fov = 90; |
328 | camera.fov = 35; |
|
|
329 | camera.z_near = 1.; |
326 | |
330 | |
327 | glMatrixMode (GL_MODELVIEW); |
331 | glMatrixMode (GL_MODELVIEW); |
328 | glLoadIdentity (); |
332 | glLoadIdentity (); |
329 | |
333 | |
330 | glEnable (GL_CULL_FACE); |
334 | glEnable (GL_CULL_FACE); |
331 | glEnable (GL_DEPTH_TEST); |
335 | glEnable (GL_DEPTH_TEST); |
|
|
336 | |
332 | glShadeModel (GL_SMOOTH); |
337 | glShadeModel (GL_SMOOTH); |
333 | |
338 | |
334 | glEnable (GL_LIGHTING); |
339 | glEnable (GL_LIGHTING); |
335 | //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
|
|
336 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
|
|
337 | //glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); |
|
|
338 | glEnable (GL_LIGHT0); |
340 | glEnable (GL_LIGHT0); |
|
|
341 | |
|
|
342 | cgc = cgCreateContext (); |
|
|
343 | |
|
|
344 | vsh_profile = CG_PROFILE_ARBVP1; |
|
|
345 | //if (cgGLIsProfileSupported (CG_PROFILE_VP30)) vsh_profile = CG_PROFILE_VP30; |
|
|
346 | //if (cgGLIsProfileSupported (CG_PROFILE_VP40)) vsh_profile = CG_PROFILE_VP40; |
|
|
347 | fsh_profile = CG_PROFILE_ARBFP1; |
|
|
348 | //if (cgGLIsProfileSupported (CG_PROFILE_FP30)) fsh_profile = CG_PROFILE_FP30; |
|
|
349 | //if (cgGLIsProfileSupported (CG_PROFILE_FP40)) fsh_profile = CG_PROFILE_FP40; |
|
|
350 | |
|
|
351 | vsh = cgCreateProgramFromFile (cgc, CG_SOURCE, "vsh.cg", vsh_profile, 0, 0); |
|
|
352 | CheckCgError (); |
|
|
353 | cgGLLoadProgram (vsh); |
|
|
354 | CheckCgError (); |
|
|
355 | mv = cgGetNamedParameter (vsh, "WorldProj"); |
|
|
356 | mvp = cgGetNamedParameter (vsh, "WorldViewProj"); |
|
|
357 | lightpos = cgGetNamedParameter (vsh, "LightPos"); |
|
|
358 | CheckCgError (); |
|
|
359 | |
|
|
360 | CGparameter g_Texture; // the texture parameter |
|
|
361 | |
|
|
362 | |
|
|
363 | fsh = cgCreateProgramFromFile (cgc, CG_SOURCE, "fsh.cg", fsh_profile, 0, 0); |
|
|
364 | Texture t("o.jpg"); |
|
|
365 | g_Texture = cgGetNamedParameter(fsh, "Texture"); // the texture cg-warper ;) |
|
|
366 | cgGLSetTextureParameter(g_Texture, t.texture); // Bind the texture number 999 to g_Texture |
|
|
367 | CheckCgError (); |
|
|
368 | cgGLLoadProgram (fsh); |
|
|
369 | CheckCgError (); |
|
|
370 | |
|
|
371 | cgGLBindProgram (vsh); |
|
|
372 | CheckCgError (); |
|
|
373 | cgGLBindProgram (fsh); |
|
|
374 | CheckCgError (); |
339 | |
375 | |
340 | /* Loop until done. */ |
376 | /* Loop until done. */ |
341 | start_time = SDL_GetTicks (); |
377 | start_time = SDL_GetTicks (); |
342 | frames = 0; |
378 | frames = 0; |
343 | |
379 | |
344 | draw_context c (camera); |
|
|
345 | |
|
|
346 | while (!done) |
380 | while (!done) |
347 | { |
381 | { |
348 | GLenum gl_error; |
|
|
349 | char *sdl_error; |
382 | char *sdl_error; |
350 | SDL_Event event; |
383 | SDL_Event event; |
351 | |
384 | |
352 | /* Do our drawing, too. */ |
385 | camera_angle += 180 * camera_velocity_angle * timer.diff; |
353 | glClearColor (0.0, 0.0, 0.0, 1.0); |
386 | camera_angle2 += 180 * camera_velocity_angle2 * timer.diff; |
354 | glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
355 | |
387 | |
356 | GLfloat lightp[4]; |
388 | vec3 geradeaus = matrix::rotation (-camera_angle, vec3 (0, 1, 0)) * vec3 (0, 0, -1); |
357 | lightp[0] = camera.p.x; |
389 | vec3 right = matrix::rotation (90., vec3 (0, 1, 0)) * geradeaus; |
358 | lightp[1] = camera.p.y; |
390 | |
359 | lightp[2] = camera.p.z; |
391 | camera.d = matrix::rotation (camera_angle2, right) * geradeaus; |
360 | lightp[3] = 1; |
392 | camera.u = cross (camera.d, right); |
361 | glLightfv (GL_LIGHT0, GL_POSITION, lightp); |
393 | |
|
|
394 | camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z; |
|
|
395 | camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y; |
|
|
396 | |
|
|
397 | cgGLSetParameter4f (lightpos, camera.p.x, camera.p.y, camera.p.z, 1); |
|
|
398 | |
|
|
399 | glBindTexture (GL_TEXTURE_2D, t.texture); |
|
|
400 | cgGLEnableTextureParameter (g_Texture); // Enable the texture parameter |
362 | |
401 | |
363 | #if 0 |
402 | #if 0 |
364 | static GLfloat ry; |
403 | static GLfloat ry; |
365 | ry += 0.001; |
404 | ry += 0.001; |
366 | camera.d.x = cos (ry); |
405 | camera.d.x = cos (ry); |
367 | camera.d.z = sin (ry); |
406 | camera.d.z = sin (ry); |
368 | //camera.d.y = sin (ry * 0.1); |
407 | //camera.d.y = sin (ry * 0.1); |
369 | #endif |
408 | #endif |
370 | |
409 | |
371 | c.mode = draw_context::DEPTH; |
410 | camera.begin (); |
|
|
411 | camera.pass (view::DEPTH); |
|
|
412 | camera.pass (view::LIGHTED); |
372 | camera.draw (c); |
413 | camera.end (); |
373 | c.drawn.clear (); |
|
|
374 | c.mode = draw_context::LIGHTED; |
|
|
375 | camera.draw (c); |
|
|
376 | |
414 | |
377 | SDL_GL_SwapBuffers (); |
415 | SDL_GL_SwapBuffers (); |
378 | timer.frame (); |
416 | timer.frame (); |
379 | |
417 | |
380 | /* Check for error conditions. */ |
418 | /* Check for error conditions. */ |
381 | gl_error = glGetError (); |
419 | gl_error = glGetError (); |
382 | |
420 | |
383 | if (gl_error != GL_NO_ERROR) |
|
|
384 | fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
421 | if (gl_error != GL_NO_ERROR) fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
385 | |
422 | |
386 | sdl_error = SDL_GetError (); |
423 | sdl_error = SDL_GetError (); |
387 | |
424 | |
388 | if (sdl_error[0] != '\0') |
425 | if (sdl_error[0] != '\0') |
389 | { |
426 | { |
390 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
427 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
391 | SDL_ClearError (); |
428 | SDL_ClearError (); |
392 | } |
429 | } |
393 | |
430 | |
394 | /* Allow the user to see what's happening */ |
431 | /* Allow the user to see what's happening */ |
395 | //SDL_Delay (20); |
432 | //SDL_Delay (40); |
396 | |
433 | |
397 | /* Check if there's a pending event. */ |
434 | /* Check if there's a pending event. */ |
398 | while (SDL_PollEvent (&event)) |
435 | while (SDL_PollEvent (&event)) |
399 | { |
|
|
400 | done = HandleEvent (&event); |
436 | done = HandleEvent (&event); |
401 | } |
437 | |
|
|
438 | |
402 | ++frames; |
439 | ++frames; |
403 | } |
440 | } |
404 | |
441 | |
405 | /* Print out the frames per second */ |
442 | /* Print out the frames per second */ |
406 | this_time = SDL_GetTicks (); |
443 | this_time = SDL_GetTicks (); |
… | |
… | |
435 | int slowly; |
472 | int slowly; |
436 | float gamma = 0.0; |
473 | float gamma = 0.0; |
437 | int noframe = 0; |
474 | int noframe = 0; |
438 | int fsaa = 0; |
475 | int fsaa = 0; |
439 | |
476 | |
440 | // load a entity |
|
|
441 | for (int i = 0; i < 7; i++) { |
|
|
442 | txtprt_parser p; |
|
|
443 | entity_anim *f = new entity_anim; |
|
|
444 | entity *e; |
|
|
445 | try { |
|
|
446 | e = p.read ("test.blasc"); |
|
|
447 | } catch (txtprt_i_exception & e) { |
|
|
448 | cout << "ERR: " << e.msg << endl; |
|
|
449 | } |
|
|
450 | f->set (e); |
|
|
451 | f->m.translate (vec3 (i, -1, 0)); |
|
|
452 | f->vx = 0; |
|
|
453 | f->vy = 0; |
|
|
454 | f->vz = 0; |
|
|
455 | f->show (); |
|
|
456 | } |
|
|
457 | |
|
|
458 | logo = 0; |
477 | logo = 0; |
459 | slowly = 0; |
478 | slowly = 0; |
460 | numtests = 1; |
479 | numtests = 1; |
461 | for (i = 1; argv[i]; ++i) |
480 | for (i = 1; argv[i]; ++i) |
462 | { |
481 | { |
… | |
… | |
490 | ("Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n", |
509 | ("Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n", |
491 | argv[0]); |
510 | argv[0]); |
492 | exit (0); |
511 | exit (0); |
493 | } |
512 | } |
494 | } |
513 | } |
|
|
514 | |
495 | for (i = 0; i < numtests; ++i) |
515 | for (i = 0; i < numtests; ++i) |
496 | { |
|
|
497 | RunGLTest (argc, argv, logo, slowly, bpp, gamma, noframe, fsaa); |
516 | RunGLTest (argc, argv, logo, slowly, bpp, gamma, noframe, fsaa); |
498 | } |
517 | |
499 | return 0; |
518 | return 0; |
500 | } |
519 | } |