X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=UIImplementation.pde;h=0e46e576894b00c7fae89f64848431d6f83a130d;hb=e0b9d8726c661f54f47340449037ac7f6b410de6;hp=c3f08972df25f509a753d8738aab44c83f06257d;hpb=b5d6d7a0a56238e37d648489a1d95bb1dc351091;p=SugarCubes.git diff --git a/UIImplementation.pde b/UIImplementation.pde index c3f0897..0e46e57 100644 --- a/UIImplementation.pde +++ b/UIImplementation.pde @@ -83,17 +83,20 @@ FloatBuffer vertData; long simulationStart = System.nanoTime(); if (simulationOn) { + hint(DISABLE_DEPTH_TEST); drawSimulation(simulationColors); + hint(ENABLE_DEPTH_TEST); } simulationNanos = System.nanoTime() - simulationStart; camera(); strokeWeight(1); } + void drawSimulation(color[] simulationColors) { translate(0, 30, 0); fill(#141414); - //drawBox(0, -TRAILER_HEIGHT, 0, 0, 0, 0, TRAILER_WIDTH, TRAILER_HEIGHT, TRAILER_DEPTH, TRAILER_HEIGHT/2.); + drawBox(0, -TRAILER_HEIGHT, 0, 0, 0, 0, TRAILER_WIDTH, TRAILER_HEIGHT, TRAILER_DEPTH, TRAILER_HEIGHT/2.); fill(#070707); stroke(#222222); beginShape(); @@ -112,8 +115,10 @@ FloatBuffer vertData; popMatrix(); noStroke(); - for (Cube c : model.cubes) { - drawCube(c); + if (structureOn) { + for (Cube c : model.cubes) { + drawCube(c); + } } noFill(); @@ -136,7 +141,8 @@ FloatBuffer vertData; pgl.vertexAttribPointer(vertLoc, 3, PGL.FLOAT, false, 7 * SIZEOF_FLOAT, 0); pgl.vertexAttribPointer(colorLoc, 4, PGL.FLOAT, false, 7 * SIZEOF_FLOAT, 3 * SIZEOF_FLOAT); - + javax.media.opengl.GL2 gl2 = (javax.media.opengl.GL2) ((PJOGL)pgl).gl; + gl2.glPointSize(2f); pgl.drawArrays(PGL.POINTS, 0, nvert); pgl.disableVertexAttribArray(vertLoc); @@ -179,7 +185,7 @@ FloatBuffer allocateDirectFloatBuffer(int n) { float in = .15; noStroke(); fill(#393939); - //drawBox(c.x+in, c.y+in, c.z+in, c.rx, c.ry, c.rz, Cube.EDGE_WIDTH-in*2, Cube.EDGE_HEIGHT-in*2, Cube.EDGE_WIDTH-in*2, Cube.CHANNEL_WIDTH-in); + drawBox(c.x+in, c.y+in, c.z+in, c.rx, c.ry, c.rz, Cube.EDGE_WIDTH-in*2, Cube.EDGE_HEIGHT-in*2, Cube.EDGE_WIDTH-in*2, Cube.CHANNEL_WIDTH-in); } void drawBox(float x, float y, float z, float rx, float ry, float rz, float xd, float yd, float zd, float sw) { @@ -218,12 +224,12 @@ FloatBuffer allocateDirectFloatBuffer(int n) { class UIBlendMode extends UIWindow { public UIBlendMode(float x, float y, float w, float h) { super(lx.ui, "BLEND MODE", x, y, w, h); - List items = new ArrayList(); + List items = new ArrayList(); for (LXTransition t : transitions) { - items.add(new TransitionScrollItem(t)); + items.add(new TransitionItem(t)); } - final UIScrollList tList; - (tList = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 60)).setItems(items).addToContainer(this); + final UIItemList tList; + (tList = new UIItemList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 60)).setItems(items).addToContainer(this); lx.engine.getDeck(RIGHT_DECK).addListener(new LXDeck.AbstractListener() { public void faderTransitionDidChange(LXDeck deck, LXTransition transition) { @@ -232,11 +238,11 @@ class UIBlendMode extends UIWindow { }); } - class TransitionScrollItem extends UIScrollList.AbstractItem { + class TransitionItem extends UIItemList.AbstractItem { private final LXTransition transition; private final String label; - TransitionScrollItem(LXTransition transition) { + TransitionItem(LXTransition transition) { this.transition = transition; this.label = className(transition, "Transition"); } @@ -286,12 +292,12 @@ class UIEffects extends UIWindow { super(lx.ui, "FX", x, y, w, h); int yp = UIWindow.TITLE_LABEL_HEIGHT; - List items = new ArrayList(); + List items = new ArrayList(); int i = 0; for (LXEffect fx : effectsArr) { items.add(new FXScrollItem(fx, i++)); } - final UIScrollList effectsList = new UIScrollList(1, yp, w-2, 60).setItems(items); + final UIItemList effectsList = new UIItemList(1, yp, w-2, 60).setItems(items); effectsList.addToContainer(this); yp += effectsList.getHeight() + 10; @@ -323,7 +329,7 @@ class UIEffects extends UIWindow { } - class FXScrollItem extends UIScrollList.AbstractItem { + class FXScrollItem extends UIItemList.AbstractItem { private final LXEffect effect; private final int index; @@ -370,28 +376,28 @@ class UIEffects extends UIWindow { } class UIOutput extends UIWindow { - public UIOutput(GrizzlyOutput[] grizzlies, float x, float y, float w, float h) { + public UIOutput(IPOutput[] outputs, float x, float y, float w, float h) { super(lx.ui, "OUTPUT", x, y, w, h); float yp = UIWindow.TITLE_LABEL_HEIGHT; - final UIScrollList outputs = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 80); + final UIItemList itemList = new UIItemList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 80); - List items = new ArrayList(); - for (GrizzlyOutput grizzly : grizzlies) { - items.add(new GrizzlyScrollItem(grizzly)); - grizzly.enabled.addListener(new LXParameterListener() { + List items = new ArrayList(); + for (IPOutput output : outputs) { + items.add(new OutputItem(output)); + output.enabled.addListener(new LXParameterListener() { public void onParameterChanged(LXParameter parameter) { - outputs.redraw(); + itemList.redraw(); } }); } - outputs.setItems(items).addToContainer(this); + itemList.setItems(items).addToContainer(this); } - class GrizzlyScrollItem extends UIScrollList.AbstractItem { - final GrizzlyOutput output; + class OutputItem extends UIItemList.AbstractItem { + final IPOutput output; - GrizzlyScrollItem(GrizzlyOutput output) { + OutputItem(IPOutput output) { this.output = output; } @@ -457,7 +463,7 @@ class UIMapping extends UIWindow { private final MappingTool mappingTool; - private final UIIntegerBox channelBox; + private final UILabel cubeLabel; private final UIIntegerBox cubeBox; private final UIIntegerBox stripBox; @@ -472,18 +478,19 @@ class UIMapping extends UIWindow { else if (value == MAP_MODE_CHANNEL) mappingTool.mappingMode = mappingTool.MAPPING_MODE_CHANNEL; else if (value == MAP_MODE_CUBE) mappingTool.mappingMode = mappingTool.MAPPING_MODE_SINGLE_CUBE; } - }.setOptions(new String[] { MAP_MODE_ALL, MAP_MODE_CHANNEL, MAP_MODE_CUBE }).addToContainer(this); + }.setOptions(new String[] { MAP_MODE_ALL, MAP_MODE_CUBE }).addToContainer(this); yp += 24; - new UILabel(4, yp+8, w-10, 20).setLabel("CHANNEL ID").addToContainer(this); + new UILabel(4, yp+8, w-10, 20).setLabel("CUBE ID").addToContainer(this); yp += 24; - (channelBox = new UIIntegerBox(4, yp, w-10, 20) { - protected void onValueChange(int value) { - mappingTool.setChannel(value-1); - } - }).setRange(1, mappingTool.numChannels()).addToContainer(this); + (cubeLabel = new UILabel(4, yp, w-10, 20)) + .setAlignment(CENTER, CENTER) + .setLabel(model.cubes.get(0).id) + .setBackgroundColor(#222222) + .setBorderColor(#666666) + .addToContainer(this); yp += 24; - new UILabel(4, yp+8, w-10, 20).setLabel("CUBE ID").addToContainer(this); + new UILabel(4, yp+8, w-10, 20).setLabel("CUBE NUMBER").addToContainer(this); yp += 24; (cubeBox = new UIIntegerBox(4, yp, w-10, 20) { protected void onValueChange(int value) { @@ -494,7 +501,7 @@ class UIMapping extends UIWindow { yp += 10; - new UIScrollList(1, yp, w-2, 60).setItems(Arrays.asList(new UIScrollList.Item[] { + new UIItemList(1, yp, w-2, 60).setItems(Arrays.asList(new UIItemList.Item[] { new ColorScrollItem(ColorScrollItem.COLOR_RED), new ColorScrollItem(ColorScrollItem.COLOR_GREEN), new ColorScrollItem(ColorScrollItem.COLOR_BLUE), @@ -524,19 +531,16 @@ class UIMapping extends UIWindow { } - public void setChannelID(int value) { - channelBox.setValue(value); - } - public void setCubeID(int value) { cubeBox.setValue(value); + cubeLabel.setLabel(model.getCubeByRawIndex(value).id); } public void setStripID(int value) { stripBox.setValue(value); } - class ColorScrollItem extends UIScrollList.AbstractItem { + class ColorScrollItem extends UIItemList.AbstractItem { public static final int COLOR_RED = 1; public static final int COLOR_GREEN = 2; @@ -640,12 +644,12 @@ class UIMidi extends UIWindow { super(lx.ui, "MIDI", x, y, w, h); // Processing compiler doesn't seem to get that list of class objects also conform to interface - List scrollItems = new ArrayList(); + List scrollItems = new ArrayList(); for (SCMidiInput mc : midiEngine.getControllers()) { scrollItems.add(mc); } - final UIScrollList scrollList; - (scrollList = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 100)).setItems(scrollItems).addToContainer(this); + final UIItemList scrollList; + (scrollList = new UIItemList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 100)).setItems(scrollItems).addToContainer(this); (deckMode = new UIToggleSet(4, 130, 90, 20) { protected void onToggle(String value) { midiEngine.setFocusedDeck(value == "A" ? 0 : 1);