SphereCamera sCam; NoiseCamera nCam; RedRibbon rRibbon; int camChooser = 0; int scene = 5; boolean axis = false; boolean legend = true; void setup() { size(640, 320, P3D); noStroke(); // Cameras sCam = new SphereCamera(); nCam = new NoiseCamera(); // Ribbons rRibbon = new RedRibbon(); rRibbon.noiseStep = random(2000,400000); // Text overlay PFont fontA = loadFont("Courier-48.vlw"); textFont(fontA, 13); } void draw() { lights(); background(255); rRibbon.calculateRibbon(); switch(camChooser) { case 0: nCam.drawCamera(20, rRibbon.posHistoryX[rRibbon.lastHistoryPos]*rRibbon.blobSize, rRibbon.posHistoryY[rRibbon.lastHistoryPos]*rRibbon.blobSize, rRibbon.posHistoryZ[rRibbon.lastHistoryPos]*rRibbon.blobSize ); break; case 1: sCam.drawCamera(16); break; } noStroke(); fill(255,0,0); rRibbon.renderRibbon(); if (axis) sCam.axis(); if (legend) { camera(); // Reset to front for text overlay text("n : Noise Camera", 17, 20); text("s : Sphere Camera + New Position", 17, 34); text("a : Axis on/off", 17, 48); text("h : Text on/off", 17, 62); } } void keyPressed() { if (key == 's' || key == 'S') { camChooser = 1; sCamPosition(); } if (key == 'n' || key == 'N') { camChooser = 0; } if (key == 'a' || key == 'A') { if (axis) { axis = false; } else { axis = true; } } if (key == 'h' || key == 'H') { if (legend) { legend = false; } else { legend = true; } } } void mousePressed() { randomCam(); sCamPosition(); } void sCamPosition() { sCam.camAzimuthTarget = random(-85,85); sCam.camZenithTarget = random(0,360); sCam.camSphereRadiusTarget = random(400)+500; sCam.camTargTarget = random(1,10); } void randomCam() { camChooser = round(random(0,1)); }