Compare commits

...

3 Commits

Author SHA1 Message Date
12c6ac1cad Dateien hochladen nach „“ 2019-05-02 10:42:39 +00:00
fc3f1be555 Dateien hochladen nach „“ 2019-05-02 10:42:24 +00:00
8c167b27a0 Dateien hochladen nach „“ 2019-05-02 10:41:52 +00:00
15 changed files with 1000 additions and 0 deletions

37
Emitter.cpp Normal file
View File

@ -0,0 +1,37 @@
//
// Emitter.cpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#pragma once
#include "Emitter.hpp"
Emitter::Emitter()
{
}
// -----------------------------------
Emitter::~Emitter()
{
}
// -----------------------------------
void Emitter::setEmitterPosition(ofVec2f _position){
position = _position;
}
// -----------------------------------------------

38
Emitter.hpp Normal file
View File

@ -0,0 +1,38 @@
//
// Emitter.hpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#pragma once
#include <stdio.h>
#include "ofMain.h"
class Emitter {
public:
Emitter();
~Emitter();
void setEmitterPosition(ofVec2f _position);
ofVec2f getEmitterPosition();
int getEmitterX();
int getEmitterY();
private:
bool emitting;
void emitParticles(ofVec2f _positionOfEmission, bool _emitting);
ofVec2f direction;
ofVec2f position;
};

55
attractor.cpp Normal file
View File

@ -0,0 +1,55 @@
//
// attractor.cpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once
#include "attractor.hpp"
Attractor::Attractor(){
}
// ------------------------------------
Attractor::~Attractor(){
}
// ------------------------------------
float Attractor::getX(){
return x;
}
// ------------------------------------
float Attractor::getY(){
return y;
}
// ------------------------------------
void Attractor::setX(float _x){
x = _x;
}
// ------------------------------------
void Attractor::setY(float _y){
y = _y;
}

35
attractor.hpp Normal file
View File

@ -0,0 +1,35 @@
//
// attractor.hpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once
#include <stdio.h>
class Attractor {
public:
Attractor();
~Attractor();
float getX();
float getY();
void setX(float x);
void setY(float y);
void updateCoordinates(float x, float y);
private:
float x;
float y;
};

99
avatar.cpp Normal file
View File

@ -0,0 +1,99 @@
//
// avatar.cpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#include "avatar.hpp"
Avatar::Avatar(int playerType){
setup(playerType);
}
// -----------------------------------------
Avatar::~Avatar(){
}
// -----------------------------------------
void Avatar::setup(int playerType){
//Load the right icon from data in ofImage, by using the transmitted info about the playerType
// --> icon = ....
}
// -----------------------------------------
void Avatar::update(){
}
// -----------------------------------------
void Avatar::draw(){
icon.draw(position);
}
// -----------------------------------------
ofVec2f Avatar::getPosition(){
return position;
}
// -----------------------------------------
void Avatar::setPosition(int _x, int _y){
position.x = _x;
position.y = _y;
}
void Avatar::setPosition(ofVec2f _position){
position = _position;
}
// -----------------------------------------
void Avatar::clipToAvatar(Avatar _avatar){
//Read coordinates to clip to:
ofVec2f tempCoords = _avatar.getPosition();
if( tempCoords.y == 0 ){
position.x = tempCoords.x + 20 ;
position.y = tempCoords.y + 20 ;
}else{
position.x = tempCoords.x + 20 ;
position.y = tempCoords.y - 20 ;
}
}

51
avatar.hpp Normal file
View File

@ -0,0 +1,51 @@
//
// avatar.hpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#pragma once
#include <stdio.h>
#include "ofMain.h"
class Avatar {
public:
Avatar(int playerType);
~Avatar();
void setup(int playerType);
// void update();
void draw();
void setPlayerType();
int getPlayerType();
ofVec2f getPosition();
void setPosition(int x, int y);
void setPosition(ofVec2f position);
void clipToAvatar(Avatar avatar); //A particular avatar can clip its position, depending on the position of another avatar, compared to a beehive-structure)
private:
ofImage icon;
int playerType;
ofVec2f position;
};

80
greatWhole.cpp Normal file
View File

@ -0,0 +1,80 @@
//
// greatWhole.cpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#include "greatWhole.hpp"
//#include "main.h"
GreatWhole::GreatWhole()
{
}
// -----------------------------------
GreatWhole::~GreatWhole()
{
}
// -----------------------------------
void GreatWhole::setup(){
}
// -----------------------------------------------
void GreatWhole::update(vector<Avatar*> avatars){
}
// -----------------------------------------------
void GreatWhole::draw(){
/*
draw the whole avatar vector
*/
}
// -----------------------------------------------
void GreatWhole::addAvatar(Avatar avatar){
avatars.push_back(avatar);
/*
Set coordinates in abhängigkeit vom letzten also bei avatars at (max-1)
*/
}

41
greatWhole.hpp Normal file
View File

@ -0,0 +1,41 @@
//
// greatWhole.hpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//
#include <stdio.h>
#include "ofMain.h"
#include "avatar.hpp"
#pragma once
/* Das Große Ganze beinhaltet eine unbestimmte Anzahl an bereits eingecheckten Personen, deren Infos in Avatare gespeichert werden.
Es bedarf eine setup(), update() und draw()-Methode. Dabei soll Platz für den vector<Avatar> geschaffen werden. In update wird eine
gewisse Bewegung der Avatar-"Bubbles" definiert. Draw zeichnet die Avatare auf die Stelen, also die entsprechenden Koordinaten. */
class GreatWhole {
public:
GreatWhole();
~GreatWhole();
void setup();
void update(vector<Avatar*> avatars);
void draw();
void addAvatar(Avatar avatar);
Avatar getAvatarAt(int i);
private:
vector<Avatar*> avatars;
};

15
main.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "ofMain.h"
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1000,1000, OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new ofApp());
}

146
ofApp.cpp Normal file
View File

@ -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){
}
//--------------------------------------------------------------

77
ofApp.h Normal file
View File

@ -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<ParticleSystem*> particleSystems;
GreatWhole dasGrosseGanze;
};

122
particle.cpp Normal file
View File

@ -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
*/
}

56
particle.hpp Normal file
View File

@ -0,0 +1,56 @@
//
// particle.hpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once
#include <stdio.h>
#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
};

75
particleSystem.cpp Normal file
View File

@ -0,0 +1,75 @@
//
// particleSystem.cpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once
#include "particleSystem.hpp"
ParticleSystem::ParticleSystem(){
}
// -----------------------------------
ParticleSystem::~ParticleSystem(){
}
// -----------------------------------
void ParticleSystem::setup(){
}
// -----------------------------------------------
void ParticleSystem::update(float deltaT, int visitorID, bool attracted){
/*
- wenn attracted, dann springe in Berechnung der Attraktion durch die vorhandenen Attraktoren
*/
/*
VisitorID stellt bekannten Besucher dar, also fertiges, auswertbares Profil.
visitorID steuert die Optik des Partikelsystems, aktiviert also eine Art Preset
z.B. Switch-Anweisung (visitorID 1-8):
case 0: default mode, attraction
case 1: load xml blabla1
case 2: load xml blabla2
...
*/
}
// -----------------------------------------------
void ParticleSystem::draw(){
/*
draw all the particles from the vector in the ParticleSystem
*/
}

73
particleSystem.hpp Normal file
View File

@ -0,0 +1,73 @@
//
// particleSystem.hpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once
#include <stdio.h>
#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<Particle*> particles;
vector<Attractor*> attractors;
vector<Emitter*> 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<Vec2f> positionsToEmitFrom;
float birthcount;
bool attracted;
int playerType;
};
/*
class AttractedSystem : public ParticleSystem {
bool attracted = true;
};
*/