-
-
#include "Global.h"
#include "gl_et_al.h";
#include "jttoolkit.h";
Global *Global::instance;
+
Global::Global()
{
srand(982);
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_POINT_SMOOTH);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
////////////////////////////////////////////////
_PERFORM_ = false;
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;
}
else {
rnd.clear();
- for(int i=0;i<1000;i++){
+ for (int i = 0; i < 20000; i++ ){
rnd.push_back(randomFloat());
}
vector<Thingy*>::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;
#define RAND_COUNT 10
Thingy::Thingy(){
-
+
for(int i=0;i<RAND_COUNT;i++)rnd.push_back(randomFloat());
-
+
size = 0;
reset();
-
-
+
+
dest.x = width()/2;
dest.y = height()/2;
dest.z = 0;
-
+
this->copyFrom(dest);
-
-
-
-
+
+
+
+
}
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;
-
-
+
+
}
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<steps; i++) {
float xx = x + size * cos(inc*i) * rot;