public void bang() { sketch.send("reset"); sweep.update(); sweep.draw(); for (SeqNode n : nodes) { n.update(mousecoord, sweep.getRad()); n.draw(); } }
/* instantiate mxj with render context as argument */ public FigurePaisley(String rc) { context = rc; // render context declareIO(2, 2); // declare 2 inlets, 1 outlet of DataTypes.ALL // assist message for inlets and outlets (mouse hover) setInletAssist(new String[] {"bang to compute and draw", "input settings"}); setOutletAssist( new String[] {"outputs jit.gl.texture object", "connect to thispatcher for gui updating"}); // instantiate Jitter sketch object sketch = new JitterObject("jit.gl.sketch"); sketch.setAttr("drawto", context); sketch.setAttr("depth_enable", sketchDepthEnable); sketch.setAttr("blend_enable", sketchBlendEnable); sketch.setAttr("blend_mode", new Atom[] {Atom.newAtom(6), Atom.newAtom(7)}); sketch.setAttr("antialias", sketchAntialias); sketch.setAttr( "glclearcolor", new Atom[] {Atom.newAtom(0.), Atom.newAtom(1.), Atom.newAtom(0.), Atom.newAtom(1.)}); sketch.setAttr("fsaa", sketchFsaa); sketch.send("automatic", 0); /* * set to not-automatic, to be able to use * begin_capture and drawimmediate for * capturing jit.gl.sketch as texture */ // instantiate Jitter texture object texture = new JitterObject("jit.gl.texture"); texture.setAttr("drawto", context); texture.setAttr("dim", new Atom[] {Atom.newAtom(texture_width), Atom.newAtom(texture_height)}); masterPattern = new float[eNumMax][bNum][3]; // even though we only use xy, keep xyz for consistency patternNoise = new float[pNumMax][eNumMax][bNum][3]; mPatternNoise = new float[pNumMax][eNumMax][bNum][3]; masterWidth = new float[eNumMax]; mMasterWidth = new float[eNumMax]; widthNoise = new float[pNumMax][eNumMax]; mWidthNoise = new float[pNumMax][eNumMax]; ePoints = new int[eNumMax]; eAnchor = new int[eNumMax]; activated = new boolean[pNumMax]; displayed = new boolean[pNumMax]; patternColor = new float[pNumMax][3]; for (int e = 0; e < eNumMax; e++) { masterWidth[e] = 0.05f; mMasterWidth[e] = 0.05f; ePoints[e] = bNum; eAnchor[e] = 0; for (int b = 0; b < bNum; b++) {} } for (int p = 0; p < pNumMax; p++) { for (int e = 0; e < eNumMax; e++) { for (int b = 0; b < bNum; b++) { mPatternNoise[p][e][b] = new float[] {0.f, 0.f, 0.f}; } mWidthNoise[p][e] = 0.f; } activated[p] = false; displayed[p] = true; for (int c = 0; c < 3; c++) patternColor[p][c] = 1.f; } for (int i = 0; i < 5; i++) activate(theActive[i], 1); createMasterPaisley(); randomize(0.1f, 0.f); display(displayMode); }