2 * If you are an artist, you may ignore this file! It just sets
3 * up the framework to run the patterns. Should not need modification
4 * for general animation work.
8 import glucose.control.*;
9 import glucose.pattern.*;
10 import glucose.transition.*;
11 import glucose.model.*;
12 import heronarts.lx.*;
13 import heronarts.lx.effect.*;
14 import heronarts.lx.pattern.*;
15 import heronarts.lx.modulator.*;
16 import heronarts.lx.transition.*;
18 import ddf.minim.analysis.*;
19 import processing.opengl.*;
20 import java.lang.reflect.*;
22 final int VIEWPORT_WIDTH = 900;
23 final int VIEWPORT_HEIGHT = 700;
24 final int TARGET_FRAMERATE = 45;
26 int startMillis, lastMillis;
30 LXTransition[] transitions;
33 int activeTransitionIndex = 0;
36 startMillis = lastMillis = millis();
38 // Initialize the Processing graphics environment
39 size(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, OPENGL);
40 frameRate(TARGET_FRAMERATE);
41 // hint(ENABLE_OPENGL_4X_SMOOTH); // no discernable improvement?
42 logTime("Created viewport");
44 // Create the GLucose engine to run the cubes
45 glucose = new GLucose(this);
47 logTime("Built GLucose engine");
50 glucose.lx.setPatterns(patterns = patterns(glucose));
51 logTime("Built patterns");
52 glucose.lx.addEffects(effects = effects(glucose));
53 logTime("Built effects");
54 transitions = transitions(glucose);
55 logTime("Built transitions");
59 logTime("Built overlay UI");
62 MidiKnobController.initializeStandardDevices(glucose);
63 logTime("Setup MIDI controllers");
65 println("Total setup: " + (millis() - startMillis) + "ms");
68 void logTime(String evt) {
70 println(evt + ": " + (now - lastMillis) + "ms");
75 // The glucose engine deals with the core simulation here, we don't need
76 // to do anything specific. This method just needs to exist.