… | |
… | |
206 | RunGLTest (int argc, char *argv[], |
206 | RunGLTest (int argc, char *argv[], |
207 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
207 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
208 | { |
208 | { |
209 | int i; |
209 | int i; |
210 | int rgb_size[3]; |
210 | int rgb_size[3]; |
211 | int w = 640; |
211 | int w = 1600; |
212 | int h = 480; |
212 | int h = 1200; |
213 | int done = 0; |
213 | int done = 0; |
214 | int frames; |
214 | int frames; |
215 | Uint32 video_flags; |
215 | Uint32 video_flags; |
216 | int value; |
216 | int value; |
217 | GLenum gl_error; |
217 | GLenum gl_error; |
218 | |
218 | |
219 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
219 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
220 | { |
220 | { |
221 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
221 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
222 | exit (1); |
222 | exit (1); |
… | |
… | |
264 | } |
264 | } |
265 | |
265 | |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
|
|
269 | SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 0); |
269 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24); |
270 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24); |
270 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
271 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
271 | |
272 | |
272 | if (fsaa) |
273 | if (fsaa) |
273 | { |
274 | { |
… | |
… | |
294 | printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); |
295 | printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); |
295 | SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); |
296 | SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); |
296 | printf ("SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1], value); |
297 | printf ("SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1], value); |
297 | SDL_GL_GetAttribute (SDL_GL_BLUE_SIZE, &value); |
298 | SDL_GL_GetAttribute (SDL_GL_BLUE_SIZE, &value); |
298 | printf ("SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2], value); |
299 | printf ("SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2], value); |
|
|
300 | SDL_GL_GetAttribute (SDL_GL_ALPHA_SIZE, &value); |
|
|
301 | printf ("SDL_GL_ALPHA_SIZE: requested ?, got %d\n", value); |
299 | SDL_GL_GetAttribute (SDL_GL_DEPTH_SIZE, &value); |
302 | SDL_GL_GetAttribute (SDL_GL_DEPTH_SIZE, &value); |
300 | printf ("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value); |
303 | printf ("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value); |
301 | SDL_GL_GetAttribute (SDL_GL_DOUBLEBUFFER, &value); |
304 | SDL_GL_GetAttribute (SDL_GL_DOUBLEBUFFER, &value); |
302 | printf ("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value); |
305 | printf ("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value); |
303 | |
306 | |
… | |
… | |
316 | /* Set the gamma for the window */ |
319 | /* Set the gamma for the window */ |
317 | if (gamma != 0.0) |
320 | if (gamma != 0.0) |
318 | SDL_SetGamma (gamma, gamma, gamma); |
321 | SDL_SetGamma (gamma, gamma, gamma); |
319 | |
322 | |
320 | testmat = new test_material; |
323 | testmat = new test_material; |
321 | testmat2 = new test_material2; |
324 | testmat2 = new mat_gouraud_shaded (colour (1, 1, 0)); |
|
|
325 | testmat3 = new mat_timed (); |
|
|
326 | debugmat = new mat_debug (); |
322 | |
327 | |
323 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat, 10)); |
328 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat2, 10)); |
324 | planet->move (vec3 (0, 0, -20)); |
329 | planet->move (vec3 (0, 0, -20)); |
325 | planet->show (); |
330 | planet->show (); |
326 | |
331 | |
327 | planet->v = vec3 (10, 0, 0); |
332 | planet->v = vec3 (10, 0, 0); |
328 | moveables.push_back (planet); |
333 | moveables.push_back (planet); |
329 | |
334 | |
330 | doom3parse ("test.proc"); |
335 | doom3parse ("test.proc"); |
|
|
336 | |
|
|
337 | skybox sb ( |
|
|
338 | "textures/skybox_mystery/1.jpg", |
|
|
339 | "textures/skybox_mystery/2.jpg", |
|
|
340 | "textures/skybox_mystery/3.jpg", |
|
|
341 | "textures/skybox_mystery/4.jpg", |
|
|
342 | "textures/skybox_mystery/5.jpg", |
|
|
343 | "textures/skybox_mystery/6.jpg" |
|
|
344 | ); |
|
|
345 | world_skybox = &sb; |
331 | |
346 | |
332 | for (int i = 0; i < 20; i++) |
347 | for (int i = 0; i < 20; i++) |
333 | { |
348 | { |
334 | // load a entity |
349 | // load a entity |
335 | txtprt_parser p; |
350 | txtprt_parser p; |
… | |
… | |
354 | //planet->move (vec3 (0, 0, -1.5e9)); |
369 | //planet->move (vec3 (0, 0, -1.5e9)); |
355 | //planet->show (); |
370 | //planet->show (); |
356 | } |
371 | } |
357 | |
372 | |
358 | { |
373 | { |
359 | entity *planet = new entity (new geometry_sphere (testmat, 4e15)); |
374 | entity *planet = new entity (new geometry_sphere (testmat3, 4e15)); |
360 | planet->move (vec3 (0, 0, 1e17)); |
375 | planet->move (vec3 (0, 0, 1e17)); |
361 | planet->show (); |
376 | planet->show (); |
362 | } |
377 | } |
363 | |
378 | |
364 | { |
379 | { |
… | |
… | |
413 | // mylight.radius = 100000; |
428 | // mylight.radius = 100000; |
414 | // mylight.c = colour (1., 1, 1, 1.); |
429 | // mylight.c = colour (1., 1, 1, 1.); |
415 | // mylight.intensity = 1.F; |
430 | // mylight.intensity = 1.F; |
416 | |
431 | |
417 | mylight2.radius = 100000; |
432 | mylight2.radius = 100000; |
418 | mylight2.c = colour (1., 1., 1., 1.); |
433 | mylight2.c = colour (0., 1., 1., 1.); |
419 | mylight2.intensity = 1.F; |
434 | mylight2.intensity = 1.F; |
420 | mylight2.orig.x = 0; mylight2.orig.y = 0; mylight2.orig.z = 0; |
435 | 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; |
436 | mylight2.p.x = 0; mylight2.p.y = 0; mylight2.p.z = 0; |
422 | |
437 | |
423 | //pass_data pass_light (&mylight); |
438 | //pass_data pass_light (&mylight); |
… | |
… | |
442 | |
457 | |
443 | //mylight.orig = camera.orig; |
458 | //mylight.orig = camera.orig; |
444 | //mylight.p = camera.p; |
459 | //mylight.p = camera.p; |
445 | |
460 | |
446 | mylight2.orig = camera.orig; |
461 | mylight2.orig = camera.orig; |
447 | mylight2.p = vec3 (sin (timer.now / 2) * 100000, 1, cos (timer.now / 2) * 100000); |
462 | //mylight2.p = vec3 (sin (timer.now / 2) * 100000, 1, cos (timer.now / 2) * 100000); |
448 | |
463 | |
449 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
464 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
450 | |
465 | |
451 | camera.begin (); |
466 | camera.begin (); |
452 | camera.render (pass_depth); |
467 | camera.render (pass_depth); |