Browse Source

initial commit

master
Sebastian Holzki 5 years ago
parent
commit
32a5a42233
18 changed files with 1443 additions and 0 deletions
  1. 63
    0
      .gitattributes
  2. 93
    0
      .gitignore
  3. BIN
      emptyExample.png
  4. 99
    0
      src/avatar.cpp
  5. 51
    0
      src/avatar.hpp
  6. 80
    0
      src/greatWhole.cpp
  7. 41
    0
      src/greatWhole.hpp
  8. 15
    0
      src/main.cpp
  9. 56
    0
      src/objectPhysics.cpp
  10. 96
    0
      src/objectPhysics.hpp
  11. 229
    0
      src/ofApp.cpp
  12. 83
    0
      src/ofApp.h
  13. 122
    0
      src/particle.cpp
  14. 54
    0
      src/particle.hpp
  15. 75
    0
      src/particleSystem.cpp
  16. 74
    0
      src/particleSystem.hpp
  17. 165
    0
      src/visitor.cpp
  18. 47
    0
      src/visitor.hpp

+ 63
- 0
.gitattributes View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

+ 93
- 0
.gitignore View File

@@ -0,0 +1,93 @@
###########################
# ignore generated binaries
# but not the data folder
###########################

/bin/*
!/bin/data/

#########
# general
#########

[Bb]uild/
[Oo]bj/
*.o
[Dd]ebug*/
[Rr]elease*/
*.mode*
*.app/
*.pyc
.svn/
*.log

########################
# IDE files which should
# be ignored
########################

# XCode
*.pbxuser
*.plist
*.DS_Store
*.Makefile
Project.xcconfig
*.make
/makefile
*.xcodeproj
*.perspective
*.perspectivev3
*.mode1v3
*.mode2v3
# XCode 4
xcuserdata
*.xcworkspace

# Code::Blocks
*.depend
*.layout

# Visual Studio
*.sdf
*.opensdf
*.suo
*.pdb
*.ilk
*.aps
*.make
*.sln
*.vcxproj
*.filters
*.rc
ipch/

# Eclipse
.metadata
local.properties
.externalToolBuilders

##################
# operating system
##################

# Linux
*~
# KDE
.directory
.AppleDouble

# OSX
.DS_Store
*.swp
*~.nib
# Thumbnails
._*

# Windows
# Image file caches
Thumbs.db
# Folder config file
Desktop.ini

# Android
.csettings

BIN
emptyExample.png View File


+ 99
- 0
src/avatar.cpp 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
- 0
src/avatar.hpp 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
- 0
src/greatWhole.cpp View File

@@ -0,0 +1,80 @@
//
// greatWhole.cpp
// emptyExample
//
// Created by Sebastian Holzki on 17.04.19.
//

#include "greatWhole.hpp"
#include "avatar.hpp"




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)
clip avatar dann an den letzten, y und x angepasst an x und y von avatars.at(max-1)
*/
}



+ 41
- 0
src/greatWhole.hpp 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
- 0
src/main.cpp 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());

}

+ 56
- 0
src/objectPhysics.cpp View File

@@ -0,0 +1,56 @@
//
// objectPhysics.cpp
// particle_combined
//
// Created by Sebastian Holzki on 11.06.19.
//

#include "objectPhysics.hpp"



ObjectPhysics::ObjectPhysics(){
cout<< "ObjectPhysics Konstruktor"<<endl;
emitting = 0;
attracting = 0;
};


// -----------------------------------

ObjectPhysics::~ObjectPhysics()
{
};

// -----------------------------------


Attraktor::Attraktor(){
};

// -----------------------------------











// -----------------------------------

Emitter::Emitter(){
};

// -----------------------------------

+ 96
- 0
src/objectPhysics.hpp View File

@@ -0,0 +1,96 @@
//
// objectPhysics.hpp
// emptyExample
//
// Created by Sebastian Holzki on 01.05.19.
//

#ifndef objectPhysics_hpp
#define objectPhysics_hpp

#include <stdio.h>
#include "ofMain.h"
#endif /* objectPhysics_hpp */


class ObjectPhysics {
public:
ObjectPhysics();
~ObjectPhysics();
protected:
ofVec2f position;
bool emitting;
bool attracting;
float force;
float vel;
};

// ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR *******

class Attraktor: public ObjectPhysics {
public:
Attraktor();
Attraktor(float x, float y);
~Attraktor();
// Attraktor(){
//
// emitting = false;
// attracting = true;
//
// cout << "Attraktor Konstruktor" << endl;
//
// };
//
// Attraktor(float x, float y){
//
// emitting = false;
// attracting = true;
//
// position.set(x,y);
//
// cout << "Attraktor Konstruktor überladen" << endl;
// };
//
//
//
// ~Attraktor(){
// cout << "Attraktor Destruktor" << endl;
// };
private:
};

// ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER *******

class Emitter: public ObjectPhysics {
public:
// Emitter(){
//
// emitting = true;
// attracting = false;
//
// };
Emitter();
~Emitter();
private:
};


+ 229
- 0
src/ofApp.cpp View File

@@ -0,0 +1,229 @@

#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){

}

//--------------------------------------------------------------




+ 83
- 0
src/ofApp.h View File

@@ -0,0 +1,83 @@
#pragma once

#include "ofMain.h"
#include "particleSystem.hpp"
#include "greatWhole.hpp"
#include "avatar.hpp"
#include "ofxOsc.h"
#include "visitor.hpp"
#include "objectPhysics.hpp"
#include "particle.hpp"

int WINDOWSIZE_WIDTH = 1000;
int WINDOWSIZE_HEIGHT = 1000;




// *** 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);
int PARTICLE_COUNT;
//+1 for every new Particle, -1 for every Particle that gets older than the defined maxLife
int VISITOR_COUNT;
//the visitor count will be fed with the nBlobs-value from incoming OSC messages
int VISITOR_COUNT_LASTFRAME;


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<Visitor*> visitors;
vector<ParticleSystem*> particleSystems;
GreatWhole dasGrosseGanze;
};




+ 122
- 0
src/particle.cpp View File

@@ -0,0 +1,122 @@
//
// particle.cpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//

#include "particle.hpp"



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


// -----------------------------------

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




















+ 54
- 0
src/particle.hpp View File

@@ -0,0 +1,54 @@
//
// particle.hpp
//
// Created by Sebastian Holzki on 16.04.19.
//

#pragma once
#include <stdio.h>
#include "ofMain.h"





class Particle {
public:
Particle();
~Particle();
void setup(ofVec2f position);
void update(float deltaT);
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
- 0
src/particleSystem.cpp View File

@@ -0,0 +1,75 @@
//
// particleSystem.cpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//

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

+ 74
- 0
src/particleSystem.hpp View File

@@ -0,0 +1,74 @@
//
// particleSystem.hpp
// emptyExample
//
// Created by Sebastian Holzki on 16.04.19.
//
#pragma once


#include <stdio.h>


#include "particle.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;
//adresses of the active emitters and attractors
// 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;
};

*/


+ 165
- 0
src/visitor.cpp View File

@@ -0,0 +1,165 @@
//
// visitor.cpp
// particle_combined
//
// Created by Sebastian Holzki on 11.06.19.
//

#include "visitor.hpp"



Visitor::Visitor()
{
}

// -----------------------------------

Visitor::~Visitor()
{
}

// -----------------------------------



void Visitor::setup(){
}

// -----------------------------------------------


void Visitor::setup(float _x, float _y){
position.x = _x;
position.y = _y;
}

// -----------------------------------------------


void Visitor::update(){
}

// -----------------------------------------------


void Visitor::draw(){
}
// -----------------------------------------------
ofVec2f Visitor::getPosition(){
return position;
}

// -----------------------------------------------
float Visitor::getX(){
return position.x;
}
// -----------------------------------------------
float Visitor::getY(){
return position.y;
}
// -----------------------------------------------
void Visitor::setPosition(float _x, float _y){
position.x = _x;
position.y = _y;
}


// -----------------------------------------------


void Visitor::setPosition(ofVec2f _position){
position = _position;
}
// -----------------------------------------------


void Visitor::setX(float _x){
position.x = _x;
}



// -----------------------------------------------


void Visitor::setY(float _y){
position.y = _y;
}

































+ 47
- 0
src/visitor.hpp View File

@@ -0,0 +1,47 @@
//
// visitor.hpp
// particle_combined
//
// Created by Sebastian Holzki on 11.06.19.
//


#pragma once
#include <stdio.h>
#include "ofMain.h"




class Visitor {
public:
Visitor();
~Visitor();
void setup();
void setup(float _x, float _y);
void update();
void draw();
//GETTERS
ofVec2f getPosition();
float getX();
float getY();
//SETTERS
void setPosition(float x, float y);
void setPosition(ofVec2f position);
void setX(float _x);
void setY(float _y);
private:
ofVec2f position;
};

Loading…
Cancel
Save