This is the working branch from my desktop, that drives the cubes well with no bugs...
[SugarCubes.git] / AlexGreen.pde
old mode 100644 (file)
new mode 100755 (executable)
index 9e53975..f73c26d
@@ -1,4 +1,4 @@
-class SineSphere extends SCPattern {
+class SineSphere extends DPat {
   float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax));
   private final SinLFO rs = new SinLFO(0, 180, 5000);
   private final SinLFO noisey = new SinLFO(modelrad/8.0, modelrad/4.0, 2300);
@@ -52,34 +52,38 @@ final Sphery[] spherys;
     spherys[2] = new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/20, modelrad/10, 2000);
   }
 
-    public void run(int deltaMs) {
-    float rsv = rs.getValuef();
-    float noiseyv = noisey.getValuef();
-    float bandv = band.getValuef();
-     
-      spherys[1].run(deltaMs);
-      spherys[2].run(deltaMs);
+
+       float rsv, noiseyv, bandv;
+
+    public void StartRun(int deltaMs) {
+               rsv = rs.getValuef();
+               noiseyv = noisey.getValuef();
+               bandv = band.getValuef();
      
-       for (Point p: model.points) {
-       
+               spherys[1].run(deltaMs);
+               spherys[2].run(deltaMs);
+       }
+
+       
+       color CalcPoint(xyz Px) {
+
       color c = 0; 
       
-      c = blendColor(c, spherys[2].spheryvalue(p.fx, p.fy, p.fz, .75*model.xMax, model.yMax/2, model.zMax/2), ADD);
-      c = blendColor(c, spherys[1].spheryvalue(p.fx, p.fy, p.fz, model.xMax/4, model.yMax/4, model.zMax/2), ADD);
-      float distfromcenter = dist(p.fx, p.fy, p.fz, model.xMax/2, model.yMax/2, model.zMax/2);
+      c = blendColor(c, spherys[2].spheryvalue(Px.x, Px.y, Px.z, .75*model.xMax, model.yMax/2, model.zMax/2), ADD);
+      c = blendColor(c, spherys[1].spheryvalue(Px.x, Px.y, Px.z, model.xMax/4, model.yMax/4, model.zMax/2), ADD);
+      float distfromcenter = dist(Px.x, Px.y, Px.z, model.xMax/2, model.yMax/2, model.zMax/2);
       int distint = floor(distfromcenter);
       
       c = blendColor(c, color(
       
-      constrain( p.fx  , 0, 360), 
+      constrain( Px.x  , 0, 360), 
       constrain( distfromcenter, 20, 80), 
       max(0, 100 - 10*abs(distfromcenter - noiseyv ) )
       ),
       ADD);
       
-      colors[p.index]=c;
+        return c;
     }
 }
-}
+ }
+