Change code to use new thread-safe lx color functions
[SugarCubes.git] / DanUtil.pde
index 4ce685ad68f0d63e56d08e1a366378f80700e63f..395ba44adef5b95bc9ad4cfb80b204f181dd402e 100644 (file)
@@ -67,10 +67,10 @@ public class DParam extends BasicParameter {
 //----------------------------------------------------------------------------------------------------------------------------------
 public class xyz {     float x,y,z;
                        xyz() {x=y=z=0;}
-                       xyz(Point p                                       ) {x=p.fx     ; y=p.fy; z=p.fz;}
+                       xyz(Point p                                       ) {x=p.x      ; y=p.y; z=p.z;}
                        xyz(xyz p                                         ) {set(p);                             }
                        xyz(float _x,float _y,float _z) {x=_x   ; y=_y  ; z=_z  ;}
-       void    set(Point p                                       ) {x=p.fx     ; y=p.fy; z=p.fz;}
+       void    set(Point p                                       ) {x=p.x      ; y=p.y; z=p.z;}
        void    set(xyz p                                         ) {x=p.x      ; y=p.y ; z=p.z ;}
        void    set(float _x,float _y,float _z) {x=_x   ; y=_y  ; z=_z  ;}
 
@@ -225,7 +225,7 @@ public class DPat extends SCPattern
 
        void            StartPattern()                                          {                                                               }
        void            StartRun(double deltaMs)                        {                                                               }
-       color           CalcPoint(xyz p)                                        { return color(0,0,0);                  }
+       color           CalcPoint(xyz p)                                        { return lx.hsb(0,0,0);                         }
        boolean         IsActive()                                                      { return this == DG.CurPat;                                                                                             }
        boolean         IsFocused()                                                     { return this == midiEngine.getFocusedDeck().getActivePattern();                }
        void            onInactive()                                            { UpdateState(); }
@@ -330,23 +330,23 @@ public class DPat extends SCPattern
                        if (pRsym.b)    { tP.set(mMax.x-P.x,mMax.y-P.y,mMax.z-P.z);             cNew = blendColor(cNew, CalcPoint(tP), ADD);    }
                        if (pXdup.b)    { tP.set((P.x+mMax.x*.5)%mMax.x,P.y,P.z);               cNew = blendColor(cNew, CalcPoint(tP), ADD);    }
 
-                       float                                                           s =     saturation(cNew) + 100*(fSaturate*2-1);
-                       float                                                           b = brightness(cNew)/100.;
+                       float                                                           s =     lx.s(cNew) + 100*(fSaturate*2-1);
+                       float                                                           b = lx.b(cNew)/100.;
                        if (pSharp.Val()>0)                             b = b < .5 ? pow(b,fSharp) : 1-pow(1-b,fSharp);
-                       if (DG._Trails()>0 && fQuant == 0)      b = max(b, (float) (brightness(cOld)/100. - (1-DG._Trails()) * deltaMs/200.));
-                       if (DG.bSustain == true)                        b = max(b, (float) (brightness(cOld)/100.));
+                       if (DG._Trails()>0 && fQuant == 0)      b = max(b, (float) (lx.b(cOld)/100. - (1-DG._Trails()) * deltaMs/200.));
+                       if (DG.bSustain == true)                        b = max(b, (float) (lx.b(cOld)/100.));
 
                        if (pInvert.b)  { b = 1-b; s = 1-s; }
 
-                       colors[p.index] = color(
-                               (hue(cNew) + zSpinHue) % 360,
+                       colors[p.index] = lx.hsb(
+                               (lx.h(cNew) + zSpinHue) % 360,
                                s,
                                100 *  b * DG._Level()
                        );
 
-//                     colors[p.index] = color(0,0, p.fx >= modmin.x && p.fy >= modmin.y && p.fz >= modmin.z &&
-//                             p.fx <= modmin.x+mMax.x && p.fy <= modmin.y+mMax.y && p.fz <= modmin.z+mMax.z ? 100 : 0); 
+//                     colors[p.index] = lx.hsb(0,0, p.x >= modmin.x && p.y >= modmin.y && p.z >= modmin.z &&
+//                             p.x <= modmin.x+mMax.x && p.y <= modmin.y+mMax.y && p.z <= modmin.z+mMax.z ? 100 : 0); 
                }
        }
 }
-//----------------------------------------------------------------------------------------------------------------------------------
\ No newline at end of file
+//----------------------------------------------------------------------------------------------------------------------------------