From: Gabriel Dunne Date: Sat, 27 Apr 2013 02:56:47 +0000 (-0700) Subject: 20 Minute repeat loop for SOMArts Night Light 2013 X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=a0061dca3dea8123157a6cf0f3b8e3a6f81ef6be;p=stars.git 20 Minute repeat loop for SOMArts Night Light 2013 --- diff --git a/intern/Global.cpp b/intern/Global.cpp index f0026ee..85e6e09 100755 --- a/intern/Global.cpp +++ b/intern/Global.cpp @@ -1,5 +1,3 @@ - - #include "Global.h" #include "gl_et_al.h"; #include "jttoolkit.h"; @@ -8,9 +6,13 @@ Global *Global::instance; + Global::Global() { srand(982); + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POINT_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); //////////////////////////////////////////////// _PERFORM_ = false; @@ -18,25 +20,23 @@ Global::Global() instance = this; - for(int i=0;i<20000;i++){ + + for (int i = 0; i < 20000; i++ ){ rnd.push_back(randomFloat()); } - - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POINT_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - - for(int i=0; i < 10000; i++){ + for ( int i=0; i < 10000; i++){ thingies.push_back(new Thingy()); - thingies.back()->z = ((rnd[i+7] - .5) * 100000000); + thingies.back()->z = ((rnd[i+7] - .5) * 1000000000); } - movecount = 0; + + + toggleFullScreen(); hideMouse(); - if (!_PERFORM_) { - ifstream infile("media/move2.txt"); + if ( !_PERFORM_ ) { + ifstream infile("20-min_1440x1050.txt"); while( infile.good() ) { int p; infile >> p; @@ -61,16 +61,15 @@ void Global::loop() } else { rnd.clear(); - for(int i=0;i<1000;i++){ + for (int i = 0; i < 20000; 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) * 100000000); + (*it)->z = ((rnd[cnt+7] - .5) * 1000000000); cnt++; } movecount = 0; diff --git a/intern/Thingy.cpp b/intern/Thingy.cpp index 3c3f7d8..4e314a9 100644 --- a/intern/Thingy.cpp +++ b/intern/Thingy.cpp @@ -5,24 +5,24 @@ #define RAND_COUNT 10 Thingy::Thingy(){ - + for(int i=0;icopyFrom(dest); - - - - + + + + } void Thingy::resetRandoms(){ @@ -34,37 +34,37 @@ void Thingy::resetRandoms(){ void Thingy::reset(){ float xxx = (width()/2); - float yyy = (height()/2); - + float yyy = (height()/2); + x = xxx; //xxx * cos(randomFloat() * (2*PI)) * 2; - y = yyy; //yyy * sin(randomFloat() * (2*PI)) * 2; + y = yyy; //yyy * sin(randomFloat() * (2*PI)) * 2; z = (randomFloat() - 0.5) * 100; dest.copyFrom(*this); - + destSize = randomFloat()*10; } Thingy::~Thingy(){ - + } void Thingy::step(){ - - + + // (*this)+=JPoint( randomFloat()-0.5, randomFloat()-0.5, randomFloat()-0.5); - + size += (destSize - size) * 0.0002; - + float xx = (dest.x-x) * .0045 / 3.5; float yy = (dest.y-y) * .0045 / 3.5; float zz = (dest.z-z) * .0045 / 3.5; - + x += xx; y += yy; z += zz; - - + + } @@ -72,16 +72,16 @@ void Thingy::step(){ void Thingy::draw(){ glColor4f(rnd[3],rnd[4],rnd[5],1); - + float steps = 3; - + float inc = (PI*2) / steps; float rot = sin(ticks() * .01 * rnd[5]) * 3.2; glBegin(GL_LINE_LOOP); - + for(int i=0; i