#include "ofApp.h" // *** GLOBALS DEFINITION *** GLOBALS DEFINITION *** GLOBALS DEFINITION *** GLOBALS DEFINITION **** //-------------------------------------------------------------- void ofApp::setup(){ VISITOR_COUNT = 0; VISITOR_COUNT_LASTFRAME = 0; PARTICLE_COUNT = 0; for (int i = 0; i < particleSystems.size(); i++){ } // *** OSC Setup *** OSC Setup *** OSC Setup *** receiver.setup(PORT); } //-------------------------------------------------------------- void ofApp::update(){ // *** OSC RECEIVER *** OSC RECEIVER *** OSC RECEIVER *** /* Here the program will read and convert the information from the tracking, count them & put coordinates of people entering the ground. We have to define, how this information will affect the particleSystems! -Create message, put the stuff from the received OSC in it -duplicate the msg as string to enable onscreen supervision -There will be a global visitor count called VISITOR_COUNT -Use VISITOR_COUNT to correctly update the size of the visitors vector -Iterate trough Message-values and put information in the visitors vector */ while(receiver.hasWaitingMessages()){ ofxOscMessage visitorInformations; receiver.getNextMessage(&visitorInformations); oscMsg = ofToString(visitorInformations); if(visitorInformations.getAddress() == "/centroidsOfBlob") { VISITOR_COUNT_LASTFRAME = VISITOR_COUNT; VISITOR_COUNT = visitorInformations.getArgAsInt(0); //update the number of Visitors from OSCs first Argument, which is the number of blobs (detected Contours) // *** CHECK FOR CHANGES IN THE NUMBER OF VISITORS *** CHECK FOR CHANGES IN THE NUMBER OF VISITORS *** CHECK FOR CHANGES IN THE NUMBER OF VISITORS *** // If there are MORE visitors now, add the difference to the visitors vector if(VISITOR_COUNT > VISITOR_COUNT_LASTFRAME){ for(int i = 0; i < (VISITOR_COUNT - VISITOR_COUNT_LASTFRAME); i++){ visitors.push_back(new Visitor); } } // If there are LESS visitors now, delete the difference from the visitors vector if(VISITOR_COUNT < VISITOR_COUNT_LASTFRAME){ for(int i = 0; i < (VISITOR_COUNT_LASTFRAME - VISITOR_COUNT); i++){ delete visitors.at(visitors.size()); //maybe nicht zulässig, weil fehleranfällig??? //erase ergänzen! } } // *** TRANSFER TRACKING-INFORMATION INTO VISITOR-CLASS *** TRANSFER TRACKING-INFORMATION INTO VISITOR-CLASS *** for(int i = 1; i <= VISITOR_COUNT; i++){ //put Information into visitors float xOfVisitor = visitorInformations.getArgAsFloat(i * 2 - 1) * ofGetWindowWidth(); float yOfVisitor = visitorInformations.getArgAsFloat(i * 2) * ofGetWindowHeight(); visitors.at( i - 1 )->setPosition(xOfVisitor, yOfVisitor); } } //end of .getAddress() == "/centroidsOfBlob") } //end of receiver.hasWaitingMessages // *** RFID Input *** RFID Input *** RFID Input *** RFID Input *** RFID Input *** /* Here we have to define, how the particleSystems react to RFID input. Read ID of a visitor and let the particlesystems react to it. !!! Here in ofApp.cpp there will only be the transfer of incoming information about IDs, playertypes, etc. into the update-methods of the particleSystems. !!! For example: - Tell all particleSystems about a new checkedIn-Visitor - Set the playerType of one particular particleSystem to the checked in. */ // *** MAIN UPDATE PARTICLE SYSTEMS *** MAIN UPDATE PARTICLE SYSTEMS *** MAIN UPDATE PARTICLE SYSTEMS *** for (int p = 0; p < particleSystems.size();) { // Update particle systems // particleSystems.at(p)->update("xxx , xxx , xxx , .... "); } } //end of update() //-------------------------------------------------------------- void ofApp::draw(){ //draw all ParticleSystems that are in the particleSystems vector for(int p = 0; p < particleSystems.size(); p++) { particleSystems.at(p)->draw(); } } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ } //--------------------------------------------------------------