From: Ben Morrow Date: Mon, 19 Aug 2013 02:55:40 +0000 (-0700) Subject: Working Driving Cross Sections X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e1635ff6bd6229d0671b167307bc9f1e231cd2ad;p=SugarCubes.git Working Driving Cross Sections --- diff --git a/BenMorrow.pde b/BenMorrow.pde index 8b2b4f5..9294250 100644 --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -116,9 +116,10 @@ class GranimTestPattern2 extends GranimPattern class DriveableCrossSections extends CrossSections { - BasicParameter xd = new BasicParameter("XD", 1.0); - BasicParameter yd = new BasicParameter("YD", 1.0); - BasicParameter zd = new BasicParameter("ZD", 1.0); + BasicParameter xd; + BasicParameter yd; + BasicParameter zd; + BasicParameter mode; DriveableCrossSections(GLucose glucose) { super(glucose); @@ -126,6 +127,11 @@ class DriveableCrossSections extends CrossSections 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); @@ -140,13 +146,33 @@ class DriveableCrossSections extends CrossSections addParameter(zw); } + public void onParameterChanged(LXParameter p) { + if(p == mode) + { + if(interactive()) + { + xd.setValue(x.getValue()/200); + yd.setValue(y.getValue()/200); + zd.setValue(z.getValue()/100); + } + } + } + boolean interactive() + { + return Math.round(mode.getValuef())>0.5; + } public void updateXYZVals() { - xv = xd.getValuef(); - yv = yd.getValuef(); - zv = zd.getValuef(); + if(interactive()) + { + xv = xd.getValuef()*200; + yv = yd.getValuef()*200; + zv = zd.getValuef()*100; + }else{ + super.updateXYZVals(); + } } } \ No newline at end of file diff --git a/GranimPattern.pde b/GranimPattern.pde index 606c9e2..0a34baf 100644 --- a/GranimPattern.pde +++ b/GranimPattern.pde @@ -110,7 +110,7 @@ class GranimPattern extends SCPattern ((Granim) g).update(); } List drawList = model.points.subList(Math.min(g.position,colors.length-1), Math.min(g.position + g.width(),colors.length-1)); - println("drawlistsize "+drawList.size()); + //println("drawlistsize "+drawList.size()); gbuffer = g.graphicBuffer.toArray(new Integer[0]);