… | |
… | |
325 | camera.fov = 90; |
325 | camera.fov = 90; |
326 | |
326 | |
327 | glMatrixMode (GL_MODELVIEW); |
327 | glMatrixMode (GL_MODELVIEW); |
328 | glLoadIdentity (); |
328 | glLoadIdentity (); |
329 | |
329 | |
330 | //glEnable (GL_CULL_FACE); |
330 | glEnable (GL_CULL_FACE); |
331 | glEnable (GL_DEPTH_TEST); |
331 | glEnable (GL_DEPTH_TEST); |
332 | glDepthFunc (GL_LESS); |
|
|
333 | glShadeModel (GL_SMOOTH); |
332 | glShadeModel (GL_SMOOTH); |
334 | |
333 | |
335 | glEnable (GL_LIGHTING); |
334 | glEnable (GL_LIGHTING); |
336 | //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
335 | //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
337 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
336 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
… | |
… | |
339 | glEnable (GL_LIGHT0); |
338 | glEnable (GL_LIGHT0); |
340 | |
339 | |
341 | /* Loop until done. */ |
340 | /* Loop until done. */ |
342 | start_time = SDL_GetTicks (); |
341 | start_time = SDL_GetTicks (); |
343 | frames = 0; |
342 | frames = 0; |
|
|
343 | |
|
|
344 | draw_context c (camera); |
|
|
345 | |
344 | while (!done) |
346 | while (!done) |
345 | { |
347 | { |
346 | GLenum gl_error; |
348 | GLenum gl_error; |
347 | char *sdl_error; |
349 | char *sdl_error; |
348 | SDL_Event event; |
350 | SDL_Event event; |
… | |
… | |
364 | camera.d.x = cos (ry); |
366 | camera.d.x = cos (ry); |
365 | camera.d.z = sin (ry); |
367 | camera.d.z = sin (ry); |
366 | //camera.d.y = sin (ry * 0.1); |
368 | //camera.d.y = sin (ry * 0.1); |
367 | #endif |
369 | #endif |
368 | |
370 | |
369 | draw_context c (camera); |
371 | c.mode = draw_context::DEPTH; |
|
|
372 | camera.draw (c); |
|
|
373 | c.drawn.clear (); |
370 | c.mode = draw_context::LIGHTED; |
374 | c.mode = draw_context::LIGHTED; |
371 | camera.draw (c); |
375 | camera.draw (c); |
372 | |
376 | |
373 | SDL_GL_SwapBuffers (); |
377 | SDL_GL_SwapBuffers (); |
374 | timer.frame (); |
378 | timer.frame (); |
… | |
… | |
430 | int bpp = 0; |
434 | int bpp = 0; |
431 | int slowly; |
435 | int slowly; |
432 | float gamma = 0.0; |
436 | float gamma = 0.0; |
433 | int noframe = 0; |
437 | int noframe = 0; |
434 | int fsaa = 0; |
438 | int fsaa = 0; |
435 | |
|
|
436 | gl_matrix m(2); |
|
|
437 | m.translate (vec3 (2,3,4)); |
|
|
438 | |
439 | |
439 | // load a entity |
440 | // load a entity |
440 | for (int i = 0; i < 7; i++) { |
441 | for (int i = 0; i < 7; i++) { |
441 | txtprt_parser p; |
442 | txtprt_parser p; |
442 | entity_anim *f = new entity_anim; |
443 | entity_anim *f = new entity_anim; |
… | |
… | |
446 | } catch (txtprt_i_exception & e) { |
447 | } catch (txtprt_i_exception & e) { |
447 | cout << "ERR: " << e.msg << endl; |
448 | cout << "ERR: " << e.msg << endl; |
448 | } |
449 | } |
449 | f->set (e); |
450 | f->set (e); |
450 | f->m.translate (vec3 (i, -1, 0)); |
451 | f->m.translate (vec3 (i, -1, 0)); |
451 | f->vx = i * 10 + 5; |
452 | f->vx = 0; |
452 | f->vy = i * 40 + 5; |
453 | f->vy = 0; |
453 | f->vz = i * 60 + 5; |
454 | f->vz = 0; |
454 | f->show (); |
455 | f->show (); |
455 | } |
456 | } |
456 | |
457 | |
457 | logo = 0; |
458 | logo = 0; |
458 | slowly = 0; |
459 | slowly = 0; |