Small changes.

This commit is contained in:
Federico Ponchio 2004-10-14 13:52:02 +00:00
parent 54a1d90730
commit 27636b4eeb
1 changed files with 43 additions and 18 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.13 2004/10/14 13:41:34 ponchio
Added statistics.
Revision 1.12 2004/10/09 14:46:47 ponchio Revision 1.12 2004/10/09 14:46:47 ponchio
Windows porting small changes. Windows porting small changes.
@ -197,8 +200,15 @@ int main(int argc, char *argv[]) {
bool show_colors = true; bool show_colors = true;
bool show_normals = true; bool show_normals = true;
bool show_statistics = true; bool show_statistics = true;
NexusMt::MetricKind metric;
NexusMt::Mode mode = NexusMt::SMOOTH; NexusMt::Mode mode = NexusMt::SMOOTH;
NexusMt::PolicyKind policy = NexusMt::FRUSTUM; unsigned int ram_size = 640000;
nexus.SetError(error);
nexus.SetRamSize(ram_size);
nexus.SetMetric(NexusMt::FRUSTUM);
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
@ -230,18 +240,33 @@ int main(int argc, char *argv[]) {
case SDLK_9: nexus.patches.ram_size *= 0.8; break; case SDLK_9: nexus.patches.ram_size *= 0.8; break;
case SDLK_0: nexus.patches.ram_size *= 1.2; break; case SDLK_0: nexus.patches.ram_size *= 1.2; break;
case SDLK_s: policy = NexusMt::FRUSTUM; break; case SDLK_LEFT:
case SDLK_p: mode = NexusMt::POINTS; break; ram_size *= 0.7;
case SDLK_d: mode = NexusMt::DEBUG; break; nexus.SetRamSize(ram_size);
case SDLK_m: mode = NexusMt::SMOOTH; break; cerr << "Max extraction ram size: " << ram_size << endl; break;
case SDLK_RIGHT:
ram_size *= 1.5;
nexus.SetRamSize(ram_size);
cerr << "Max extraction ram size: " << ram_size << endl; break;
case SDLK_s: metric = NexusMt::FRUSTUM; break;
case SDLK_p: mode = NexusMt::POINTS; nexus.SetMode(mode); break;
case SDLK_d: mode = NexusMt::DEBUG; nexus.SetMode(mode); break;
case SDLK_m: mode = NexusMt::SMOOTH; nexus.SetMode(mode); break;
case SDLK_r: case SDLK_r:
case SDLK_SPACE: rotate = !rotate; break; case SDLK_SPACE: rotate = !rotate; break;
case SDLK_MINUS: error *= 0.9f; break; case SDLK_MINUS:
error *= 0.9f;
nexus.SetError(error);
cerr << "Error: " << error << endl; break;
case SDLK_EQUALS: case SDLK_EQUALS:
case SDLK_PLUS: error *= 1.1f; break; case SDLK_PLUS:
error *= 1.1f;
nexus.SetError(error);
cerr << "Error: " << error << endl; break;
} }
break; break;
case SDL_KEYUP: case SDL_KEYUP:
@ -319,8 +344,9 @@ int main(int argc, char *argv[]) {
float r = nexus.sphere.Radius(); float r = nexus.sphere.Radius();
glColor3f(0.8f, 0.8f, 0.8f); glColor3f(0.8f, 0.8f, 0.8f);
nexus.SetMode(mode);
nexus.SetPolicy(policy, error);
//nexus.SetPolicy(policy, error);
nexus.SetComponent(NexusMt::COLOR, show_colors); nexus.SetComponent(NexusMt::COLOR, show_colors);
nexus.SetComponent(NexusMt::NORMAL, show_normals); nexus.SetComponent(NexusMt::NORMAL, show_normals);
@ -328,16 +354,15 @@ int main(int argc, char *argv[]) {
nexus.Render(); nexus.Render();
//cerr Do some reporting:
if(show_statistics) { if(show_statistics) {
cerr << "Error: " << error << endl; cerr << "Ram used : " << nexus.policy.ram_used << endl;
cerr << "Ram used: " << nexus.patches.ram_used << endl; cerr << "Tri drawn: " << nexus.tri_rendered << endl;
cerr << "Ram size: " << nexus.patches.ram_size << endl; cerr << "Tri tot : " << nexus.tri_total << endl;
cerr << "Ram flushed: " << nexus.patches.ram_flushed << endl; cerr << "Ram flushed: " << nexus.patches.ram_flushed << endl;
cerr << "Ram readed: " << nexus.patches.ram_readed << endl; cerr << "Ram readed: " << nexus.patches.ram_readed << endl;
nexus.patches.ram_flushed = 0; nexus.patches.ram_flushed = 0;
nexus.patches.ram_readed = 0; nexus.patches.ram_readed = 0;
cerr << "Time for frame: " << watch.Elapsed() << endl;
} }
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();