//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); //BASE w = ofGetWindowWidth(); h = ofGetWindowHeight(); //GUI gui.setup("panel"); // most of the time you don't need a name gui.add(backLabel.setup("background","BACKGROUND",200,40)); gui.add(backR.setup("R", 100, 0, 255)); gui.add(backG.setup("G", 100, 0, 255)); gui.add(backB.setup("B", 100, 0, 255)); gui.add(barsLabel.setup("bars","BARS",200,40)); gui.add(barsInt.setup("number of bars", 4, 1, 20)); gui.add(barRot.setup("rotation", 0, 0, 360)); gui.add(barWidthVar.setup("width variation", 0, 0, 100)); gui.add(bariR.setup("color 1: R", 0, 0, 255)); gui.add(bariG.setup("color 1: G", 140, 0, 255)); gui.add(bariB.setup("color 1: B", 140, 0, 255)); gui.add(barjR.setup("color 2: R", 255, 0, 255)); gui.add(barjG.setup("color 2: G", 25, 0, 255)); gui.add(barjB.setup("color 2: B", 45, 0, 255)); gui.add(effectsLabel.setup("effects", "EFFECTS",200,40)); gui.add(chromaShift.setup("Chroma shift", 0, 0, 800)); gui.add(fishRad.setup("Fisheye radius", 0, 0, PI)); gui.add(wobbleLabel.setup("wobble", "Wobble",200,20)); gui.add(wobbleFreqx.setup("Frequency: x", 1, 0, PI)); gui.add(wobbleFreqy.setup("Frequency: y", 1, 0, PI)); gui.add(wobbleAmpx.setup("Amplitude: x", 0, 0, 100)); gui.add(wobbleAmpy.setup("Amplitude: y", 0, 0, 100)); gui.add(wobbleRad.setup("Radius", 1, 0, PI)); gui.add(glitchLabel.setup("glitch", "Glitch",200,20)); gui.add(glitchRes.setup("Scanlines resolution", 2, 0, 20)); gui.add(glitchDist.setup("Distance", 0, 0, PI)); gui.add(glitchHs.setup("Horizontal shift", 0, 0, 1)); gui.add(glitchVs.setup("Vertical shift", 0, 0, 1)); gui.add(glitchBars.setup("Color variance", 0, 0, 2)); bHide = true; //SHADER tex1.setTextureWrap(GL_CLAMP, GL_CLAMP); tex1.allocate(w,h,GL_RGB,GL_RGBA); tex2.setTextureWrap(GL_CLAMP, GL_CLAMP); tex2.allocate(w,h,GL_RGB,GL_RGBA); tex3.setTextureWrap(GL_CLAMP, GL_CLAMP); tex3.allocate(w,h,GL_RGB,GL_RGBA); tex4.setTextureWrap(GL_CLAMP, GL_CLAMP); tex4.allocate(w,h,GL_RGB,GL_RGBA); cout<<"Load CHROMA"<<endl; chromaShader.load("shaders/ChromaAb_GLSL"); cout<<"Load WOBBLE"<<endl; wobbleShader.load("shaders/Wobble_GLSL"); cout<<"Load FISHEYE"<<endl; fishShader.load("shaders/Fisheye_GLSL"); cout<<"Load FISHEYE"<<endl; glitchShader.load("shaders/Glitch_GLSL"); }
void sphereSystem::setup(){ int frameRate = 60; ofBackground(255,255,255); ofSetCircleResolution(100); ofSetFrameRate(frameRate); ofDisableAlphaBlending(); oscTargetSlot = 1; ofSetVerticalSync(true); setupSpiroLib(); for(int i=0; i<nEpi; i++){ epi[i].setup(); epi[i].setSlot(i); } //GLfloat distance[] = {0.0, 0.0, 1.0}; //glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance); oscR.setup( OSC_PORT_RECEIVE ); cout << "listening for osc messages on port " << OSC_PORT_RECEIVE << "\n"; oscRd.setup( OSC_PORT_RECEIVE_D ); cout << "listening from on port " << OSC_PORT_RECEIVE_D << "\n"; bGlobalMute = false; bZoom = false; touchX = touchY = pTouchX = pTouchY = 0; bgColor.r = 0; bgColor.g = 0; bgColor.b = 0; // timeline timeline.setup(); timeline.setDurationInFrames(60*60*3 * frameRate/60); timeline.setLoopType(OF_LOOP_NONE); timeline.getColors().loadColors("defaultColors.xml"); timeline.setMovePlayheadOnDrag(true); // load XML file for timeline // // param name structure // // epi1/amp1, epi1/freq1, epi1_mute // epi1/amp2, epi1/freq2 // epi1/amp3, epi1/freq3 // epi1/amp4, epi1/freq4 int n = nEpi; for(int i=0; i<n; i++){ timeline.addTriggers(ofToString(i), "triggers/" + ofToString(i) + ".xml"); //timeline.addKeyframes("amp"+ofToString(i), "amps/" + ofToString(i) + ".xml", ofRange(0, 1.0f)); /* // KEYFRAMES for(int j=1; j<2; j++){ string nodeNum = ofToString(j); string ampFile = epi + "/amp"+nodeNum; string freqFile = epi + "/freq"+nodeNum; timeline.addKeyframes(ampFile, ampFile+".xml", ofRange(0, 1)); timeline.addKeyframes(freqFile, freqFile+".xml", ofRange(0, 1)); } */ } ofAddListener(ofxTLEvents.trigger, this, &sphereSystem::receiveTrigger); ofAddListener(ofEvents.update, this, &sphereSystem::manualUpdate); ofAddListener(ofEvents.draw, this, &sphereSystem::manualDraw); stream.stop(); stream.listDevices(); stream.setDeviceID(7); stream.setup(this, 2, 0, sampleRate, 256, 4); stream.start(); // ofSoundStreamSetup(2, 0, this, sampleRate, 256, 4); }
//#define TEST_COUNTER //-------------------------------------------------------------- void testApp::setup(){ #ifdef TEST_COUNTER ofSetLogLevel(OF_LOG_SILENT); cout << "Start test Count 10000" << endl; cout << "--------------------------------------------------------------" << endl; for(int i = 0 ; i < 10000 ; i++) { stateMachine.getSharedData().load(); cout << "Count = "<< stateMachine.getSharedData().counter <<endl; stateMachine.getSharedData().counter+=1; stateMachine.getSharedData().save(); } cout << "End test Count 10000" << endl; cout << "--------------------------------------------------------------" << endl; std::exit(0); #endif ofEnableSmoothing(); ofEnableAlphaBlending(); ofSetVerticalSync(true); glDisable(GL_DEPTH_TEST); ofxXmlSettings xml = stateMachine.getSharedData().xml; if(xml.loadFile(settingFileName)) { if(xml.pushTag("DATA")) { stateMachine.getSharedData().bDebug = xml.getValue("DEBUG", true); float width = xml.getValue("WIDTH", 1280); float height = xml.getValue("HEIGHT", 720); sndPlayer.loadSound(xml.getValue("SOUND_PATH", "sounds/Zone 5 - Door Creak, scream and witchly laugh.wav")); sndPlayer.setLoop(true); sndPlayer.play(); stateMachine.getSharedData(). wRatio = width/1920; stateMachine.getSharedData(). hRatio = height/1080; ofSetFullscreen(xml.getValue("FULLSCREEN", 0)); ofSetWindowShape(width, height); stateMachine.getSharedData().path_to_save = xml.getValue("CAPTURE_PATH", "./captures"); stateMachine.getSharedData().filesXml.loadFile(stateMachine.getSharedData().path_to_save+"/files.xml"); if(!stateMachine.getSharedData().filesXml.pushTag("XML")) { stateMachine.getSharedData().filesXml.addTag("XML"); stateMachine.getSharedData().filesXml.pushTag("XML"); } stateMachine.getSharedData().numDigi = xml.getValue("DIGI", 5); stateMachine.getSharedData().font.loadFont(xml.getValue("FONT_PATH", "fonts/LunacyMore.ttf"),xml.getValue("FONT_SIZE", 128)); ofDirectory dir; if(dir.listDir(stateMachine.getSharedData().path_to_save)<1) { dir.createDirectory(stateMachine.getSharedData().path_to_save); } xml.popTag(); } } else { ofLog(OF_LOG_ERROR,"Faile to load "+ settingFileName); } // // setup shared data ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 100)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); stateMachine.getSharedData().panel.setup(ofGetWidth(),ofGetHeight()); stateMachine.getSharedData().panel.loadFont("MONACO.TTF", 8); stateMachine.getSharedData().panel.addPanel("General", 4,false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking", 5, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking0", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking1", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(70, 70, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceMapEdit", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 100)); //some dummy vars we will update to show the variable lister object appFrameRate = ofGetFrameRate(); stateMachine.getSharedData().panel.setWhichPanel("General"); stateMachine.getSharedData().panel.setWhichColumn(0); stateMachine.getSharedData().panel.addChartPlotter("some chart", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 50, 200, 5, 80); vector<string> loglevel; loglevel.push_back("OF_LOG_VERBOSE"); loglevel.push_back("OF_LOG_NOTICE"); loglevel.push_back("OF_LOG_WARNING"); loglevel.push_back("OF_LOG_ERROR"); loglevel.push_back("OF_LOG_FATAL_ERROR"); loglevel.push_back("OF_LOG_SILENT"); stateMachine.getSharedData().panel.addTextDropDown("LogLevel","LogLevel", 0, loglevel); // initialise state machine stateMachine.addState(new IndexState()); stateMachine.addState(new SelectPlayerState()); stateMachine.addState(new CaptureState()); stateMachine.addState(new EditState()); stateMachine.addState(new EndState()); stateMachine.addState(new LicenseState()); stateMachine.changeState(xml.getValue("DATA:INIT_STATE", "IndexState")); stateMachine.getSharedData().panel.loadSettings("settings.xml"); stateMachine.getSharedData().panel.hide(); // if(!stateMachine.getSharedData().bDebug) // { //// stateMachine.getSharedData().panel.unregisterKeyboardEvent(); // } stateMachine.getSharedData().numPlayer = 1; for(int i = 0 ; i < NUM_SEQ ;i++) { image[i].loadSequence("images/bat/bat_", "png", 0, 154, 5); image[i].setFrameRate(60); } int num = 3000; stateMachine.getSharedData().p.assign(num, Particle()); resetParticles(); }
void testApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0, 0, 0); }
//-------------------------------------------------------------- void ofApp::setup(){ // ofSetVerticalSync(true); ofBackground(255); // Setup floor floor.set(floorLimits*10, floorLimits*10); floor.setPosition(ofVec3f(0,0,0)); floor.setOrientation(ofVec3f(90,0,0)); // Setup Human myHuman.setup(); myHuman.setScale(humanScale); // Setup da World daWorld.set(floorLimits*4,10,OF_PRIMITIVE_TRIANGLE_STRIP); daWorld.setPosition(ofVec3f(0,0,0)); // Light ofSetSmoothLighting(true); pointLight.setDiffuseColor( ofFloatColor(1,1,1) ); pointLight.setSpecularColor( ofFloatColor(1,1,1) ); pointLight.setPosition(floorLimits,0,floorLimits); pointLight2.setDiffuseColor( ofFloatColor(1,1,1) ); pointLight2.setSpecularColor( ofFloatColor(1,1,1) ); pointLight2.setPosition(-floorLimits,0,floorLimits); pointLight3.setDiffuseColor( ofFloatColor(1,1,1) ); pointLight3.setSpecularColor( ofFloatColor(1,1,1) ); pointLight3.setPosition(floorLimits,0,-floorLimits); // Simple pick variables nearestDistance = 0; nearestIndex = 0; // Objective movement currentStep = 0; actorDirection = 1; //ofBackground(255,255,255); //some model / light stuff //ofEnableDepthTest(); //glShadeModel (GL_SMOOTH); // Link bzpoints... //for(int i=0; i<kBezierPoints; i++) { //if(i>0) bzNodes[i].setParent(bzNodes[i-1]); //} cam.setPosition(floorLimits,floorLimits,floorLimits); // Setup camObjective //camObjective.setPosition(ofVec3f(floorLimits,floorLimits,floorLimits)); //Random initial control points for(int i=0; i<kBezierPoints; i++) { bzNodes[i].setPosition(ofVec3f(ofRandom(-floorLimits,floorLimits*0.7),0,ofRandom(-floorLimits,floorLimits*0.7))); ctrlpoints[i][0]=bzNodes[i].getX(); ctrlpoints[i][1]=bzNodes[i].getY(); ctrlpoints[i][2]=bzNodes[i].getZ(); bzPoints[i].set(3,10); } // Translation with opengl //glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]); //glEnable(GL_MAP1_VERTEX_3); }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); systemManager.loadPresets(); systemManager.loadCachedDataForSystems(); currentSystem = NULL; currentSystemIndex = 0; lastSystemChangedTime = 0; bForward = true; blackList.clear(); blackList.push_back(make_pair("Memory", "ThinBlueRows_2")); //crash in loadingPresetGUI blackList.push_back(make_pair("Memory", "ThinBlueRows_wide")); //crash in loadingPresetGUI blackList.push_back(make_pair("Memory", "ThinTealRows")); //crash in loadingPresetGUI blackList.push_back(make_pair("Memory", "randomWaves")); //crash in loadingPresetGUI /* blackList.push_back(make_pair("Histogram", "Waveform1")); //not registered blackList.push_back(make_pair("Histogram", "Waveform1_Happen")); //not registered blackList.push_back(make_pair("Histogram", "Waveform3_GTNonStop")); //not registered blackList.push_back(make_pair("Histogram", "Waveform3")); //not registered blackList.push_back(make_pair("Histogram", "DataHistogram4")); //not registered blackList.push_back(make_pair("Histogram", "DataHistogram3")); //not registered blackList.push_back(make_pair("Histogram", "Waveform1_Happen")); //not registered */ blackList.push_back(make_pair("Rulez", "Ico_rotate")); //running and registered but showing nothing blackList.push_back(make_pair("RandomDigits", "BasicOC"));//not registered blackList.push_back(make_pair("OpenP5DrawingMachine10", "chaos")); //not registered blackList.push_back(make_pair("WebHistory", "AutoSpiderShell")); //not registered blackList.push_back(make_pair("WebHistory", "Hazy_widesuccess")); //not registered //blackList.push_back(make_pair("Orbit", "Lorenz_Dolly")); //crash during run blackList.push_back(make_pair("Xstatic", "StarChurn")); //something wrong with preset blackList.push_back(make_pair("Cosmic", "JM_biological2")); //running and registered but showing nothing, or causing problems, also weird preset //blackList.push_back(make_pair("Schlabberbox", "jm_whirl")); //maybe crashed during run? it followed the mysterious Mandala blackList.push_back(make_pair("Xstatic", "fireflies")); //something wrong with preset blackList.push_back(make_pair("CubeCraft", "MC_FlyoverDesert")); //looks bad in preset //cubeCraft MC_FlyoverDesert looks like shit //cubeCraft has a bgColor state leak //cubecraft fog tweaks //xstatic fireflies all particles drawing in the same place on top of eachother, state leak! //xstatic star churn is all in a line? //voro dream crystal1 check alpha blending?? //cosmic JM_biological2 , preset has some problems and is suseptibable to depth_test state leak //connectors susseptible to line width state leak //prior to 128 was a lineWidth return to 0? //egg astrolabe far clipping plane in oculus needs extension //OpenP5Machine is the slowest general system, needs optimization //line width state leak victims = ocean, world, twitter, connections, //check OpenP5Hackpact for line state leak? openP5Spaghetti? presetIndices = systemManager.getFilteredPresetIndeces(false,true); for(int i = 0; i < presetIndices.size(); i++){ cout << systemManager.getPresets()[ presetIndices[i] ].systemName << " " << systemManager.getPresets()[ presetIndices[i] ].presetName << endl; } shuffleSystemIndices(); advanceSystem(); }
//-------------------------------------------------------------- void ofApp::setup(){ ofToggleFullscreen(); ofSetFrameRate(60); ofBackground(0); ofSetVerticalSync(true); cameraPositionNo = 4;//0; cameraSpeed = 0.2; cameraV = ofVec3f(0.0, 0.0, 0.0); cameraPositions.push_back(ofVec3f(300, 100, -300)); cameraPositions.push_back(ofVec3f(300, 100, 300)); cameraPositions.push_back(ofVec3f(-300, 100, 300)); cameraPositions.push_back(ofVec3f(-300, 100, -300)); cameraPositions.push_back(ofVec3f(1.0, 500, 1.0)); cameraPosition = cameraPositions[cameraPositionNo]; camera.setPosition(cameraPosition); camera.lookAt(ofVec3f(0,0,0)); numLeaves = 5000; externalForce = ofVec3f(10.0, 0.0, 0.0); windFrameNum = 0; leaf.load("img/leaf1.png"); leaf.resize(20, 19); leafImages.push_back(leaf); leaf.load("img/leaf2.png"); leaf.resize(20, 19); leafImages.push_back(leaf); leaf.load("img/leaf3.png"); leaf.resize(20, 19); leafImages.push_back(leaf); for(int i=0;i<numLeaves;i++){ int leafType = ofRandom((int)leafImages.size()); Leaf l(&leafImages[leafType], &externalForce); leaves.push_back(l); } origamiLogo.setup("svg/OrigamiLogoOutlined.svg", 300); gui.setup(); gui.add(svgPos.setup("svg pos", ofVec3f(0.0, -460, 650), ofVec3f(-1000, -1000, -1000), ofVec3f(1000, 1000, 1000))); gui.add(cameraRoll.setup("cameraRoll", ofVec3f(-90, 0.0, 0.0), ofVec3f(0.0, 0.0, 0.0), ofVec3f(360, 360, 360.0))); cameraV += (cameraPositions[cameraPositionNo] - cameraPosition)*cameraSpeed; cameraPosition += cameraV; cameraV *= 0.1; camera.setPosition(cameraPosition); camera.lookAt(ofVec3f(0.0, 0.0, 0.0)); // cameraRoll = camera.getOrientationEuler(); for(int i=0;i<origamiLogo.points.size();i++){ logoImageNo.push_back(ofRandom(leafImages.size())); } ofHideCursor(); }
//-------------------------------------------------------------- void testApp::setup() { ofSetLogLevel(OF_LOG_VERBOSE); // enable depth->video image calibration kinect.setRegistration(true); kinect.init(); //kinect.init(true); // shows infrared instead of RGB video image //kinect.init(false, false); // disable video image (faster fps) kinect.open(); // opens first available kinect //kinect.open(1); // open a kinect by id, starting with 0 (sorted by serial # lexicographically)) //kinect.open("A00362A08602047A"); // open a kinect using it's unique serial # // print the intrinsic IR sensor values if(kinect.isConnected()) { ofLogNotice() << "sensor-emitter dist: " << kinect.getSensorEmitterDistance() << "cm"; ofLogNotice() << "sensor-camera dist: " << kinect.getSensorCameraDistance() << "cm"; ofLogNotice() << "zero plane pixel size: " << kinect.getZeroPlanePixelSize() << "mm"; ofLogNotice() << "zero plane dist: " << kinect.getZeroPlaneDistance() << "mm"; } #ifdef USE_TWO_KINECTS kinect2.init(); kinect2.open(); #endif colorImg.allocate(kinect.width, kinect.height); grayImage.allocate(kinect.width, kinect.height); grayThreshNear.allocate(kinect.width, kinect.height); grayThreshFar.allocate(kinect.width, kinect.height); nearThreshold = 230; farThreshold = 70; bThreshWithOpenCV = true; ofSetFrameRate(60); // zero the tilt on startup angle = 0; kinect.setCameraTiltAngle(angle); // start from the front bDrawPointCloud = false; /**************** DRONE SETUP ****************/ ofSetVerticalSync(true); ofSetFrameRate(60); ofSetLogLevel(OF_LOG_VERBOSE); // clear all keys memset(keys, 0, sizeof(*keys)); // setup viewport camera easyCam.orbit(10, -20, 100); easyCam.setDistance(300); doPause = false; // connect to the drone (yes, it's that easy) drone.connect(); // setup command history lengths for debugging and dumping onscreen (OPTIONAL) drone.controller.commandHistory.setMaxLength(30); drone.dataReceiver.commandHistory.setMaxLength(30); // setup the simulator so we have a display in the viewport (OPTIONAL) droneSimulator.setup(&drone); /**************** DRONE SETUP ****************/ }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofEnableSmoothing(); ofBackground(0); float dim = 16; float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; float length = 320-xInit; drawPadding = false; gui = new ofxUICanvas(0,0,length+xInit, ofGetHeight()); gui->addWidgetDown(new ofxUILabel("MORE WIDGETS", OFX_UI_FONT_LARGE)); gui->addWidgetRight(new ofxUIFPS(OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUISpacer(length-xInit, 2)); gui->addWidgetDown(new ofxUILabel("MOVING GRAPH", OFX_UI_FONT_MEDIUM)); int bufferSize = 256; vector<float> buffer; for(int i = 0; i < bufferSize; i++) { buffer.push_back(100.0*sin(TWO_PI*(i/(float)bufferSize))); } mg = (ofxUIMovingGraph *) gui->addWidgetDown(new ofxUIMovingGraph(length-xInit, 64, buffer, bufferSize, -100, 100, "MOVING GRAPH")); gui->addWidgetDown(new ofxUISpacer(length-xInit, 2)); gui->addWidgetDown(new ofxUILabel("MINIMAL SLIDER", OFX_UI_FONT_LARGE)); ofxUISlider *mslider = (ofxUISlider*) gui->addWidgetDown(new ofxUIMinimalSlider(length-xInit, -100, 100, 0, "MINIMAL", OFX_UI_FONT_MEDIUM)); mslider->setLabelPrecision(0); gui->addWidgetDown(new ofxUISlider(length-xInit, 24, 0, 100, 50.0, "NORMAL")); gui->addWidgetDown(new ofxUIRangeSlider(length-xInit, 24, 0, 100, 25.0, 50.0, "RANGE")); gui->addWidgetDown(new ofxUITextInput(length-xInit, "TEXT INPUT FIELD", "INPUT FIELD", OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUIBiLabelSlider(length-xInit, 0, 100, 50.0, "LEFT", "CALM MODE", "CRAZY MODE", OFX_UI_FONT_MEDIUM)); gui->addWidgetDown(new ofxUISpacer(length-xInit, 2)); gui->addWidgetDown(new ofxUILabel("ENHANCED 2D PADS", OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUI2DPad(length-xInit, 128, ofPoint(-100,100), ofPoint(100,-100), ofPoint(0,0), "2D PAD RANGE")); gui->addWidgetDown(new ofxUISpacer(length-xInit, 2)); mgX = (ofxUIMovingGraph *) gui->addWidgetDown(new ofxUIMovingGraph(length-xInit, 64, buffer, bufferSize, -100, 100, "X GRAPH")); mgY = (ofxUIMovingGraph *) gui->addWidgetDown(new ofxUIMovingGraph(length-xInit, 64, buffer, bufferSize, -100, 100, "Y GRAPH")); gui->addWidgetDown(new ofxUISpacer(length-xInit, 2)); vector<string> toggles; toggles.push_back("FIRST"); toggles.push_back("SECOND"); toggles.push_back("THIRD"); toggles.push_back("FOURTH"); toggles.push_back("FIFTH"); gui->addWidgetDown(new ofxUINumberDialer(-1000.0, 1000.0, 0.0, 2, "NUMBER", OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUILabelButton(length-xInit, false, "LABEL BTN", OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUILabelToggle(length-xInit, false, "LABEL TGL", OFX_UI_FONT_LARGE)); gui->addWidgetDown(new ofxUIToggleMatrix(32, 32, 1, 2, "MTX")); ofAddListener(gui->newGUIEvent,this,&testApp::guiEvent); gui->setDrawBack(false); gui->setDrawPadding(false); // gui->loadSettings("GUI/guiSettings.xml"); }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); myRectangle.pos.x=10; myRectangle.pos.y=ofGetHeight()/2; }
//-------------------------------------------------------------- void testApp::setup(){ ofEnableAlphaBlending(); ofSetVerticalSync(true); ofSetFrameRate(60); int camWidth = 320*2; int camHeight = 240*2; int camFps = 15; #ifdef TARGET_RASPBERRY_PI // Setup WiringPi // if(wiringPiSetup() == -1){ printf("Error on wiringPi setup\n"); } pinMode(0,INPUT); pinMode(3,INPUT); #endif #ifdef USE_GST //optimized pipeline for the PS3Eye // cam.allocate(camWidth,camHeight,8); stringstream pipeline; pipeline << "v4l2src name=video_source device=/dev/video0 ! video/x-raw-yuv, ";// video/x-raw-rgb,"; pipeline << "width=" << camWidth << ","; pipeline << "height=" << camHeight << ","; pipeline << "framerate=" << camFps << "/1 ! ffmpegcolorspace "; bool didStart = cam.setPipeline(pipeline.str(), 8, false, camWidth, camHeight); if(didStart){ ofLogVerbose() << "set pipeline SUCCESS"; } else { ofLogError() << "set pipeline FAIL, pipeline: " << pipeline.str(); } cam.play(); #else cam.setDesiredFrameRate(camFps); cam.initGrabber(camWidth,camHeight,false); #endif cam.update(); actual.allocate(camWidth, camHeight, OF_IMAGE_GRAYSCALE); // Load Shader // #ifdef TARGET_RASPBERRY_PI shader.load("","oldFilmGL2.fs"); cout << "oldFilmGL2.fs loaded" << endl; #else shader.load("", "oldFilm.fs"); cout << "oldFilm.fs loaded" << endl; #endif // Light Sensor // analogIn.setup(); bPlayMode = false; bFrameRecorded = false; // listen on the given port receiver.setup(PORT); nState = nPreState = 0; nFrame = 0; nFrameMax = 0; firstFrame = 0; width = 960; height = 720; bDebug = false; bNotUsed = true; analogIn.value = 0; }
void testApp::setup(){ //openFrameworks各種初期設定 ofSetFrameRate(30); ofSetVerticalSync(true); ofSetCircleResolution(128); setlocale( LC_ALL, "ja_JP.UTF-8" ); ofSetBackgroundAuto(false); ofEnableAlphaBlending(); ofHideCursor(); //フォントの読み込み font_mid.loadFont("やさしさゴシック.ttf", 84); //32 //twitter 用 font_title.loadFont("やさしさゴシック.ttf", 108); //kinectのセットアップ kinect.setRegistration(true); kinect.init(); kinect.open(); angle = 0; kinect.setCameraTiltAngle(angle); kinectShow = true; //kinectを使ったピクセルごとの距離のイニシャライズ for (int x=0; x < ofGetWidth(); x++) { for (int y=0; y < ofGetHeight(); y++) { kinectVJ.setup(kinect.getDistanceAt(x,y)); //cout << ofToString(kinect.getDistanceAt(x,y)) << endl; } } //各論理値と数値のイニシャライズ kinectShow = true; stringShow = FALSE; _distance = 1500; step = 6; //サウンドインプットのセットアップ ofSoundStreamSetup(0, 1, this, 44100, testApp_buffer_size, 4); //Jpeg圧縮の強度 quality = OF_IMAGE_QUALITY_LOW; reset(); //リセット glitch_on = false; //モーションレック関連の変数の初期化 color_sec = 0; kinectShow = true; fade_str_num = 0; alpha_timer_2 = 0; fadeX = ofRandom(200, 440); fadeY = ofRandom(ofGetHeight() / 2, ofGetHeight()); //tweetのtxtファイルからの読み込み path_to_txt = "/Users/Yuki/work/of_preRelease_v007_osx/apps/myapp/ofxHuez/bin/data/search_result.txt"; strline.clear(); bNumReset(); setlocale( LC_ALL, "ja_JP.UTF-8" ); FILE * fp; if((fp=fopen(path_to_txt,"r"))==NULL){ cout << "no" << endl; }else{ char buff[256]=""; while(fgets(buff,256,fp)!=NULL){ strline.push_back(stringConvertToW(buff)); } fclose(fp); } //サーチワード関連の変数の初期化 wSearch = L"searching for " + strline[0]; ofRectangle searchRect = font_title.getStringBoundingBox(wSearch, 0,0); searchX = searchRect.width; searchY = ofGetHeight() / 2 + searchRect.height / 2; showSearch = false; }
//-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); ofEnableDepthTest(); myFbo_00.allocate(1920, 1200, GL_RGBA); myFbo_01.allocate(1920, 1200, GL_RGBA); myFbo_02.allocate(1920, 1200, GL_RGBA); myGlitch_00.setup(&myFbo_00); myGlitch_01.setup(&myFbo_01); myGlitch_02.setup(&myFbo_02); myFbo_00.begin(); ofClear(255, 255, 255, 0); myFbo_00.end(); myFbo_01.begin(); ofClear(255, 255, 255, 0); myFbo_01.end(); myFbo_02.begin(); ofClear(255, 255, 255, 0); myFbo_02.end(); // nodes testNodes[0].setOrientation(ofVec3f(30,0,40)); testNodes[1].setOrientation(ofVec3f(30,0,40)); testNodes[2].setOrientation(current); // cameras cam[0].setPosition(40, 40, 800); cam[1].setPosition(0, 100, 100); // lookatIndex[1] = kNumTestNodes-1; // lights light.enable(); light.setSpotlight(); light.setPosition(0, 80, 150); light.lookAt(testNodes[0]); light.setAmbientColor(ofColor(r, g, b, 255)); light.setDiffuseColor(ofColor(r, g, b)); light.setSpecularColor(ofColor(255, 255, 255)); pathLines.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); // ***** sounds ***** //FFTのサイズとバッファサイズを設定 fft_size = 512; buffer_size = fft_size * 2; //FFTサイズにあわせて出力結果の配列を左右2ch分準備 input = new float[buffer_size]; magnitude = new float[fft_size]; phase = new float[fft_size]; power = new float[fft_size]; // right = new float[buffer_size]; // magnitudeR = new float[fft_size]; // phaseR = new float[fft_size]; // powerR = new float[fft_size]; //オーディオストリームの設定 ofSoundStreamSetup(0, 2, this, 44100, buffer_size, 4); }
void ofApp::setup() { ofEnableAlphaBlending(); oscReceiver.setup(OSCRECEIVEPORT); oscSenderOne.setup(OSCCLIENTONE, OSCSENDPORT); ofSetLogLevel(OF_LOG_NOTICE); ofSetFrameRate(TARGET_FRAMERATE); ofSetVerticalSync(true); glEnable(GL_LINES); ofSetWindowTitle("Gloria 2016"); fadeManager = make_shared<ofxParameterFader>(); ofAddListener(globalParams.parameterChangedE(), this, &ofApp::paramsChanged); directory.setup(); //register for our directory's callbacks ofAddListener(directory.events.serverAnnounced, this, &ofApp::serverAnnounced); ofAddListener(directory.events.serverUpdated, this, &ofApp::serverUpdated); ofAddListener(directory.events.serverRetired, this, &ofApp::serverRetired); dirIdx = -1; syphonIn = new ofxSyphonClient(); syphonIn->setup(); settings.loadFile("appSettings.xml"); dirIdx = settings.getValue("syphonInputSelected", -1); mapping = new Mapping(); mapping->load("mapping.xml", "input1.svg"); mapping->loadFixtures("fixtures.xml", "LedInput.svg"); for(auto s : scenes) { s->outputManager = &outputManager; s->mapping = mapping; s->syphonIn = syphonIn; s->setupScene(); } /*globalParameters.add(drawMapping.set("Draw mapping", true)); mainGui.setup(globalParameters); mainGui.setName("Gloria"); */ for(int i=0; i<scenes.size(); i++) { // layout scene gui panels horizontally int x = settings.getValue(scenes[i]->name+"_panel_pos_x", 0); int y = settings.getValue(scenes[i]->name+"_panel_pos_y", 1); scenes[i]->panel.setPosition(x,y); } // Syphon merger (bluemac hack) syphonMerger.setName("BlueMac"); syphonMergerFbo.allocate(OUTWIDTH, OUTHEIGHT); }
//-------------------------------------------------------------- void testApp::setup(){ // Box 2D stuff box.init(); box.setGravity(0, 5); box.setFPS(30.0); ofRectangle bounds(-ofGetWidth()/2,-ofGetHeight(), ofGetWidth()*2, ofGetHeight()*2); box.createBounds(bounds); box.enableGrabbing(); box.registerGrabbing(); // Boilerplate OF stuff ofSetFrameRate(60); ofSetVerticalSync(true); ofEnableAlphaBlending(); ofBackground(ofRandom(255),ofRandom(255),ofRandom(255)); // State & Level variables state_screen = 0; state_win = false; levels_total = 7; levels_current = 0; // Title screen title_back.limit = 2000; title_word1.limit = 200; title_word2.limit = 50; word1 = ofColor(255); word2 = ofColor(255); back = ofColor(ofRandom(255),ofRandom(255),ofRandom(255)); title_bk.loadImage("boids_titlescreen_bk.png"); title_hungry.loadImage("boids_titlescreen_hungry.png"); title_boids.loadImage("boids_titlescreen_boids.png"); title_start.loadImage("boids_titlescreen_start.png"); //Win & Lose Screens win_start.loadImage("boids_win.png"); lose_start.loadImage("boids_lose.png"); win_word.loadImage("boids_win_word.png"); lose_word.loadImage("boids_lose_word.png"); // Sounds all.loadSound("boids_notrill.wav"); all.setLoop(true); //Sound will loop all.setMultiPlay(true); trill.loadSound("boids_trill.wav"); trill.setLoop(true); //Sound will loop trill.setMultiPlay(true); noise.loadSound("boids_noise.wav"); noise.setLoop(true); //Sound will loop noise.setMultiPlay(true); noise.play(); // Baits title_bait.setPhysics(9.0, 0.01, 0.001); title_bait.setup(box.getWorld(), 0, 0, 10); title_bait.drop(ofVec2f(200,0)); copter.bait.setPhysics(9.0, 0.01, 0.001); copter.bait.setup(box.getWorld(), 0, 0, 10); // Flockers title_flocker.addParticle( box.getWorld(), 100 ); flocker.addParticle( box.getWorld(), 100 ); // Levels level1.bricks_num=3; level1.createCondition(2); levels.push_back(level1); level2.bricks_num=5; level2.createCondition(2); level2.createCondition(2); levels.push_back(level2); level3.bricks_num=5; level3.createCondition(3); levels.push_back(level3); level4.bricks_num=7; level4.createCondition(3); level4.createCondition(2); levels.push_back(level4); level5.bricks_num=7; level5.createCondition(3); level5.createCondition(3); levels.push_back(level5); level6.bricks_num=10; level6.createCondition(3); level6.createCondition(3); level6.createCondition(3); levels.push_back(level6); level7.bricks_num=12; level7.createCondition(4); level7.createCondition(3); level7.createCondition(2); levels.push_back(level7); // Example images box2.loadImage("2.png"); box3.loadImage("3.png"); box4.loadImage("4.png"); }
//-------------------------------------------------------------- void testApp::setup(){ //ofBackground(250,250,250); ofSetVerticalSync(true); // glEnable(GL_DEPTH_TEST); //lights look weird if depth test is not enabled //but this also prevents nice transperency centerX = ofGetWidth()/2; centerY = ofGetHeight()/2; centerZ = 0; boxIndexI = 7; boxIndexJ = 0; bSmoothLight = true; cheatmode=-1; ontop=-1; headOffsetX = 0; //reflexions!! ofxMaterialSpecular(120, 120, 120); //how much specular light will be reflect by the surface ofxMaterialShininess(50); //how concentrated the reflexion will be (between 0 and 128 //each light will emit white reflexions light1.specular(100, 100, 100); //light2.specular(255, 255, 255); //light3.specular(255, 255, 255); camera.setOrigin(OF_ORIGIN); //camera.setOrigin(OF_ORIGIN_ZERO); camera.position(centerX, 10000, -20000); //initialize the camera int boxSpacingX = -200; int boxSpacingZ= 200; //building my array of boxes //initialize categories string categories[] = {"National Defense", "International Affairs", "General Science, Space, and Technology", "Energy", "Natural Resources and Environment", "Agriculture", "Commerce and Housing Credit", "Transportation", "Community and Regional Development", "Education, Training, Employment, and Social Services", "Health", "Medicare", "Income Security", "Social Security", "Veterans Benefits and Services", "Administration of Justice", "General Government", "Net Interest"}; int dollars[] = {556488456,597122311,575270243,551711701,538241380,526785955,505938202,462483382,458595477,424152174,387438540,381148724,369932212,367316350,362582981,382495877,384958746,412108602,564700281,438787095,540410317,566259918,601684213,658173822,705146615,709208242,722138000, 51516082,53593996,33130760,35934175,31664623,30334079,31374027,36318036,32963937,48746115,26033214,36658876,22774274,19796224,19683901,49567819,28671451,24824647,36674272,30433296,37554220,52101416,35382181,71913405,48522607,64415541,67388000, 18501050,18537957,18447467,24036055,19985829,22741654,24402755,26416602,26894021,25973748,25866486,23858817,23196766,22607176,24010239,24627501,24373646,25842898,27163770,26639437,27271221,26973608,27067715,27588539,27977217,35610687,31023000, 16477140,17592628,11941335,6502804,9855244,7141662,8217546,8622749,9473655,12470228,6952803,7192700,3669011,2302834,395978,1281373,1,144057,1433609,483626,649427,3671975,325569,679380,4275985,43501021,8810000, 25762762,27018739,23304108,27967025,28331081,29847871,30255290,30777283,33074314,32635225,33240246,29946929,29871865,31154156,32573285,31949261,31670038,35727447,36856265,37709506,37659693,37928353,41173212,35487656,37634138,58334403,39520000, 24551581,55501049,59300484,48570455,33714130,37023847,24074518,27398520,34594091,28676965,24911971,12060328,13195931,15363098,16831782,31324935,42456338,35566152,32641408,28554548,29196987,37780597,27715609,23961319,17672113,24531897,25419000, 27924943,24758246,22141091,21377835,42515629,109775337,105089237,139834588,73972998,16265679,40217823,12058897,11204381,10946275,19160834,18775590,19537665,15191275,15884704,13623954,17594986,16316683,15468347,10552487,221023464,459077620,1, 61511310,59903454,57416574,51819950,51871039,51599055,51619559,50272990,57396202,61006673,63923803,56230976,50883902,55800598,60650336,67517519,70121085,82930230,85117763,83451570,81451026,82027842,81869428,82747741,82531982,127045263,93669000, 18677033,16539865,13696041,12759717,16276295,13858619,16378745,12413303,19101124,15316304,22939619,18593423,17425023,18429468,14212435,14774406,14257215,17884039,94340203,27903653,19789767,20935222,33638599,18552564,42041785,24148713,19884000, 64967147,64039200,58764575,61781649,63105771,65414112,65891219,70683153,71574375,75210868,71601284,74439510,66260394,72841572,75820612,72629924,62652478,78196038,111627254,96824621,103875241,106218321,136070837,98474460,92511982,170303365,91920000, 66380706,68091210,72879358,79308610,84102199,90886845,101605055,120694338,143831385,163884449,171372598,167357980,152675334,176853605,180720264,186084487,204468654,223690241,281078985,249728058,274527763,290203792,319258428,256848013,288911565,379744335,386437000, 121379483,132899084,141661638,144163678,145259587,150169239,176651099,165235350,207640388,188262607,239356235,223979568,249676204,258133470,259081296,249501350,254003582,267301441,338762780,284149149,296208929,313585075,395195132,404902549,411759545,444154795,462087000, 247817495,266549009,240704370,235095732,236757030,235897915,245418672,289772516,316049323,328747596,325025777,313441191,314765017,315303541,315789234,318894465,316271106,336756772,389709504,375638125,390699467,385976435,379752744,387043037,431621304,620586052,664559000, 375234183,391478666,391232283,400010360,407610005,410616491,418162654,434275986,449994256,462275182,472510515,476871588,489383539,497317126,508972134,511892349,521754063,542209603,593604704,559903324,564778075,572609976,597301461,619395481,627590453,701115643,723504000, 55580686,55214435,53470271,52150276,54120693,52515036,50884315,53186351,52961689,54594633,54415855,54558355,53831619,54216465,57192209,57720705,57515119,58500817,77264174,63077455,69959238,69776765,76764148,83663748,89440200,98538215,125002000, 13022782,13987346,13820446,17193565,17732876,17990077,20982809,21394948,23346343,23267290,23587108,27298493,29775970,32952948,35355840,36729216,34726874,39289480,45301608,44915414,46934183,52724763,46151941,48556797,49730861,57531445,53462000, 26021268,24840361,25135159,16403978,18744130,18425814,21587280,21712029,20362171,19882762,17622806,18722196,15867083,16974402,21247751,21857954,16493492,19829429,18833428,21726813,29873672,27463050,21266949,19583204,21807321,30715691,29010000, 233170684,262394497,270639444,266056108,279803363,297412740,308376313,310619057,309879148,299881856,298594686,332160526,335011287,331480443,322565023,300719642,282321737,253841316,205410315,207204108,181496067,184899713,245099919,249391651,255960552,189969742,187775000 }; for (int i=0; i < 18; i++) //categories 0-17 { for (int j=0; j< 27; j++) //years 1984-2010 { // height = (int) ofRandom(10, 1000); height = dollars[i * 27 + j] / 1000000 * multiplier; myBoxes[i][j].height = height; myBoxes[i][j].location= ofxVec3f(i*boxSpacingX, -height/2, boxSpacingZ*j); myBoxes[i][j].category = categories[i]; myBoxes[i][j].year = j + 1984; ofColor c; c.r=ofRandom(10, 250); c.g=ofRandom(10, 250); c.b=ofRandom(10, 250); //c.a=ofRandom(100, 250); c.a=50; myBoxes[i][j].color= c; } } groundSize= 8000; g1.x= -groundSize; g1.y=0; g1.z= -groundSize; g2.x= -groundSize; g2.y=0; g2.z= groundSize; g3.x= groundSize; g3.y=0; g3.z= groundSize; g4.x= groundSize; g4.y=0; g4.z= -groundSize; s1.x= -groundSize*2; s1.y=0; s1.z= groundSize; s2.x= groundSize*2; s2.y=0; s2.z= groundSize; s3.x= groundSize*2; s3.y=-groundSize*2; s3.z= groundSize; s4.x= -groundSize*2; s4.y=-groundSize*2; s4.z= groundSize; youPos.y= 0; // Kinect setup #ifdef KINECT miniWidth = 640; miniHeight = 480; context.setup(); context.setupUsingXMLFile(); depth.setup(&context); rgb.setup(&context); user.setup(&context, &depth, &rgb); depth.toggleRegisterViewport(&rgb); context.toggleMirror(); handHistoryDepth = 10; // store the last 10 hand positions, newest first playDelay = 60; // frames between cues lastPlay = 0; jump = false; debug = false; pressed = false; released = true; #endif /* boxImage.loadImage("squirrel.jpg"); boxTextureData = new unsigned char [100*100*3]; boxTextureData = boxImage.getPixels(); boxTexture.loadData(boxTextureData, 100, 100, GL_RGB); //add A for transparent */ verdana.loadFont("verdana.ttf",8, false, true); verdana.setLineHeight(20.0f); } //end setup
//-------------------------------------------------------------- void testApp::setup(){ sender.setup(HOST, PORT); /* some standard setup stuff*/ ofEnableAlphaBlending(); ofSetupScreen(); ofBackground(0, 0, 0); ofSetFrameRate(60); /* This is stuff you always need.*/ sampleRate = 44100; /* Sampling Rate */ initialBufferSize = 512; /* Buffer Size. you have to fill this buffer with sound*/ lAudioOut = new float[initialBufferSize];/* outputs */ rAudioOut = new float[initialBufferSize]; lAudioIn = new float[initialBufferSize];/* inputs */ rAudioIn = new float[initialBufferSize]; /* This is a nice safe piece of code */ memset(lAudioOut, 0, initialBufferSize * sizeof(float)); memset(rAudioOut, 0, initialBufferSize * sizeof(float)); memset(lAudioIn, 0, initialBufferSize * sizeof(float)); memset(rAudioIn, 0, initialBufferSize * sizeof(float)); /* Now you can put anything you would normally put in maximilian's 'setup' method in here. */ // samp.load(ofToDataPath("sinetest_stepping2.wav")); // samp.load(ofToDataPath("whitenoise2.wav")); // samp.load(ofToDataPath("additive22.wav")); //samp.load(ofToDataPath("pinknoise2.wav")); //samp.load(ofToDataPath("filtersweep2.wav")); //samp.getLength(); fftSize = 1024; mfft.setup(fftSize, 512, 256); ifft.setup(fftSize, 512, 256); nAverages = 12; oct.setup(sampleRate, fftSize/2, nAverages); mfccs = (double*) malloc(sizeof(double) * 13); mfcc.setup(512, 42, 13, 20, 20000, sampleRate); ofxMaxiSettings::setup(sampleRate, 2, initialBufferSize); ofSoundStreamSetup(2,2, this, sampleRate, initialBufferSize, 4);/* Call this last ! */ //GUI STUFF gui.setup(); // most of the time you don't need a name /* mfccToggle.setBackgroundColor(ofColor(191,72,250)); fftToggle.setBackgroundColor(ofColor(191,72,250)); chromagramToggle.setBackgroundColor(ofColor(191,72,250)); peakFrequencyToggle.setBackgroundColor(ofColor(191,72,250)); centroidToggle.setBackgroundColor(ofColor(191,72,250)); rmsToggle.setBackgroundColor(ofColor(191,72,250)); */ gui.add(fftToggle.setup("FFT bin magnitudes (pitch/timbre/volume) (512)", true)); gui.add(mfccToggle.setup("MFCCs (timbre/vocal) (13)", true)); gui.add(chromagramToggle.setup("Octave analyser (pitch) (12)", true)); gui.add(peakFrequencyToggle.setup("Peak frequency (pitch) (1)", true)); gui.add(centroidToggle.setup("Spectral centroid (timbre) (1)", true)); gui.add(rmsToggle.setup("RMS (volume) (1)", true)); //gui.setSize(600, 500); bHide = true; myfont.loadFont("arial.ttf", 18); ofSetVerticalSync(true); }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(false); drawWidth = 1024; drawHeight = 768; // process all but the density on 16th resolution flowWidth = drawWidth/4; flowHeight = drawHeight/4; // Flow & Mask opticalFlow.setup(flowWidth, flowHeight); velocityMask.setup(drawWidth, drawHeight); // Fluid #ifdef USE_FASTER_INTERNAL_FORMATS fluid.setup(flowWidth, flowHeight, drawWidth, drawHeight, true); #else fluid.setup(flowWidth, flowHeight, drawWidth, drawHeight, false); #endif // Particles particleFlow.setup(flowWidth, flowHeight, drawWidth, drawHeight); // Visualisation displayScalar.allocate(flowWidth, flowHeight); velocityField.allocate(flowWidth / 4, flowHeight / 4); temperatureField.allocate(flowWidth / 4, flowHeight / 4); // Draw Forces numDrawForces = 6; flexDrawForces = new flowTools::ftDrawForce[numDrawForces]; flexDrawForces[0].setup(drawWidth, drawHeight, flowTools::FT_DENSITY, true); flexDrawForces[0].setName("draw full res"); flexDrawForces[1].setup(flowWidth, flowHeight, flowTools::FT_VELOCITY, true); flexDrawForces[1].setName("draw flow res 1"); flexDrawForces[2].setup(flowWidth, flowHeight, flowTools::FT_TEMPERATURE, true); flexDrawForces[2].setName("draw flow res 2"); flexDrawForces[3].setup(drawWidth, drawHeight, flowTools::FT_DENSITY, false); flexDrawForces[3].setName("draw full res"); flexDrawForces[4].setup(flowWidth, flowHeight, flowTools::FT_VELOCITY, false); flexDrawForces[4].setName("draw flow res 1"); flexDrawForces[5].setup(flowWidth, flowHeight, flowTools::FT_TEMPERATURE, false); flexDrawForces[5].setName("draw flow res 2"); // Camera cameraFbo.allocate(drawWidth, drawHeight); cameraFbo.begin(); ofClear(0); cameraFbo.end(); setupGui(); lastTime = ofGetElapsedTimef(); lastMouse.set(0,0); // ************* Kinect Stuff ************* ofSetLogLevel(OF_LOG_VERBOSE); kinect.setRegistration(true); kinect.init(); kinect.open(); colorImg.allocate(kinect.width, kinect.height); grayImage.allocate(kinect.width, kinect.height); grayThreshNear.allocate(kinect.width, kinect.height); grayThreshFar.allocate(kinect.width, kinect.height); nearThreshold = 230; farThreshold = 70; bThreshWithOpenCV = true; ofSetFrameRate(60); // zero the tilt on startup angle = 30; kinect.setCameraTiltAngle(angle); }
void IntroductionView::Setup() const { ofSetFrameRate(frame_rate); ofSetVerticalSync(true); ofEnableAlphaBlending(); ofEnableSmoothing(); }
//-------------------------------------------------------------- void testApp::setup(){ ///////////////////////////// // SAMPLE SOUNDS, use this for debugging. ///////////////////////////// accentTrack = "sounds/normalized/scrapes_loop.wav"; gurgleTracks = "sounds/volume_adjusted/gurgle_"; inhaleExhaleTracks = "sounds/normalized/inhale_exhale_"; beats.loadSound("sounds/1085.mp3"); beats.setVolume(0.75f); beats.setMultiPlay(false); vocals.loadSound("sounds/Violet.mp3"); vocals.setVolume(0.75f); vocals.setMultiPlay(false); ///////////////////////////// // MUSHROOM SOUNDS ///////////////////////////// // load Accent loop accentLoop.loadSound(accentTrack); accentLoop.setVolume(0.75f); accentLoop.setMultiPlay(false); // Load Gurgles for (int i =0; i < NUM_GURGLE; i++) { string gName = gurgleTracks + ofToString(i+1) + ".wav"; cout << "gurgle loaded: " << gName << endl; gurgleSounds[i].loadSound(gName); gurgleSounds[i].setVolume(1.0f); // 100% volume gurgleSounds[i].setMultiPlay(false); } // Load Breathing for (int j =0; j < NUM_BREATHE; j++) { string iName = inhaleExhaleTracks + ofToString(j+1) + ".wav"; cout << "inhale-exhale loaded: " << iName << endl; inhaleExhaleSound[j].loadSound(iName); inhaleExhaleSound[j].setVolume(0.25f); // 50% volume inhaleExhaleSound[j].setMultiPlay(false); } ////////////////// ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0,0,0); font.loadFont("franklinGothic.otf", 20); smallFont.loadFont("franklinGothic.otf", 14); irOneValue = "analog IR #1 pin:"; irTwoValue = "analog IR #2 pin:"; irThreeValue = "analog IR #3 pin:"; // ****** Replace the string below with the serial port for your Arduino board // you can get this from the Arduino application or via command line // for OSX, in your terminal type "ls /dev/tty.*" to get a list of serial devices ard.connect("/dev/tty.usbmodem1421", 57600); // listen for EInitialized notification. this indicates that // the arduino is ready to receive commands and it is safe to // call setupArduino() ofAddListener(ard.EInitialized, this, &testApp::setupArduino); bSetupArduino = false; // flag so we setup arduino when its ready, you don't need to touch this :) }
//-------------------------------------------------------------- void testApp::setup(){ ofSetLogLevel(OF_LOG_VERBOSE); ofBackground(34, 34, 34); ofEnableAlphaBlending(); Tweenzor::init() ; //we load a font and tell OF to make outlines so we can draw it as GL shapes rather than textures //font.loadFont("type/verdana.ttf", 100, true, false, true, 0.4, 72); // shader.load("shaders/noise.vert", "shaders/noise.frag"); shader.load("shaders/monjori.vert", "shaders/monjori.frag" ) ; doShader = true; cam.disableMouseInput() ; cam.setDistance( 250.0f ) ; fbo.allocate( ofGetWidth() , ofGetHeight() , GL_RGBA ) ; fbo.begin() ; ofClear( 0 , 0 , 0 , 1.0f ) ; fbo.end() ; glEnable( GL_DEPTH_TEST ) ; ofSetFrameRate( 60 ) ; ofSetVerticalSync( true ) ; timeFactor = 40.0f ; e_factor = 400.0f ; f_factor = 400.0f ; i_factor = 200.0f ; d_factor = 200.0f ; float dim = 24; float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; float length = 320-xInit; drawPadding = false; gui = new ofxUICanvas(0, 0, length+xInit, ofGetHeight()); gui->addWidgetDown(new ofxUILabel("Shader Vars", OFX_UI_FONT_LARGE)); gui->addWidgetDown( new ofxUISlider( 160 , dim , 50.0f, 950.0f, e_factor , "E")); gui->addWidgetDown( new ofxUISlider(160,dim , 50.0f, 3050.0f, f_factor , "F")); gui->addWidgetDown( new ofxUISlider(160,dim , 50.0f, 3050.0f, i_factor , "I")); gui->addWidgetDown( new ofxUISlider(160,dim , 50.0f, 3050.0f, d_factor , "D")); gui->addWidgetDown( new ofxUISlider(160,dim , 1.0f , 3000.0f, timeFactor , "Time")); gui->addWidgetDown( new ofxUISlider(160,dim , 1000.0f , 12000.0f, volumeScale , "VolumeScale")); /* gui->addWidgetDown( new ofxUISlider(160,dim, 0.0, 10.0f, var2, "var2")); gui->addWidgetDown(new ofxUISlider(160,dim, 0.0, 255.0, var3, "var3")); gui->addWidgetDown(new ofxUISlider(160,dim, 0.0, 255.0, var4, "var4")); gui->addWidgetDown( new ofxUISlider(160,dim, -ofGetWidth(), ofGetWidth() , translate.x, "x")); gui->addWidgetDown( new ofxUISlider(160,dim, -ofGetHeight() , ofGetHeight() , translate.y, "y")); gui->addWidgetDown( new ofxUISlider(160,dim, -2000 , 2000 , translate.z, "z")); */ gui->addWidgetDown( new ofxUILabel("AMBIENT COLOR", OFX_UI_FONT_LARGE )) ; gui->addWidgetDown( new ofxUISlider(dim,50, -1.0f , 1.0f , ambientColor.x, "R")); gui->addWidgetRight( new ofxUISlider(dim,50, -1.0f , 1.0f , ambientColor.y, "G")); gui->addWidgetRight( new ofxUISlider(dim,50, -1.0f , 1.0f , ambientColor.z, "B")); gui->addWidgetRight( new ofxUISlider(dim,50, -1.0f , 1.0f , ambientColor.w, "A")); gui->addWidget( new ofxUIToggle(dim, 50, 50 , 50 , state1 , "state1" )) ; gui->addWidget( new ofxUIToggle(dim, 50, 50 , 50 , state2 , "state2" )) ; gui->addWidget( new ofxUIToggle(dim, 50, 50 , 50 , state3 , "state3" )) ; gui->addWidget( new ofxUIToggle(dim, 50, 50 , 50 , state4 , "state4" )) ; /* timeFactor = 40.0f ; e_factor = 400.0f ; f_factor = 400.0f ; i_factor = 200.0f ; d_factor = 200.0f ; */ ofAddListener(gui->newGUIEvent,this,&testApp::guiEvent); float var2 , var3 , var4 ; gui->loadSettings("uisettings.xml" ) ; //ofVec3f lightDir ; //ofVec4f ambientColor ; soundStream.listDevices(); //if you want to set a different device id //soundStream.setDeviceID(0); //bear in mind the device id corresponds to all audio devices, including input-only and output-only devices. int bufferSize = 256; left.assign(bufferSize, 0.0); right.assign(bufferSize, 0.0); volHistory.assign(400, 0.0); bufferCounter = 0; drawCounter = 0; smoothedVol = 0.0; scaledVol = 0.0; soundStream.setup(this, 0, 2, 44100, bufferSize, 4); state1 = false ; state2 = false ; state3 = false ; state4 = false ; }
//-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); // for single delivery package //ofSetDataPathRoot("./"); ofDirectory dir; dir.open(ASSEST_VIDOE_FOLDER); int numFiles = dir.listDir(); for (int i = 0; i < numFiles; ++i) { cout << "Path at index [" << i << "] = " << dir.getPath(i) << endl; videoPlayers.push_back(new ofxAVFVideoPlayer()); videoPlayers[i]->loadMovie(dir.getPath(i)); videoPlayers[i]->setLoopState(OF_LOOP_NORMAL); videoPlayers[i]->play(); } // load video // for(int i=0; i<N_VIDEO_PLAYERS; i++) { // videoPlayers.push_back(new ofxAVFVideoPlayer()); // videoPlayers[i]->loadMovie("movies/farm_window.mov"); // videoPlayers[i]->setLoopState(OF_LOOP_NORMAL); // } // // load images // imgBottom = new ofImage(); // imgTop = new ofImage(); // // imgBottom->loadImage("images/L2.jpg"); // imgTop->loadImage("images/L1.jpg"); // load image using ofxGiantImage //imgTopx = new ofxGiantImage(); //imgTopx->loadImage("images/L1.jpg"); imgTop = new ofxGiantImage(); imgBottom = new ofxGiantImage(); imgBottom->loadImage("images/L2.jpg"); //papaya imgTop->loadImage("images/L1.jpg"); imgTopPosters.push_back(imgTop); // enable trace to file //ofLogToFile("myLogFile.txt", true); // initilization videoPause = false; imageDisplay = false; dbgImg = false; isDemoMode = false; isUpdateImg = false; isDownloadImg = false; imgRotateIndex = 0; #ifdef REMOTE_CONTROL //////////////////////////////////////////////////////// // Remote UI RUI_SETUP(); //start server RUI_SHARE_PARAM(isDemoMode, ofColor(255,0,0,64)); // SET PARAM GROUPS / COLORS ////////////////////////////////// RUI_NEW_GROUP("Poster"); //make a new group (optional) // SHARE A STRING PARAM //////////////////////////////// strPoster = " "; RUI_SHARE_PARAM(strPoster, ofColor(255,0,0,64)); // you can also set a color on a per-param basis //Expose x and y vars to the server, providing a valid slider range RUI_SHARE_PARAM(x, 0, ofGetWidth()); RUI_SHARE_PARAM(y, 0, ofGetHeight()); strUpdateFileDate = ""; RUI_SHARE_PARAM(strUpdateFileDate); //share the color param //RUI_SHARE_COLOR_PARAM(color); // SET PARAM GROUPS / COLORS ////////////////////////////////// RUI_NEW_GROUP("Video"); //make a new group (optional) strFruitPrefix = "今天的苹果好好吃,总共有 "; strUnit = " 颗"; currentAppleAmount = "0"; RUI_SHARE_PARAM(currentAppleAmount, ofColor(255,0,0,64)); // you can also set a color on a per-param basis // SHARE AN ENUM PARAM //////////////////////////////// //build a string list for the UI to show // menu = MENU_OPTION_1; // string menuItems[] = {"MENU_OPTION_0", "MENU_OPTION_1", "MENU_OPTION_2", "MENU_OPTION_3"}; // //privide the enum param, loweset enum, highest enum, and the Enum string list // RUI_SHARE_ENUM_PARAM(menu, MENU_OPTION_0, MENU_OPTION_3, menuItems); // SHARE A string PARAM to unload it later; //this is useful in cases where a variable used to be shared, //but its value is now on the xml and you still want it loaded //but you dont want it to show on the client interface //to do so, you first share the param, then load from XML, then remove the param unloadTest = "inited from source"; RUI_SHARE_PARAM(unloadTest); //load values from XML, as they were last saved (if they were) RUI_LOAD_FROM_XML(); //this efectively removes all remoteUI references to this param //but bc it's been loaded from xml in the previous step before, //the end result is that you get to load its value from XML //but it doesnt show in the client. //This is meant to be a way to reduce clutter in the client, //allowing you to phase out params that have settled down and dont //need further editing, but still allowing you to load its value from the xml. RUI_REMOVE_PARAM(unloadTest); cout << "unloadTest: '" << unloadTest << "'" << endl; RUI_WATCH_PARAM(currentMouseX); //this will print the supplied param all the time on screen, //useful for debugging RUI_GET_INSTANCE()->setBuiltInUiScale(3); RUI_GET_INSTANCE()->drawUiWithFontStash("SourceHanSansSC-Light.ttf"); #endif // load font unicodeFont.setup("SourceHanSansSC-Light.ttf", //font file, ttf only 1.0, //lineheight percent 1024, //texture atlas dimension true, //create mipmaps of the font, useful to scale down the font at smaller sizes 8, //texture atlas element padding, shouldbe >0 if using mipmaps otherwise 2.0f //dpi scaleup, render textures @2x the reso ); //lower res mipmaps wil bleed into each other FZLfont.setup("FZLTZCHJW.ttf", //font file, ttf only 1.0, //lineheight percent 1024, //texture atlas dimension true, //create mipmaps of the font, useful to scale down the font at smaller sizes 8, //texture atlas element padding, shouldbe >0 if using mipmaps otherwise 2.0f //dpi scaleup, render textures @2x the reso ); //lower res mipmaps wil bleed into each other // char serverPath[512] = "http://www.vim.org/scripts/download_script.php?src_id=7701"; //TODO: move to url list // char filePath[256] = "poster_01.zip"; // // char cmd[1024]; // sprintf(cmd, "curl -o %s %s", filePath, serverPath); // cout << "c md:" << cmd << "\n"; // // //char command[] = "curl -o est.zip http://www.vim.org/scripts/download_script.php?src_id=7701"; // //char command[] = "wget http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2"; // int status = system(cmd); initTime = ofGetElapsedTimef(); initTimeDbg = ofGetElapsedTimef(); ofRegisterURLNotification(this); // osc oscSender.setup(HOST, SENDPORT); oscReceiver.setup(RECVPORT); // send ready msgSend.setAddress("/sync/start/FW_SH_02_HBD_A"); msgSend.addStringArg("ready"); oscSender.sendMessage(msgSend); }
//-------------------------------------------------------------- void ofApp::setup(){ retryAfter = 100; ofSetVerticalSync(true); /* IF SERVER? ofxLibwebsockets::ServerOptions options = ofxLibwebsockets::defaultServerOptions(); options.port = 6666; options.bUseSSL = false; socket.setup(options); socket.addListener(this); */ options.port = 14949; options.bUseSSL = false; options.host = "127.0.0.1"; socket.connect(options); socket.addListener(this); retryAfter = 100; startTime = ofGetElapsedTimeMillis(); ofSetLogLevel("ofxSceneManager", OF_LOG_VERBOSE); sm.setup(); twinkle = (twinkleScene*)sm.add(new twinkleScene() ); noPlace = (NoPlaceScene*)sm.add(new NoPlaceScene()); sm.add(new SyncScene(&localTime)); sm.gotoScene("NoPlace"); ///// Scenes n control panel sceneNames.push_back("scene 0"); sceneNames.push_back("scene 1"); sceneNames.push_back("scene 2"); sceneNames.push_back("scene 3"); sceneNames.push_back("sync"); sceneNames.push_back("no place"); sceneNames.push_back("twinkle"); sceneNames.push_back("testCube"); sceneNames.push_back("cyclone"); sceneNames.push_back("munchkinland"); sceneNames.push_back("dialogue 1"); sceneNames.push_back("dialogue 2"); sceneNames.push_back("dialogue 3"); sceneNames.push_back("dialogue 4"); sceneNames.push_back("dialogue 5"); sceneNames.push_back("scene 15"); sceneNames.push_back("scene 16"); sceneNames.push_back("scene 17"); sceneNames.push_back("scene 18"); sceneNames.push_back("scene 19"); sceneNames.push_back("scene 20"); sceneNames.push_back("scene 21"); sceneNames.push_back("scene 22"); sceneNames.push_back("scene 23"); sceneNames.push_back("scene 24"); sceneNames.push_back("scene 25"); sceneNames.push_back("scene 26"); setDrawControlPanel(true); controlPanel.addPanel("Scene Control", 1); controlPanel.setWhichPanel("Scene Control"); controlPanel.addTextDropDown("Scene", "scene", 0, sceneNames); controlPanel.setupEvents(); controlPanel.enableEvents(); ofAddListener(controlPanel.guiEvent, this, &ofApp::onGuiEvent); bDebug = true; }
//-------------------------------------------------------------- void ofApp::update(){ heart.setTimer((int)((1.0/heartbeatFrameRate) * 1000.0)); colorTimer.setTimer((int)((1.0/colorFrameRate) * 1000.0)); if (bLastSync != verticalSync){ ofSetVerticalSync(verticalSync); } bLastSync =verticalSync; heart.update(ofGetElapsedTimeMillis()); if (heart.bTimerFired() && sendHeartbeat){ for (int i = 0; i < sparks.size(); i++){ sparks[i].bSendHeartBeat = true; } } if (sendOneHeartbeat == true){ sendOneHeartbeat = false; for (int i = 0; i < sparks.size(); i++){ sparks[i].bSendHeartBeat = true; } } colorTimer.update(ofGetElapsedTimeMillis()); if (colorTimer.bTimerFired() && sendColor){ sendColorData(); } //if (ofGetFrameNum() % 100 == 0){ // fireDiscovery(); //} if (setAllWhite == true){ setAllWhite = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor::white; } //useOsc = false; } if (setAllBlack == true){ setAllBlack = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor::black; } //useOsc = false; } if (setAllRed == true){ setAllRed = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor::red; } } if (setAllBlue == true){ setAllBlue = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor::blue; } } if (setAllGreen == true){ setAllGreen = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor::green; } } if (setAllRandom == true){ setAllRandom = false; for (int i = 0; i < colorValuesForOutput.size(); i++){ colorValuesForOutput[i] = ofColor(ofRandom(0,255), ofRandom(0,255), ofRandom(0,255));; } //useOsc = false; } // OSC while(receiver.hasWaitingMessages()){ ofxOscMessage m; receiver.getNextMessage(&m); if(m.getAddress() == "/color"){ // :( this is bad // for (int i = 0; i < m.getNumArgs()/3; i++){ // colorValuesForOutput[i].set( m.getArgAsInt32(i*3+0), m.getArgAsInt32(i*3+1), m.getArgAsInt32(i*3+2)); // } for (int i = 0; i < m.getNumArgs(); i++){ int value = m.getArgAsInt32(i); int red = value >> 24 & 0xFF; //hex FF = white (255) 1111 1111 int green = value >> 16 & 0xFF; int blue = value >> 8 & 0xFF; colorValuesForOutput[i].set(red, green, blue); } } } // if (sendColor && ofGetFrameNum() % 2 == 0){ // sendColorData(); // } char udpMessage[sizeof(sparkyToOFPacket)]; memset(udpMessage, 0, sizeof(sparkyToOFPacket)); bool bAnyAvailable = true; while (bAnyAvailable == true){ int nBytesRevd = udp.Receive(udpMessage, sizeof(sparkyToOFPacket)); if (nBytesRevd <= 0) bAnyAvailable = false; if(nBytesRevd == sizeof(sparkyToOFPacket)){ bGotSth = true; // this is imporant, I don't think we should time against all this junk here. float receivedTime = ofGetElapsedTimef(); memset(&S2Opacket, 0, sizeof(sparkyToOFPacket)); memcpy(&S2Opacket, udpMessage, sizeof(sparkyToOFPacket)); string ipThisPacket = ipFromInt( S2Opacket.ipSpark); //packetHandler ph(S2Opacket); bool bDoesThisSparkExist = false; for (int i = 0; i < sparks.size(); i++){ if (sparks[i].ip == ipThisPacket ){ //cout << "ph.ipSparkString : " << i << " : " << sparks[i].ip << endl; bDoesThisSparkExist = true; } } // register it if we never seen it before if (!bDoesThisSparkExist){ spark temp; sparks.push_back(temp); sparks[sparks.size()-1].setup(S2Opacket); sparks[sparks.size()-1].boardNumber = uuidMapping[sparks[sparks.size()-1].uuid]; ofSort(sparks, sortSpark); // otherwise, welcome back our beloved sparky! ! } else { for (int i = 0; i< sparks.size(); i++) { if(sparks[i].ip == ipThisPacket ){ sparks[i].readPacketFromSpark(S2Opacket, receivedTime); } } } } } for (int i =0; i< sparks.size(); i++){ sparks[i].update(); // cout << "updating" << i << endl; } // if (ofGetMousePressed()){ // // if (ofGetFrameNum() % 60 ==0){ // fireControl(); // } // } }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofBackground(0); }
//-------------------------------------------------------------- void ofApp::setup(){ ofBackground(0); ofSetVerticalSync(true); // Kinect V1 kinect.setRegistration(true); kinect.init(); //kinect.init(true); // shows infrared instead of RGB video image //kinect.init(false, false); // disable video image (faster fps) kinect.open(); // opens first available kinect //kinect.open(1); // open a kinect by id, starting with 0 (sorted by serial # lexicographically)) //kinect.open("A00362A08602047A"); // open a kinect using it's unique serial # // zero the tilt on startup angle = 0; kinect.setCameraTiltAngle(angle); // print the intrinsic IR sensor values if(kinect.isConnected()) { ofLogNotice() << "sensor-emitter dist: " << kinect.getSensorEmitterDistance() << "cm"; ofLogNotice() << "sensor-camera dist: " << kinect.getSensorCameraDistance() << "cm"; ofLogNotice() << "zero plane pixel size: " << kinect.getZeroPlanePixelSize() << "mm"; ofLogNotice() << "zero plane dist: " << kinect.getZeroPlaneDistance() << "mm"; } depthImg.allocate(kinect.width, kinect.height, OF_IMAGE_GRAYSCALE); float sqrResolution = tracker.getResolution(); sqrResolution *= sqrResolution; //minPoints = (int)(0.001*(float)(512 * 424)/sqrResolution); camera.setPosition(ofGetWidth() / 4.0, ofGetHeight() / 2.0, 1000.); camera.lookAt(ofVec3f(0)); // TODO: Add to GUI thresholdNear.set("Threshold Near", 230, 0, 255); thresholdFar.set("Threshold Far", 70, 0, 255); boxMin.set("boxMin", ofVec3f(-8), ofVec3f(-10), ofVec3f(0)); boxMax.set("boxMax", ofVec3f(8), ofVec3f(0), ofVec3f(10)); thresh3D.set("thresh3D", ofVec3f(.2, .2, .3), ofVec3f(0), ofVec3f(1)); thresh2D.set("thresh2D", 1, 0, 255); minVol.set("minVol", 0.02, 0, 10); maxVol.set("maxVol", 2, 0, 100); minPoints.set("minPoints", 50, 0, 500); maxBlobs.set("maxBlobs", 10, 0, 100); trackedBlobs.set("trackdBlobs", 0, 0, maxBlobs); gui.setup("Settings", "settings.xml"); gui.add(thresholdNear); gui.add(thresholdFar); gui.add(boxMin); gui.add(boxMax); gui.add(thresh3D); gui.add(thresh2D); gui.add(minVol); gui.add(maxVol); gui.add(minPoints); gui.add(maxBlobs); gui.add(trackedBlobs); gui.loadFromFile("settings.xml"); visible = true; save = false; // Test Hitbox hitBoxesManager.setup(); ofVec3f boxCenter = ofVec3f(0.0f, 0.0f, 0.0f); ofPoint boxDimensions = ofPoint(1.0, 1.0, 1.0); hitBoxesManager.addHitBoxToWorld(boxCenter, boxDimensions); ofAddListener(hitBoxesManager.onHitBoxBecomesActive, this, &ofApp::onHitBoxStateChanged); ofAddListener(hitBoxesManager.onHitBoxBecomesInactive, this, &ofApp::onHitBoxStateChanged); }
//-------------------------------------------------------------- void ofApp::setup(){ ofSetFrameRate(60); ofSetVerticalSync( true ); ofSetBackgroundAuto(false); wave_poles.setup(NUM_ARRAY); wave_ramp.setup(NUM_ARRAY); wave_poles.updateResponse(ATTACK, DAMPING); wave_ramp.updateResponse(ATTACK, DAMPING); fboTexPoles.allocate(RENDER_WIDTH_POLE, RENDER_HEIGHT_POLE); fboTexRamp.allocate(RENDER_WIDTH_RAMP, RENDER_HEIGHT_RAMP); render.allocate(RENDER_WIDTH_POLE+RENDER_WIDTH_RAMP, RENDER_HEIGHT_POLE); syphonRenderOut.setName("Waves"); syphonTex.allocate(RENDER_WIDTH_POLE+RENDER_WIDTH_RAMP, RENDER_HEIGHT_POLE, GL_RGBA); syphonTex = render.getTexture(); render.begin(); { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } render.end(); WaveControl.setName("WaveControl"); WaveControl.add(inLeft.set("inLeft", 0., -1., 1.)); WaveControl.add(inRight.set("inRight", 0., -1., 1.)); WaveControl.add(noiseAmt.set("noiseAmt", 0.15, 0., 1)); WaveControl.add(posHWavePoles.set("posHWavePoles", 0.5, 0., 2)); WaveControl.add(posHWaveRamp.set("posHWaveRamp", 0.5, 0., 2)); WaveControl.add(posHLinePoles.set("posHLinePoles", 0.5, 0, 2)); WaveControl.add(posHLineRamp.set("posHLineRamp", 0.5, 0, 2)); WaveControl.add(colorTopTop.set("colorTopTop", ofColor(0,154,255,255), ofColor(0,0),ofColor(255))); WaveControl.add(colorTopBot.set("colorTopBot", ofColor(255,179,66,255), ofColor(0,0),ofColor(255))); WaveControl.add(colorBotTop.set("colorBotTop", ofColor(0,105,255,255), ofColor(0,0),ofColor(255))); WaveControl.add(colorBotBot.set("colorBotBot", ofColor(0,0,55), ofColor(0,0),ofColor(255))); WaveControl.add(colorLine.set("colorLine", ofColor(255,255), ofColor(0,0),ofColor(255))); // Blinkende blinks graficBlinkendeLygter.allocate(RENDER_WIDTH_POLE+RENDER_WIDTH_RAMP, RENDER_HEIGHT_POLE); // Control WaveControl.add(blinkIntensity.set("blinkIntensity", 0.0, 0.0, 1.0)); WaveControl.add(blinkTempo.set("blinkTempo", 0.02, 0.0001, 0.1)); WaveControl.add(hard_soft.set("hard/soft", true)); WaveControl.add(colorBlink.set("colorBlink", ofColor(255,255), ofColor(0,0), ofColor(255,255))); // Boubbles graficBoubbles.allocate(RENDER_WIDTH_POLE+RENDER_WIDTH_RAMP, RENDER_HEIGHT_POLE); // Control WaveControl.add(boubblesIntensity.set("boubblesIntensity", 0.0, 0.0, 1.0)); WaveControl.add(boubblesVelMin.set("boubblesVelMin", 0.5, 0.0, 5.0)); WaveControl.add(boubblesVelMax.set("boubblesVelMax", 2., 0.0, 5.0)); WaveControl.add(colorBoubbles.set("colorBoubbles", ofColor(255,255), ofColor(0,0), ofColor(255,255))); // Dancing Lines counterDLines = 0; // Control WaveControl.add(dLinesSpeed.set("dLinesSpeed", .2, 0.0, 1)); WaveControl.add(dLinesSync.set("dLinesSync", .9, 0.5, 1)); WaveControl.add(colorDLines.set("colorDLines", ofColor(0,255), ofColor(0,0), ofColor(255,255))); for(int i = 0; i < 10; i++){ DancingLine newLine; newLine.location1 = ofVec2f(0, fboTexPoles.getHeight()/2); newLine.location2 = ofVec2f(fboTexPoles.getWidth(), fboTexPoles.getHeight()/2); newLine.lineColor = colorDLines; newLine.freedom = fboTexPoles.getHeight()/2; dancingLinesPole.push_back(newLine); } for(int i = 0; i < 10; i++){ DancingLine newLine; newLine.location1 = ofVec2f(0, fboTexRamp.getHeight()/2); newLine.location2 = ofVec2f(fboTexRamp.getWidth(), fboTexRamp.getHeight()/2); newLine.lineColor = colorDLines; newLine.freedom = fboTexRamp.getHeight()/2; dancingLinesRamp.push_back(newLine); } // Drops WaveControl.add(dropsVelMin.set("dropsVelMin", 0.001, 0.0, .2)); WaveControl.add(dropsVelMax.set("dropsVelMax", 0.1, 0.0, .5)); WaveControl.add(dropsDragLimit.set("dropsDragLimit", 0.1, 0.0, .5)); WaveControl.add(dropsExtraMass.set("dropsExtraMass", 0.01, 0.0, .1)); WaveControl.add(colorDrops.set("colorDrops", ofColor(255,255), ofColor(0,0), ofColor(255,255))); // setup the control panel Flock.setName("Flock"); Flock.add(flockIntensity.set("flockIntensity", 0., 0. , 1.)); Flock.add(flockIntensityDay.set("flockIntensityDay", 0., 0. , 1.)); Flock.add(maxForce.set("maxForce", 0.5, 0.1 , 10)); Flock.add(maxSpeed.set("maxSpeed", 2, 1 , 10)); Flock.add(desiredSeparation.set("desiredSeparation", 20, 0 , 100)); Flock.add(neighbourDist.set("neighbourDist", 27, 0 , 100)); Flock.add(weightSeparation.set("weightSeparation", 1.5, 0. , 2.)); Flock.add(weightAlign.set("weightAlign", 1, 0. , 2.)); Flock.add(weightCohesion.set("weightCohesion", 1, 0. , 2.)); Flock.add(numOfBoids.set("numOfBoids", 35, 1, 500)); Flock.add(colorFlock.set("colorFlock", ofColor(0,255), ofColor(0,0), ofColor(255,255))); WaveControl.add(Flock); // Setup GUI WaveControl.add(updateRequest.set("updateRequest",0, 0, 1)); gui.setup(WaveControl); gui.minimizeAll(); // Setup Flock flockSystem.setup(numOfBoids, ofVec2f(0,0), RENDER_HEIGHT_POLE); flockSystem.setAllDesiredsep(desiredSeparation); // flockSystem.setAllMax(maxForce, maxSpeed); flockSystem.setAllNeighbourdist(neighbourDist); flockSystem.setAllWheigts(weightSeparation, weightSeparation, weightCohesion); // flockSystem.startThread(); // SETUP FOR OSC syncOSC.setup((ofParameterGroup&)gui.getParameter(),OSCRECEIVEPORT,"localhost",OSCSENDPORT); // colorBlink = ofColor(255); // colorBoubbles = ofColor(255); updateRequest = 1; syncOSC.update(); updateRequest = 0; // osc receiver to make soundWaves receiveOscTriggers.setup(TRIGGER_OSCRECEIVEPORT); sWSystem.setup(RENDER_WIDTH_SW, RENDER_HEIGHT_SW); // MASK if(!pixelMask.load("mask.png")){ pixelMask.allocate(RENDER_WIDTH_POLE+RENDER_WIDTH_RAMP, RENDER_HEIGHT_POLE, OF_IMAGE_COLOR_ALPHA); pixelMask.setColor(ofColor(0,0,0,0)); } }
void testApp::setup() { ofSetFrameRate(60); ofSetVerticalSync(true); bIsRecordingMovie = false; camera.setup(); }
//-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground( 10, 10, 10); camera.setPosition(ofVec3f(0, -3.f, -40.f)); camera.lookAt(ofVec3f(0, 0, 0), ofVec3f(0, -1, 0)); world.setup(); world.enableGrabbing(); world.setCamera(&camera); world.setGravity( ofVec3f(0, 25., 0) ); ofVec3f startLoc; ofPoint dimens; boundsWidth = 30.; float hwidth = boundsWidth*.5; float depth = 2.; float hdepth = depth*.5; boundsShape = new ofxBulletCustomShape(); boundsShape->create(world.world, ofVec3f(0, 0, 0), 10.); for(int i = 0; i < 6; i++) { bounds.push_back( new ofxBulletBox() ); if(i == 0) { // ground // startLoc.set( 0., hwidth+hdepth, 0. ); dimens.set(boundsWidth, depth, boundsWidth); } else if (i == 1) { // back wall // startLoc.set(0, 0, hwidth+hdepth); dimens.set(boundsWidth, boundsWidth, depth); } else if (i == 2) { // right wall // startLoc.set(hwidth+hdepth, 0, 0.); dimens.set(depth, boundsWidth, boundsWidth); } else if (i == 3) { // left wall // startLoc.set(-hwidth-hdepth, 0, 0.); dimens.set(depth, boundsWidth, boundsWidth); } else if (i == 4) { // ceiling // startLoc.set(0, -hwidth-hdepth, 0.); dimens.set(boundsWidth, depth, boundsWidth); } else if (i == 5) { // front wall // startLoc.set(0, 0, -hwidth-hdepth); dimens.set(boundsWidth, boundsWidth, depth); } btBoxShape* boxShape = ofBtGetBoxCollisionShape( dimens.x, dimens.y, dimens.z ); boundsShape->addShape( boxShape, startLoc ); bounds[i]->create( world.world, startLoc, 0., dimens.x, dimens.y, dimens.z ); bounds[i]->setProperties(.25, .95); bounds[i]->add(); } bDropBox = false; bDrawDebug = false; // this model is huge! scale it down //ofVec3f scale(.0009, .0009, .0009); ofVec3f scale(.09, .09, .09); // 3D logo by Lauren Licherdell | http://www.laurenlicherdell.com/ // model2.loadModel("OFlogo.dae", false); //change true to false (do not optimize model, see https://github.com/openframeworks/openFrameworks/issues/4994) model2.setScale(scale.x, scale.y, scale.z); model2.setPosition(0, 0, 0); assimpModel.loadModel("grip.dae", false); //change true to false (do not optimize model, see https://github.com/openframeworks/openFrameworks/issues/4994) assimpModel.setScale(scale.x, scale.y, scale.z); assimpModel.setPosition(0, 0, 0); ofQuaternion startRot = ofQuaternion(1., 0., 0., PI); logos.resize( 5 ); //number of logos for (int i = 0; i < logos.size(); i++) { logos[i] = new ofxBulletCustomShape(); startLoc = ofVec3f( ofRandom(-5, 5), ofRandom(0, -hwidth+5), ofRandom(-5, 5) ); if(i == 0) { for(int i = 0; i < assimpModel.getNumMeshes(); i++) { logos[i]->addMesh(assimpModel.getMesh(i), scale, true); } } else { logos[i]->init( (btCompoundShape*)logos[0]->getCollisionShape(), logos[0]->getCentroid() ); } logos[i]->create( world.world, startLoc, startRot, 3. ); logos[i]->add(); } // let's make an object for the light to follow // shapes.push_back( new ofxBulletSphere() ); ((ofxBulletSphere*)shapes[0])->create(world.world, ofVec3f(0, -hwidth+5, -5), .15f, 2.); ((ofxBulletSphere*)shapes[0])->setActivationState( DISABLE_DEACTIVATION ); shapes[0]->add(); logoMat.setAmbientColor(ofFloatColor(0, 0, 0)); logoMat.setDiffuseColor(ofFloatColor(150, 0, 150)); logoMat.setSpecularColor(ofFloatColor(220, 0, 220)); logoMat.setShininess(40); // boundsMat.setAmbientColor(ofFloatColor(10, 9, 10)); //boundsMat.setDiffuseColor(ofFloatColor(12, 10, 12)); // boundsMat.setSpecularColor(ofFloatColor(1, 1, 1)); boundsMat.setShininess(10); shapesMat.setShininess(80); }
//-------------------------------------------------------------- void ofApp::setup(){ sender.setup(HOST, PORT); stage.set(0, 0, ofGetWidth(), ofGetHeight()); ofSetFullscreen(true); // set fullscreen open=true; // set the polygon true at the beginning running=true; ableClick=true; // ofSetBackgroundAuto(false); ofBackground(15); //background white handlerRadius = 5; // radius of the handler of the polygon ///////////COLOR PICKER//////// //setting up the color picker float w = ofGetWidth()/6; float h = ofGetHeight()/6; float cx = w/2; float cy = h/2; img.allocate(w,h,OF_IMAGE_COLOR); for (float y=0; y<h; y++) { for (float x=0; x<w; x++) { float angle = atan2(y-cy,x-cy)+PI; float dist = ofDist(x,y,cx,cy); float hue = angle/TWO_PI*255; float sat = ofMap(dist,0,w/4,0,255,true); float bri = ofMap(dist,w/4,w/2,255,0,true); img.setColor(x,y,ofColor::fromHsb(hue,sat,bri)); } } img.reloadTexture(); ofPoint mousePos(mouseX,mouseY); colorPickerRect.set((ofGetWidth()-ofGetWidth()/6),(ofGetHeight()-ofGetHeight()/6), ofGetWidth(), ofGetHeight()); ////////////////////////////// curvedVal= "Curved"; ////////////////// fbo color picker ///////////////// // pickerFbo.allocate(w, h,GL_RGB); // // pickerFbo.begin(); // ofClear(255,255,255); // pickerFbo.end(); ofSetRectMode(OF_RECTMODE_CORNER); // img.draw(ofGetWidth()-ofGetWidth()/6,ofGetHeight()-ofGetHeight()/6); if (colorPickerRect.inside(mouseX, mouseY)) { ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255,255,255,200); ofRect(mouseX+10, mouseY, 30, 30); colorPicked.set(img.getColor(mouseX-(ofGetWidth()-ofGetWidth()/6), mouseY-(ofGetHeight()-ofGetHeight()/6))); // colorPicked.set(colorPicked.r,colorPicked.g,colorPicked.b,curveVertices.size()*10); ofSetColor(colorPicked); ofRect(mouseX+10, mouseY, 20, 20); ofFill(); ofSetColor(255); ofPushMatrix(); ofDrawBitmapString(ofToString( colorPicked), 50,500); } ////////////////// end fbo color picker ///////////////// //temp coordinates for (int i = 0; i < curveVertices.size(); i++){ xt = curveVertices[i].x; yt = curveVertices[i].y; } ///////////////// maximilian////////////// /* some standard setup stuff*/ ofEnableAlphaBlending(); ofSetupScreen(); ofBackground(0, 0, 0); ofSetVerticalSync(true); /* This is stuff you always need.*/ sampleRate = 44100; /* Sampling Rate */ initialBufferSize = 512; /* Buffer Size. you have to fill this buffer with sound*/ /* Now you can put anything you would normally put in maximilian's 'setup' method in here. */ beat.load(ofToDataPath("beat2.wav")); beat.getLength(); ofSoundStreamSetup(2,0,this, sampleRate, initialBufferSize, 4);/* Call this last ! */ randomZ=0; }