X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=BenMorrow.pde;h=e610155120eced021237936582d2e4758d8c477e;hb=ae80d37a7fc19c8bce45067cdcf4e041808f9339;hp=bde4ddb0fa92609c9aa785a1ff4fc3cdaadccd89;hpb=a68abe8c9849804beaf4fd5ac2d346e7dc88f64d;p=SugarCubes.git diff --git a/BenMorrow.pde b/BenMorrow.pde index bde4ddb..e610155 100644 --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -1,35 +1,186 @@ class Sandbox extends SCPattern { - - LetsTry(GLucose glucose) { - super(glucose); - } int c=0; + int prevC=0; int huerange=255; - int cuberange = 74; - + int pointrange= model.points.size(); + int striprange= model.strips.size(); + int facerange= model.faces.size(); + int cuberange = model.cubes.size(); + int towerrange = model.towers.size(); int counter=0; + + Sandbox(GLucose glucose) { + super(glucose); + println("points "+pointrange); + println("strips "+striprange); + println("faces "+facerange); + println("cubes "+cuberange); + println("towers "+towerrange); + } + public void run(int deltaMs) { - Cube cube = model.cubes.get((int) c); - println("face length "+cube.faces.size()); - if(cube.faces.size()!=4) + + + if(counter % 10 ==0) { - for(Face f : cube.faces) + doDraw(c,0); + c = (c + 1) % towerrange; + long col = color(Math.round(Math.random()*255),255,255) ; + doDraw(c,col); + } + counter++; + + } + + public void doDraw(int c,long col) + { + Tower t= model.towers.get((int) c); + for(Point p : t.points) { - double col = Math.random()*255; - for(Point p: f.points) - { - colors[p.index] = color(Math.round(col),255,255); - } + colors[p.index] = (int) col; } - - + } +}; + +class GranimTestPattern extends GranimPattern +{ + GranimTestPattern(GLucose glucose) + { + super(glucose); + addGraphic("myReds",new RedsGraphic(100)); + int[] dots = {0,128,0,128,0,128,0,128,0,128,0,128}; + addGraphic("myOtherColors",new ColorDotsGraphic(dots)); + + getGraphicByName("myOtherColors").position=100; + } + int counter=0; + public void run(int deltaMs) + { + clearALL(); + super.run(deltaMs); + + if(counter % 3 ==0) + { + Graphic reds = getGraphicByName("myReds"); + Graphic others = getGraphicByName("myOtherColors"); + reds.position = reds.position + 1 % 19000; + others.position = others.position + 10 % 19000; } - if(counter% 3 ==0) + } + public void clearALL() + { + for(int i = 0; i < colors.length; i++) { - c = (c+1) % cuberange; + colors[i] = 0; } - counter++; - println(c); } + + +} + +class GranimTestPattern2 extends GranimPattern +{ + GranimTestPattern2(GLucose glucose) + { + super(glucose); + /*for(int i = 0;i < 100; i++) + { + Graphic g = addGraphic("myReds_"+i,new RedsGraphic(Math.round(Math.random() * 100))); + + }*/ + Graphic g = addGraphic("myRandoms",new RandomsGranim(50)); + g.position = 200; + + } + int counter=0; + float count=0; + public void run(int deltaMs) + { + clearALL(); + super.run(deltaMs); + Graphic randomsGraphic = getGraphicByName("myRandoms"); + randomsGraphic.position = Math.round(sin(count)*1000)+5000; + count+= 0.005; + } + public void clearALL() + { + for(Point p : model.points) + { + colors[p.index] = 0; + } + } + + +}; + +class DriveableCrossSections extends CrossSections +{ + BasicParameter xd; + BasicParameter yd; + BasicParameter zd; + BasicParameter mode; + + DriveableCrossSections(GLucose glucose) { + super(glucose); + } + + public void addParams() + { + mode = new BasicParameter("Mode", 0.0); + xd = new BasicParameter("XD", 0.0); + yd = new BasicParameter("YD", 0.0); + zd = new BasicParameter("ZD", 0.0); + addParameter(mode); + addParameter(xd); + addParameter(yd); + addParameter(zd); + + super.addParams(); + } + + public void onParameterChanged(LXParameter p) { + if(p == mode) + { + if(interactive()) + { + copyValuesToKnobs(); + }else{ + copyKnobsToValues(); + } + } + } + + void copyValuesToKnobs() + { + xd.setValue(x.getValue()/200); + yd.setValue(y.getValue()/115); + zd.setValue(z.getValue()/100); + } + + void copyKnobsToValues() + { + x.setValue(xd.getValue()*200); + y.setValue(yd.getValue()*115); + z.setValue(zd.getValue()*100); + } + + boolean interactive() + { + return Math.round(mode.getValuef())>0.5; + } + + public void updateXYZVals() + { + if(interactive()) + { + xv = xd.getValuef()*200; + yv = yd.getValuef()*115; + zv = zd.getValuef()*100; + }else{ + super.updateXYZVals(); + copyValuesToKnobs(); + } + } + } \ No newline at end of file