X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=DanUtil.pde;h=37dc95602bde719d0feb50af636474b39d38bb36;hb=e530876366cf4c07a5e77b7e8890dff376cbcd3c;hp=6f4b0008485891d1a75ddbb05170d6c4e99cbc64;hpb=7697e5c66da5c072999806ab87791c287c2c4811;p=SugarCubes.git diff --git a/DanUtil.pde b/DanUtil.pde index 6f4b000..37dc956 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -118,7 +118,7 @@ public class DGlobals { float Sliders[] = new float [] {1,0,0,0,0,0,0,0}; - String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "Quant", "??", "??"}; + String SliderText[] = new String[] {"Level", "??", "Spark", "Xwave", "Ywave", "??", "??", "??", "??"}; void SetNoteOn (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOn (col, row, clr); } void SetNoteOff (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOff (col, row, clr); } @@ -129,12 +129,9 @@ public class DGlobals { DParam GetParam(int i) { return (DParam) CurPat.params.get(i); } float _Level () { return Sliders[0]; } - float _SpinHue () { return Sliders[1]; } float _Spark () { return Sliders[2]; } float _XWave () { return Sliders[3]; } float _YWave () { return Sliders[4]; } - float _Trails () { return Sliders[5]; } - float _Quantize () { return Sliders[6]; } void Init () { if (bInit) return; bInit=true; @@ -159,7 +156,7 @@ public class DGlobals { String Text1="", Text2=""; for (int i=0; i 0) { - float tRamp = (lx.tempo.rampf() % (1./pow(2,floor((1-fQuant) * 4)))); - float f = LastQuant; LastQuant = tRamp; if (tRamp > f) return; - } - if (pJog.b) { float tRamp = (lx.tempo.rampf() % .25); if (tRamp < LastJog) xyzJog.set(randctr(mMax.x*.2), randctr(mMax.y*.2), randctr(mMax.z*.2)); @@ -313,7 +300,7 @@ public class DPat extends SCPattern if (xWv > 0) for (int i=0; i0) b = b < .5 ? pow(b,fSharp) : 1-pow(1-b,fSharp); - 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] = lx.hsb( - (lx.h(cNew) + zSpinHue) % 360, - s, - 100 * b * DG._Level() - ); - -// 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); + colors[p.index] = lx.hsb(lx.h(cNew), s, 100 * b * DG._Level()); } } } //---------------------------------------------------------------------------------------------------------------------------------- class dTurn { dVertex v; - int pos0, pos1; + int pos0, pos1; dTurn(int _pos0, dVertex _v, int _pos1) { v = _v; pos0 = _pos0; pos1 = _pos1; } } class dVertex { - dVertex c0, c1, opp, same; + dVertex c0, c1, // connections on the cube + opp, same; // opp - same strip, opp direction + // same - same strut, diff strip, dir dTurn t0, t1; dStrip s; - int dir, ci; + int dir, ci; // dir -- 1 or -1. + // ci -- color index dVertex(dStrip _s, Point _p) { s = _s; ci = _p.index; } Point getPoint(int i) { return s.s.points.get(dir>0 ? i : 15-i); } @@ -378,23 +357,23 @@ class dStrip { //---------------------------------------------------------------------------------------------------------------------------------- float PointDist(Point p1, Point p2) { return dist(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z); } -class dPixel { dVertex v; int pos; dPixel(dVertex _v, int _pos) { v=_v; pos=_pos; }} +class dPixel { dVertex v; int pos; dPixel(dVertex _v, int _pos) { v=_v; pos=_pos; } } class dLattice { private int iTowerStrips=0; dStrip[] DS = new dStrip[glucose.model.strips.size()]; - int[][] DQ = new int[NumBackTowers][MaxCubeHeight*2]; - dStrip GetStrip (int row, int col, int off) { - return (!btwn(off,0,15) || !btwn(row,0,MaxCubeHeight*2-1) || !btwn(col,0,NumBackTowers-1) || DQ[col][row]<0) ? null : - DS[DQ[col][row]+off]; - } + //int[][] DQ = new int[NumBackTowers][MaxCubeHeight*2]; + //dStrip GetStrip (int row, int col, int off) { + // return (!btwn(off,0,15) || !btwn(row,0,MaxCubeHeight*2-1) || !btwn(col,0,NumBackTowers-1) || DQ[col][row]<0) ? null : + // DS[DQ[col][row]+off]; + //} void addTurn(dVertex v0, int pos0, dVertex v1, int pos1) { dTurn t = new dTurn(pos0, v1, pos1); if (v0.t0 == null) v0.t0=t; else v0.t1=t; } float Dist2 (Strip s1, int pos1, Strip s2, int pos2) { return PointDist(s1.points.get(pos1), s2.points.get(pos2)); } - boolean SameSame (Strip s1, Strip s2) { return max(Dist2(s1, 0, s2, 0), Dist2(s1,15, s2,15)) < 5 ; } - boolean SameOpp (Strip s1, Strip s2) { return max(Dist2(s1, 0, s2,15), Dist2(s1,15, s2,0 )) < 5 ; } - boolean SameBar (Strip s1, Strip s2) { return SameSame(s1,s2) || SameOpp(s1,s2); } float PD2 (Point p1, float x, float y, float z) { return dist(p1.x,p1.y,p1.z,x,y,z); } + boolean SameSame (Strip s1, Strip s2) { return max(Dist2(s1, 0, s2, 0), Dist2(s1,15, s2,15)) < 5 ; } // same strut, same direction + boolean SameOpp (Strip s1, Strip s2) { return max(Dist2(s1, 0, s2,15), Dist2(s1,15, s2,0 )) < 5 ; } // same strut, opp direction + boolean SameBar (Strip s1, Strip s2) { return SameSame(s1,s2) || SameOpp(s1,s2); } // 2 strips on same strut void AddJoint (dVertex v1, dVertex v2) { // should probably replace parallel but further with the new one if (v1.c0 != null && SameBar(v2.s.s, v1.c0.s.s)) return; @@ -419,7 +398,7 @@ class dLattice { dLattice() { lattice=this; - for (int i=0;i