From: Gabriel Dunne Date: Thu, 31 Dec 2009 02:46:55 +0000 (-0800) Subject: slower X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=26d8930dd8333ea80f2ecf880490efcc2030e9a3;p=stars.git slower --- diff --git a/intern/Global.cpp b/intern/Global.cpp index 5b7f8f9..7f3fa2d 100755 --- a/intern/Global.cpp +++ b/intern/Global.cpp @@ -1,3 +1,5 @@ + + #include "Global.h" #include "gl_et_al.h"; #include "jttoolkit.h"; @@ -5,115 +7,105 @@ Global *Global::instance; -Global::Global(){ - srand(982); +Global::Global() +{ + srand(982); - instance=this; + instance = this; - hideMouse(); + for(int i=0;i<20000;i++){ + rnd.push_back(randomFloat()); + } - // toggleFullScreen(); + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POINT_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); - // random number array - for(int i=0;i<20000;i++){ - rnd.push_back(randomFloat()); - } + for(int i=0;i<10000;i++){ + thingies.push_back(new Thingy()); + thingies.back()->z = ((rnd[i+7] - .5) * 100000000); + } - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POINT_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); - - for(int i=0;i<10000;i++){ - thingies.push_back(new Thingy()); - thingies.back()->z = ((rnd[i+7]-.5)*1000000); - } + hideMouse(); + + INC = 550; + + toggleFullScreen(); } - -Global::~Global(){ +Global::~Global() +{ } -void Global::loop(){ - vector::iterator it; - - - int cnt=0; - /* - for(it=thingies.begin();it!=thingies.end();it++){ - - (*it)->step(); - (*it)->draw(); - (*it)->x = rnd[cnt] * width(); - (*it)->y = rnd[cnt] * height(); - (*it)->z = 0; //(rnd[cnt]-.5)*1000; // ( ((rnd[cnt]-.5)*10) + ( (mouseX()-(width()/2)) * .085 ) ); - //(*it)->dest.z = (rnd[cnt]-.5)*1000; //( ((rnd[cnt]-.5)*10) + ( (mouseX()-(width()/2) ) * .085 ) ); - cnt++; -} -*/ - - for(int i=0; ix = rnd[i]*width(); - thingies[i]->y = rnd[i+3]*height(); - - - thingies[i]->z += ((mouseX()-(width()/2))*.04); - - thingies[i]->step(); - thingies[i]->draw(); - } - - - - glColor4f(1,1,1, 0.1); - glBegin(GL_LINE_STRIP); - for(it=thingies.begin();it!=thingies.end();it++){ - (*it)->glVertex(); - } - glEnd(); - - - - glColor4f(1,1,1, 1); - glBegin(GL_POINTS); - for(it=thingies.begin();it!=thingies.end();it++){ - (*it)->glVertex(); - } - glEnd(); - - - - +void Global::loop() +{ + vector::iterator it; + + INC += (704 - INC) * 0.001; + + int cnt = 0; + for(int i=0; ix = rnd[i] * width(); + thingies[i]->y = rnd[i+3] * height(); + + // position + thingies[i]->z += ((INC - (width() / 2 )) * .04); + + thingies[i]->step(); + thingies[i]->draw(); + } + + glColor4f(1, 1, 1, 0.1); + glBegin(GL_LINE_STRIP); + for(it = thingies.begin(); it != thingies.end(); it++) { + (*it)->glVertex(); + } + glEnd(); + + glColor4f(1, 1, 1, 1); + glBegin(GL_POINTS); + for(it = thingies.begin(); it!= thingies.end(); it++){ + (*it)->glVertex(); + } + glEnd(); } -void Global::keyDown(int k,int special){ - char s[256]; - sprintf(s, "god.%04i.png", ticks()); - cout << s << endl; - saveScreen(s); - +void Global::keyDown(int k, int special) +{ +// char s[256]; +// sprintf(s, "god.%04i.png", ticks()); +// cout << s << endl; +// saveScreen(s); } -void Global::mouseDown(){ - rnd.clear(); - for(int i=0;i<1000;i++){ - rnd.push_back(randomFloat()); - } - vector::iterator it; - - int cnt = 0; - for(it=thingies.begin();it!=thingies.end();it++){ - (*it)->resetRandoms(); - (*it)->z = ((rnd[cnt+7]-.5)*9000000); - cnt++; - } - +void Global::mouseDown() +{ + /* + rnd.clear(); + for(int i=0;i<1000;i++){ + rnd.push_back(randomFloat()); + } + vector::iterator it; + + int cnt = 0; + for(it=thingies.begin();it!=thingies.end();it++) + { + (*it)->resetRandoms(); + (*it)->z = ((rnd[cnt+7] - .5) * 9000000); + cnt++; + }*/ + cout << INC << endl; } -void Global::mouseUp(){ + + +void Global::mouseUp() +{ } + diff --git a/intern/Global.h b/intern/Global.h index 5d89516..4693edf 100755 --- a/intern/Global.h +++ b/intern/Global.h @@ -25,6 +25,9 @@ class Global{ static Global*instance; vectorthingies; vector rnd; + + float INC; + void loop(); void keyDown(int k,int special); void mouseDown(); diff --git a/intern/Thingy.cpp b/intern/Thingy.cpp index 225777a..c64d972 100644 --- a/intern/Thingy.cpp +++ b/intern/Thingy.cpp @@ -50,11 +50,11 @@ void Thingy::step(){ // (*this)+=JPoint( randomFloat()-0.5, randomFloat()-0.5, randomFloat()-0.5); - size += (destSize-size)*0.1; + size += (destSize - size) * 0.01; - float xx = (dest.x-x) * .02; - float yy = (dest.y-y) * .02; - float zz = (dest.z-z) * .02; + float xx = (dest.x-x) * .002; + float yy = (dest.y-y) * .002; + float zz = (dest.z-z) * .002; x += xx; y += yy;