… | |
… | |
13 | static GLuint global_texture = 0; |
13 | static GLuint global_texture = 0; |
14 | |
14 | |
15 | #include "util.h" |
15 | #include "util.h" |
16 | #include "entity.h" |
16 | #include "entity.h" |
17 | #include "txtprt_import.h" |
17 | #include "txtprt_import.h" |
|
|
18 | #include "randlvl.h" |
18 | |
19 | |
19 | bool doom3parse (const char *f); |
20 | bool doom3parse (const char *f); |
20 | |
21 | |
21 | #include "shader.h" |
22 | #include "shader.h" |
22 | |
|
|
23 | #include "physics.h" |
|
|
24 | |
23 | |
25 | /**********************************************************************/ |
24 | /**********************************************************************/ |
26 | |
25 | |
27 | view camera; |
26 | view camera; |
28 | vec3 camera_velocity; |
27 | vec3 camera_velocity; |
… | |
… | |
317 | /* Set the gamma for the window */ |
316 | /* Set the gamma for the window */ |
318 | if (gamma != 0.0) |
317 | if (gamma != 0.0) |
319 | SDL_SetGamma (gamma, gamma, gamma); |
318 | SDL_SetGamma (gamma, gamma, gamma); |
320 | |
319 | |
321 | testmat = new test_material; |
320 | testmat = new test_material; |
|
|
321 | testmat2 = new test_material2; |
322 | |
322 | |
323 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat, 10)); |
323 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat, 10)); |
324 | planet->move (vec3 (0, 0, -20)); |
324 | planet->move (vec3 (0, 0, -20)); |
325 | planet->show (); |
325 | planet->show (); |
326 | |
326 | |
… | |
… | |
359 | entity *planet = new entity (new geometry_sphere (testmat, 4e15)); |
359 | entity *planet = new entity (new geometry_sphere (testmat, 4e15)); |
360 | planet->move (vec3 (0, 0, 1e17)); |
360 | planet->move (vec3 (0, 0, 1e17)); |
361 | planet->show (); |
361 | planet->show (); |
362 | } |
362 | } |
363 | |
363 | |
|
|
364 | { |
|
|
365 | RandomBuilding r; |
|
|
366 | entity *randlvl = r.draw (1000, 1000, 200); |
|
|
367 | randlvl->move (vec3 (0, 0, 0)); |
|
|
368 | randlvl->show (); |
|
|
369 | |
|
|
370 | entity *randlvl2 = r.draw (1000, 10000, 1000); |
|
|
371 | randlvl2->move (vec3 (-20000, 0, 0)); |
|
|
372 | randlvl2->show (); |
|
|
373 | |
|
|
374 | entity *randlvl3 = r.draw (100, 30, 3); |
|
|
375 | randlvl3->move (vec3 (-1000, 0, 0)); |
|
|
376 | randlvl3->show (); |
|
|
377 | |
|
|
378 | |
|
|
379 | entity *randlvl4 = r.draw (100, 1000000, 100000); |
|
|
380 | randlvl4->move (vec3 (0, -1001000, 0)); |
|
|
381 | randlvl4->show (); |
|
|
382 | } |
|
|
383 | |
364 | //draw_floor (10, -500, -10, -1000); |
384 | //draw_floor (10, -500, -10, -1000); |
365 | draw_level (); |
385 | draw_level (); |
366 | |
386 | |
367 | #if 0 |
387 | #if 0 |
368 | { |
388 | { |
… | |
… | |
386 | glDisable (GL_ALPHA_TEST); |
406 | glDisable (GL_ALPHA_TEST); |
387 | |
407 | |
388 | /* Loop until done. */ |
408 | /* Loop until done. */ |
389 | frames = 0; |
409 | frames = 0; |
390 | |
410 | |
391 | linear_light mylight, mylight2; |
411 | linear_light mylight2;//mylight, mylight2; |
392 | |
412 | |
393 | mylight.radius = 100000; |
413 | // mylight.radius = 100000; |
394 | mylight.c = colour (1., 1, 1, 1.); |
414 | // mylight.c = colour (1., 1, 1, 1.); |
395 | mylight.intensity = 1.F; |
415 | // mylight.intensity = 1.F; |
396 | |
416 | |
397 | mylight2.radius = 100000; |
417 | mylight2.radius = 100000; |
398 | mylight2.c = colour (1., 0, 0, 1.); |
418 | mylight2.c = colour (1., 1., 1., 1.); |
399 | mylight2.intensity = 1.F; |
419 | mylight2.intensity = 1.F; |
|
|
420 | mylight2.orig.x = 0; mylight2.orig.y = 0; mylight2.orig.z = 0; |
|
|
421 | mylight2.p.x = 0; mylight2.p.y = 0; mylight2.p.z = 0; |
400 | |
422 | |
401 | pass_data pass_light (&mylight); |
423 | //pass_data pass_light (&mylight); |
402 | pass_data pass_light2 (&mylight2); |
424 | pass_data pass_light2 (&mylight2); |
403 | |
425 | |
404 | while (!done) |
426 | while (!done) |
405 | { |
427 | { |
406 | char *sdl_error; |
428 | char *sdl_error; |
… | |
… | |
416 | camera.u = cross (camera.d, right); |
438 | camera.u = cross (camera.d, right); |
417 | |
439 | |
418 | camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z; |
440 | camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z; |
419 | camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y; |
441 | camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y; |
420 | |
442 | |
421 | mylight.orig = camera.orig; |
443 | //mylight.orig = camera.orig; |
422 | mylight.p = camera.p; |
444 | //mylight.p = camera.p; |
423 | |
445 | |
424 | mylight2.orig = camera.orig; |
446 | mylight2.orig = camera.orig; |
425 | mylight2.p = camera.p + vec3 (sin (timer.now * 2) * 100, 1, cos (timer.now * 2) * 100); |
447 | mylight2.p = vec3 (sin (timer.now / 2) * 100000, 1, cos (timer.now / 2) * 100000); |
426 | |
448 | |
427 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
449 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
428 | |
450 | |
429 | camera.begin (); |
451 | camera.begin (); |
430 | camera.render (pass_depth); |
452 | camera.render (pass_depth); |
431 | camera.render (pass_postdepth); |
453 | camera.render (pass_postdepth); |
432 | camera.render (pass_light); |
454 | camera.render (pass_light2); |
433 | //camera.render (view::LIGHTED, pass_light2); |
455 | //camera.render (view::LIGHTED, pass_light2); |
434 | camera.end (); |
456 | camera.end (); |
435 | |
457 | |
436 | perfom_moves (); |
458 | perfom_moves (); |
437 | |
459 | |