From 8c167b27a0ff041d40474ac85284f67dfb13641e Mon Sep 17 00:00:00 2001 From: Fritz Lenssen Date: Thu, 2 May 2019 10:41:52 +0000 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ofApp.cpp | 146 +++++++++++++++++++++++++++++++++++++++++++++ ofApp.h | 77 ++++++++++++++++++++++++ particle.cpp | 122 +++++++++++++++++++++++++++++++++++++ particle.hpp | 56 +++++++++++++++++ particleSystem.hpp | 73 +++++++++++++++++++++++ 5 files changed, 474 insertions(+) create mode 100644 ofApp.cpp create mode 100644 ofApp.h create mode 100644 particle.cpp create mode 100644 particle.hpp create mode 100644 particleSystem.hpp diff --git a/ofApp.cpp b/ofApp.cpp new file mode 100644 index 0000000..cfc77f4 --- /dev/null +++ b/ofApp.cpp @@ -0,0 +1,146 @@ +#pragma once +#include "ofApp.h" + + +// *** GLOBALS DEFINITION *** GLOBALS DEFINITION *** GLOBALS DEFINITION *** GLOBALS DEFINITION **** + + +//-------------------------------------------------------------- +void ofApp::setup(){ + + + 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, probably count & coordinates of people entering the ground. + We have to define, how this information will affect the particleSystems! + + Check for every particleSystem, if the information is relevant for its "update". + + */ + + + // *** 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. + + */ + + for (int p = 0; p < particleSystems.size();) + { + // Update particle systems + +// particleSystems.at(p)->update("xxx , xxx , xxx , .... "); + + + } + + + + +} + +//-------------------------------------------------------------- +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){ + +} + +//-------------------------------------------------------------- + + + diff --git a/ofApp.h b/ofApp.h new file mode 100644 index 0000000..00b6b12 --- /dev/null +++ b/ofApp.h @@ -0,0 +1,77 @@ +#pragma once + +#include "ofMain.h" +#include "particleSystem.hpp" +#include "greatWhole.hpp" +#include "avatar.hpp" +//#include "ofxOsc.h" + + + int WINDOWSIZE_WIDTH = 1000; + int WINDOWSIZE_HEIGHT = 1000; + + int PARTICLE_COUNT; + //+1 for every new Particle, -1 for every Particle that gets older than the defined maxLife + +// *** SETUP OSC INFORMATION *** SETUP OSC INFORMATION *** +#define PORT 12345 +#define HOST "xxx.xxx.xxx.xxx" + + + + +class ofApp : public ofBaseApp{ + public: + + void setup(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void mouseMoved(int x, int y); + void mouseDragged(int x, int y, int button); + void mousePressed(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void mouseEntered(int x, int y); + void mouseExited(int x, int y); + void windowResized(int w, int h); + void dragEvent(ofDragInfo dragInfo); + void gotMessage(ofMessage msg); + + + + + + + + + +private: + + // *** OSC *** OSC *** OSC *** + + string oscMsg; +// ofxOscReceiver receiver; + float timeSent, timeReceived; + + + //Information about what is going on in the scene + + int nBlobs; //count of the tracked visitors + + + + + + + + vector particleSystems; + + GreatWhole dasGrosseGanze; + + +}; + + + diff --git a/particle.cpp b/particle.cpp new file mode 100644 index 0000000..2482dec --- /dev/null +++ b/particle.cpp @@ -0,0 +1,122 @@ +// +// particle.cpp +// emptyExample +// +// Created by Sebastian Holzki on 16.04.19. +// +#pragma once +#include "particle.hpp" +#include "ofApp.h" + + +Particle::Particle() +{ + + +} + +// ----------------------------------- + +Particle::~Particle() +{ + + +} + +// ----------------------------------- + + + +void Particle::setup(ofVec2f _position){ + + this->position = _position; + + velocity.set(0,0); + age = 0.0; + maxLife = 12.0; + + color.set(250,250,250); + size = 2.0; + mass = 100; + +} + +// ----------------------------------- + +void Particle::update(float deltaT, Attractor attractor){ + + + + + +} + + +// ----------------------------------- + +void Particle::draw(){ + + ofDrawCircle(position,size); + +} + + +//----------------------------------- + +float Particle::getMaxLife(){ + + return maxLife; + +} + +//----------------------------------- + +float Particle::getAge(){ + + return age; + +} + +//----------------------------------- + + +void Particle::mapParticle(){ + + /* + Put an if Statement before it: + + if(borderCollission == true){mapParticle()} + + + The particle will be mapped to a new position, using information about: + + - old position + - velocity (direction) + - defined borders in the projection --> globals like window size, angle between "stelen", width of stelen, etc. + + if the particle hits a border + + + */ + + +} + + + + + + + + + + + + + + + + + + + diff --git a/particle.hpp b/particle.hpp new file mode 100644 index 0000000..9abe117 --- /dev/null +++ b/particle.hpp @@ -0,0 +1,56 @@ +// +// particle.hpp +// emptyExample +// +// Created by Sebastian Holzki on 16.04.19. +// + +#pragma once + +#include +#include "ofMain.h" +#include "attractor.hpp" + + + + +class Particle { + +public: + + Particle(); + ~Particle(); + + void setup(ofVec2f position); + void update(float deltaT, Attractor attractor); + void draw(); + + float getMaxLife(); + float getAge(); + float getAgeNorm(); + + + void mapParticle(); + bool borderCollission(); + + + + +private: + + ofVec2f velocity; + ofVec2f position; + + float maxLife; + float age; + float size; + float mass; + + ofColor color; + + + int stele; + //on which "stele" is the particle? --> will affect the movement (mapping), when it reaches borders of its "stele" ! + //if border 1/2/3/4 (<,>,v,^), then map particle + +}; diff --git a/particleSystem.hpp b/particleSystem.hpp new file mode 100644 index 0000000..e095681 --- /dev/null +++ b/particleSystem.hpp @@ -0,0 +1,73 @@ +// +// particleSystem.hpp +// emptyExample +// +// Created by Sebastian Holzki on 16.04.19. +// +#pragma once + + +#include + +#include "attractor.hpp" +#include "particle.hpp" +#include "emitter.hpp" + + +class ParticleSystem { + + ParticleSystem(); + ~ParticleSystem(); + +public: + + + void setup(); + void update(float deltaT, int playerType, bool attracted); + void draw(); + + + + /* + + Where do we make the quick setting-changes? + Like for exampe change direction of an emitter + its position? + --> XML? + + + */ + +private: + + vector particles; + vector attractors; + + vector emitters; + + //Maybe the emitter does not have to be an own class, but is more like a Vector of Positions, so in the system.back it will setup particles for every position that is saved in this Vector + //like following: + + //vector positionsToEmitFrom; + + + float birthcount; + bool attracted; + int playerType; + + + +}; + + + +/* + +class AttractedSystem : public ParticleSystem { + + + bool attracted = true; + +}; + + */ +