From: greena1re Date: Thu, 27 Feb 2014 10:36:36 +0000 (-0800) Subject: Merge branch 'master' of https://github.com/sugarcubes/SugarCubes X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=f7d5c024df2b13297fb20785170f6dc446c6d4fd Merge branch 'master' of https://github.com/sugarcubes/SugarCubes --- f7d5c024df2b13297fb20785170f6dc446c6d4fd diff --cc AlexGreen.pde index 0c6dcc6,f049c29..54af5c0 --- a/AlexGreen.pde +++ b/AlexGreen.pde @@@ -616,112 -589,18 +616,123 @@@ float cfloor = c.y } } } + JGraphAdapterDemo graph1; + + + // class SpinningCube extends SCPattern{ + // LXProjection spin1, spin2, spin3; + // SawLFO + + //} + + + + +class PixelGraph implements EdgeFactory { + +dPixel p0; dPixel p1; dVertex v0; + +public dVertex createEdge(dPixel p0, dPixel p1) { + + return v0; + +} + + +} + + class GraphTest extends SCPattern { + JGraphAdapterDemo graph1; + +GraphTest( LX lx) {super(lx); JGraphAdapterDemo graph1 = new JGraphAdapterDemo();} + + void run(double deltaMs){ + } +} + +class SpinningCube extends SCPattern{ + + LXProjection spin1, spin2, spin3; + SawLFO spinx, spiny, spinz; + SinLFO spinx1, spiny1, spinz1, cubesize; + BasicParameter xoff = new BasicParameter("xoff", 10, 0, 100); + BasicParameter toff = new BasicParameter("toff", 10,0,1000); + BasicParameter huev = new BasicParameter("hue", 200, 0, 360); + BasicParameter density = new BasicParameter("density", 0, 0, 1); + BasicParameter Vsize = new BasicParameter("size", model.xMax/3,0, model.xMax); + VirtualCube V1, V2, V3; + PVector P = new PVector(); + float noisetime=0.; + class VirtualCube { + float x,y,z,d; + PVector center; + + VirtualCube(float x, float y, float z, float d) { + this.x=x; + this.y= y; + this.z=z; + this.d=d; + this.center=new PVector(x,y,z); + } + + color getcolor(LXVector q) { + if ( q.x > this.x + d/2 || q.x < this.x - d/2 || q.y > this.y + d/2 || q.y < this.y - d/2 || q.z > this.z + d/2 || q.z < this.z - d/2 ) + {return 0;} + else { + return lx.hsb(huev.getValuef()*noise(xoff.getValuef()*.001*noisetime ) , constrain(100*noise(xoff.getValuef()*.001*q.x*noisetime), 0, 100), max(100*(noise(xoff.getValuef()*.001*q.x*noisetime)-density.getValuef()), 0) ); + } + } + void setcenter(float x, float y, float z) {this.x=x; this.y = y; this.z=z; } + void setsize(float din){ this.d=din ; } + + } + +SpinningCube(LX lx) { + super(lx); + addParameter(xoff); + addParameter(toff); + addParameter(Vsize); + addParameter(huev); + addParameter(density); + //addModulator() + V1 = new VirtualCube(model.cx, model.cy, model.cz, model.xMax/2); + spinx= new SawLFO(0, TWO_PI, 8000); + spin1 = new LXProjection(model); + +} + + +void run(double deltaMs) { + + noisetime+= deltaMs*.0001*toff.getValuef(); + +spin1.reset() +.center() +//.scale () +.rotate(spinx.getValuef(),0, 1, 0) +.translate(model.cx, model.cy, model.cz); + +for (LXVector p: spin1) { + P.set(p.x, p.y, p.z); + + colors[p.index] = V1.getcolor(p); + +} + +V1.setsize(Vsize.getValuef()); + + +}; + + +} + + + + + + class HueTestHSB extends SCPattern{ BasicParameter HueT = new BasicParameter("Hue", .5); BasicParameter SatT = new BasicParameter("Sat", .5);