1 | #include <stdlib.h> |
1 | #include <stdlib.h> |
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 | #include <list> |
5 | |
6 | |
6 | #include "opengl.h" |
7 | #include "opengl.h" |
7 | |
8 | |
8 | #include "SDL.h" |
9 | #include "SDL.h" |
9 | #include "SDL_opengl.h" |
10 | #include "SDL_opengl.h" |
… | |
… | |
16 | #include "txtprt_import.h" |
17 | #include "txtprt_import.h" |
17 | |
18 | |
18 | bool doom3parse (const char *f); |
19 | bool doom3parse (const char *f); |
19 | |
20 | |
20 | #include "shader.h" |
21 | #include "shader.h" |
|
|
22 | |
|
|
23 | #include "physics.h" |
21 | |
24 | |
22 | /**********************************************************************/ |
25 | /**********************************************************************/ |
23 | |
26 | |
24 | view camera; |
27 | view camera; |
25 | vec3 camera_velocity; |
28 | vec3 camera_velocity; |
… | |
… | |
188 | } |
191 | } |
189 | } |
192 | } |
190 | |
193 | |
191 | extern void draw_level (); |
194 | extern void draw_level (); |
192 | |
195 | |
|
|
196 | std::list<entity_moveable *> moveables; |
|
|
197 | |
|
|
198 | void perfom_moves () |
|
|
199 | { |
|
|
200 | for (std::list<entity_moveable *>::iterator i = moveables.begin (); i != moveables.end (); ++i) |
|
|
201 | { |
|
|
202 | (*i)->perform_step (timer.diff); |
|
|
203 | } |
|
|
204 | } |
|
|
205 | |
193 | int |
206 | int |
194 | RunGLTest (int argc, char *argv[], |
207 | RunGLTest (int argc, char *argv[], |
195 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
208 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
196 | { |
209 | { |
197 | int i; |
210 | int i; |
… | |
… | |
305 | if (gamma != 0.0) |
318 | if (gamma != 0.0) |
306 | SDL_SetGamma (gamma, gamma, gamma); |
319 | SDL_SetGamma (gamma, gamma, gamma); |
307 | |
320 | |
308 | testmat = new test_material; |
321 | testmat = new test_material; |
309 | |
322 | |
310 | entity *planet = new entity (new geometry_sphere (testmat, 10)); |
323 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat, 10)); |
311 | planet->move (vec3 (0, 0, -20)); |
324 | planet->move (vec3 (0, 0, -20)); |
312 | planet->show (); |
325 | planet->show (); |
|
|
326 | |
|
|
327 | planet->v = vec3 (10, 0, 0); |
|
|
328 | moveables.push_back (planet); |
313 | |
329 | |
314 | doom3parse ("test.proc"); |
330 | doom3parse ("test.proc"); |
315 | |
331 | |
316 | for (int i = 0; i < 20; i++) |
332 | for (int i = 0; i < 20; i++) |
317 | { |
333 | { |
… | |
… | |
415 | camera.render (pass_postdepth); |
431 | camera.render (pass_postdepth); |
416 | camera.render (pass_light); |
432 | camera.render (pass_light); |
417 | //camera.render (view::LIGHTED, pass_light2); |
433 | //camera.render (view::LIGHTED, pass_light2); |
418 | camera.end (); |
434 | camera.end (); |
419 | |
435 | |
|
|
436 | perfom_moves (); |
|
|
437 | |
420 | SDL_GL_SwapBuffers (); |
438 | SDL_GL_SwapBuffers (); |
421 | timer.frame (); |
439 | timer.frame (); |
422 | |
440 | |
423 | #if 0 |
441 | #if 0 |
424 | /* Check for error conditions. */ |
442 | /* Check for error conditions. */ |