]> git.quilime.com - stars.git/commitdiff
slower
authorGabriel Dunne <gdunne@quilime.com>
Thu, 31 Dec 2009 02:46:55 +0000 (18:46 -0800)
committerGabriel Dunne <gdunne@quilime.com>
Thu, 31 Dec 2009 02:46:55 +0000 (18:46 -0800)
intern/Global.cpp
intern/Global.h
intern/Thingy.cpp

index 5b7f8f937a69e7f0f82451051eb01a7bd77f5936..7f3fa2de3a3b8e4fbb74dee46369b55a1a39da31 100755 (executable)
@@ -1,3 +1,5 @@
+
+
 #include "Global.h"
 #include "gl_et_al.h";
 #include "jttoolkit.h";
 
 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<Thingy*>::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; i<thingies.size(); i++){
-       
-               thingies[i]->x = 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<Thingy*>::iterator it;
+    
+    INC += (704 - INC) * 0.001; 
+    
+    int cnt = 0;
+    for(int i=0; i<thingies.size(); i++)
+    {
+        thingies[i]->x = 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<Thingy*>::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<Thingy*>::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()
+{
 }
 
+
index 5d89516039390f1f3be988885413de6e46e9ba8a..4693edf01cb3f1ca353eed02251559aaeaf379e0 100755 (executable)
@@ -25,6 +25,9 @@ class Global{
   static Global*instance;
   vector<Thingy*>thingies;
   vector<float> rnd;
+  
+  float INC;
+  
   void loop();
   void keyDown(int k,int special);
   void mouseDown();
index 225777adde1bf4c97778630286f6076b1821c7f4..c64d97229402c9f432b9a1d95b78fba16a667049 100644 (file)
@@ -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;