aggiunta delle sphere

This commit is contained in:
Federico Ponchio 2005-02-15 15:55:36 +00:00
parent 099bae2d71
commit 02d8bd6b38
1 changed files with 21 additions and 6 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.36 2005/02/14 17:11:08 ponchio
aggiunta delle sphere
Revision 1.35 2005/02/14 14:49:09 ponchio Revision 1.35 2005/02/14 14:49:09 ponchio
*** empty log message *** *** empty log message ***
@ -260,6 +263,7 @@ int main(int argc, char *argv[]) {
bool rotate = false; bool rotate = false;
bool show_borders = false; bool show_borders = false;
bool show_colors = true; bool show_colors = true;
bool do_render = true;
bool show_normals = true; bool show_normals = true;
bool show_statistics = true; bool show_statistics = true;
bool extract = true; bool extract = true;
@ -285,17 +289,23 @@ int main(int argc, char *argv[]) {
// FrustumPolicy frustum_policy; // FrustumPolicy frustum_policy;
cerr << "Commands: \n" cerr << "Commands: \n"
" q: quit\n" " q : quit\n"
" t: toggle statistics\n" " t : toggle statistics\n"
" b: increase memory buffer\n" " right arrow: increase memory buffer\n"
" B: decrease memory buffer\n" " left arrow : decrease memory buffer\n"
" page up : increase disk space\n"
" page down : increase disk space\n"
" 0 : decrease extraction size\n"
" 1 : increase extraction size\n"
" s: toggle preload\n" " s: toggle preload\n"
" d: debug mode (show patches colored)\n" " d: debug mode (show patches colored)\n"
" f: flat shading mode\n" " f: flat shading mode\n"
" m: smooth mode\n" " m: smooth mode\n"
" p: draw points\n" " p: draw points\n"
" h: draw bounding spheres\n" " h: draw bounding spheres\n"
" w: disable glcalls\n"
" c: show colors\n" " c: show colors\n"
" n: show normals\n" " n: show normals\n"
@ -348,6 +358,7 @@ int main(int argc, char *argv[]) {
case SDLK_e: extract = !extract; break; case SDLK_e: extract = !extract; break;
case SDLK_c: show_colors = !show_colors; break; case SDLK_c: show_colors = !show_colors; break;
case SDLK_n: show_normals = !show_normals; break; case SDLK_n: show_normals = !show_normals; break;
case SDLK_w: do_render = !do_render; break;
case SDLK_LEFT: nexus.MaxRam() *= 0.8; break; case SDLK_LEFT: nexus.MaxRam() *= 0.8; break;
case SDLK_RIGHT: nexus.MaxRam() *= 1.3; break; case SDLK_RIGHT: nexus.MaxRam() *= 1.3; break;
@ -427,16 +438,17 @@ int main(int argc, char *argv[]) {
default: break; default: break;
} }
} }
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
gluPerspective(40, 1, 0.1, 100); gluPerspective(40, 1024/768.f, 0.1, 100);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
gluLookAt(0,0,5, 0,0,0, 0,1,0); gluLookAt(0,0,5, 0,0,0, 0,1,0);
glViewport(0,0,width,height);
glRotatef(alpha, 0, 1, 0); glRotatef(alpha, 0, 1, 0);
if(rotate) { if(rotate) {
alpha++; alpha++;
@ -472,7 +484,10 @@ int main(int argc, char *argv[]) {
extraction.Update(&nexus); extraction.Update(&nexus);
} }
} }
if(do_render)
nexus.Render(extraction, contest, &stats); nexus.Render(extraction, contest, &stats);
else
stats.Init();
/* if(show_borders) { /* if(show_borders) {
for(unsigned int i = 0; i < cells.size(); i++) { for(unsigned int i = 0; i < cells.size(); i++) {