Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d39300f3fc | ||
|
|
ef4081e6aa | ||
|
|
2de83d53d3 | ||
|
|
bf0e1d9b79 | ||
|
|
38e2337fb3 | ||
|
|
e9ab023a7f | ||
|
|
24a1659a2c | ||
|
|
b21b3ad635 | ||
|
|
4a1ff0dbb0 | ||
|
|
97391a42af | ||
|
|
593471a901 | ||
|
|
d0c0781a0c | ||
|
|
86a0b94155 |
@@ -1,3 +1,4 @@
|
|||||||
ofxGui
|
|
||||||
ofxOsc
|
ofxOsc
|
||||||
ofxVectorGraphics
|
ofxXmlSettings
|
||||||
|
ofxWarp
|
||||||
|
ofxSecondWindow
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,16 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
in vec2 vTexCoord;
|
||||||
|
in vec4 vColor;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec2 uv = vTexCoord * 2.0 - 1.0;
|
||||||
|
float d = dot(uv, uv);
|
||||||
|
float rim = smoothstep(0.7, 0.8, d);
|
||||||
|
rim += smoothstep(0.3, 0.4, d) - smoothstep(0.5, 0.6, d);
|
||||||
|
rim += smoothstep(0.1, 0.0, d);
|
||||||
|
fragColor = mix(vec4( 0.0, 0.0, 0.0, 0.25), vColor, rim);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
// OF default uniforms and attributes
|
||||||
|
uniform mat4 modelViewProjectionMatrix;
|
||||||
|
uniform vec4 globalColor;
|
||||||
|
|
||||||
|
in vec4 position;
|
||||||
|
in vec2 texcoord;
|
||||||
|
in vec4 color;
|
||||||
|
|
||||||
|
// App uniforms and attributes
|
||||||
|
in vec4 iPositionScale;
|
||||||
|
in vec4 iColor;
|
||||||
|
|
||||||
|
out vec2 vTexCoord;
|
||||||
|
out vec4 vColor;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vTexCoord = texcoord;
|
||||||
|
vColor = globalColor * iColor;
|
||||||
|
gl_Position = modelViewProjectionMatrix * vec4(position.xy * iPositionScale.z + iPositionScale.xy, position.zw);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
uniform sampler2D uTexture;
|
||||||
|
uniform vec4 uExtends;
|
||||||
|
uniform vec3 uLuminance;
|
||||||
|
uniform vec3 uGamma;
|
||||||
|
uniform vec4 uEdges;
|
||||||
|
uniform vec4 uCorners;
|
||||||
|
uniform float uExponent;
|
||||||
|
uniform bool uEditing;
|
||||||
|
|
||||||
|
in vec2 vTexCoord;
|
||||||
|
in vec4 vColor;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
float map(in float value, in float inMin, in float inMax, in float outMin, in float outMax)
|
||||||
|
{
|
||||||
|
return outMin + (outMax - outMin) * (value - inMin) / (inMax - inMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
float grid(in vec2 uv, in vec2 size)
|
||||||
|
{
|
||||||
|
vec2 coord = uv / size;
|
||||||
|
vec2 grid = abs(fract(coord - 0.5) - 0.5) / (2.0 * fwidth(coord));
|
||||||
|
float line = min(grid.x, grid.y);
|
||||||
|
return 1.0 - min(line, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec4 texColor = texture(uTexture, vTexCoord);
|
||||||
|
|
||||||
|
vec2 mapCoord = vec2(map(vTexCoord.x, uCorners.x, uCorners.z, 0.0, 1.0), map(vTexCoord.y, uCorners.y, uCorners.w, 0.0, 1.0));
|
||||||
|
|
||||||
|
float a = 1.0;
|
||||||
|
if (uEdges.x > 0.0) a *= clamp(mapCoord.x / uEdges.x, 0.0, 1.0);
|
||||||
|
if (uEdges.y > 0.0) a *= clamp(mapCoord.y / uEdges.y, 0.0, 1.0);
|
||||||
|
if (uEdges.z > 0.0) a *= clamp((1.0 - mapCoord.x) / uEdges.z, 0.0, 1.0);
|
||||||
|
if (uEdges.w > 0.0) a *= clamp((1.0 - mapCoord.y) / uEdges.w, 0.0, 1.0);
|
||||||
|
|
||||||
|
const vec3 one = vec3(1.0);
|
||||||
|
vec3 blend = (a < 0.5) ? (uLuminance * pow(2.0 * a, uExponent)) : one - (one - uLuminance) * pow(2.0 * (1.0 - a), uExponent);
|
||||||
|
|
||||||
|
texColor.rgb *= pow(blend, one / uGamma);
|
||||||
|
|
||||||
|
if (uEditing)
|
||||||
|
{
|
||||||
|
float f = grid(mapCoord.xy * uExtends.xy, uExtends.zw);
|
||||||
|
vec4 gridColor = vec4(1.0f);
|
||||||
|
fragColor = mix(texColor * vColor, gridColor, f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fragColor = texColor * vColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
// OF default uniforms and attributes
|
||||||
|
uniform mat4 modelViewProjectionMatrix;
|
||||||
|
uniform vec4 globalColor;
|
||||||
|
|
||||||
|
in vec4 position;
|
||||||
|
in vec2 texcoord;
|
||||||
|
in vec4 color;
|
||||||
|
|
||||||
|
// App uniforms and attributes
|
||||||
|
out vec2 vTexCoord;
|
||||||
|
out vec4 vColor;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vTexCoord = texcoord;
|
||||||
|
vColor = globalColor;
|
||||||
|
|
||||||
|
gl_Position = modelViewProjectionMatrix * position;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
uniform sampler2D uTexture;
|
||||||
|
uniform vec3 uLuminance;
|
||||||
|
uniform vec3 uGamma;
|
||||||
|
uniform vec4 uEdges;
|
||||||
|
uniform vec4 uCorners;
|
||||||
|
uniform float uExponent;
|
||||||
|
|
||||||
|
in vec2 vTexCoord;
|
||||||
|
in vec4 vColor;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
float map(in float value, in float inMin, in float inMax, in float outMin, in float outMax)
|
||||||
|
{
|
||||||
|
return outMin + (outMax - outMin) * (value - inMin) / (inMax - inMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec4 texColor = texture(uTexture, vTexCoord);
|
||||||
|
|
||||||
|
vec2 mapCoord = vec2(map(vTexCoord.x, uCorners.x, uCorners.z, 0.0, 1.0), map(vTexCoord.y, uCorners.y, uCorners.w, 0.0, 1.0));
|
||||||
|
|
||||||
|
float a = 1.0;
|
||||||
|
if (uEdges.x > 0.0) a *= clamp(mapCoord.x / uEdges.x, 0.0, 1.0);
|
||||||
|
if (uEdges.y > 0.0) a *= clamp(mapCoord.y / uEdges.y, 0.0, 1.0);
|
||||||
|
if (uEdges.z > 0.0) a *= clamp((1.0 - mapCoord.x) / uEdges.z, 0.0, 1.0);
|
||||||
|
if (uEdges.w > 0.0) a *= clamp((1.0 - mapCoord.y) / uEdges.w, 0.0, 1.0);
|
||||||
|
|
||||||
|
const vec3 one = vec3(1.0);
|
||||||
|
vec3 blend = (a < 0.5) ? (uLuminance * pow(2.0 * a, uExponent)) : one - (one - uLuminance) * pow(2.0 * (1.0 - a), uExponent);
|
||||||
|
|
||||||
|
texColor.rgb *= pow(blend, one / uGamma);
|
||||||
|
|
||||||
|
fragColor = texColor * vColor;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#version 150
|
||||||
|
|
||||||
|
// OF default uniforms and attributes
|
||||||
|
uniform mat4 modelViewProjectionMatrix;
|
||||||
|
uniform vec4 globalColor;
|
||||||
|
|
||||||
|
in vec4 position;
|
||||||
|
in vec2 texcoord;
|
||||||
|
in vec4 color;
|
||||||
|
|
||||||
|
// App uniforms and attributes
|
||||||
|
out vec2 vTexCoord;
|
||||||
|
out vec4 vColor;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vTexCoord = texcoord;
|
||||||
|
vColor = globalColor;
|
||||||
|
|
||||||
|
gl_Position = modelViewProjectionMatrix * position;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<default>
|
||||||
|
<sizeMin>0.05</sizeMin>
|
||||||
|
<sizeMax>4</sizeMax>
|
||||||
|
<mass>100</mass>
|
||||||
|
<drag>0</drag>
|
||||||
|
<maxLife>10</maxLife>
|
||||||
|
<velMin>-80</velMin>
|
||||||
|
<velMax>80</velMax>
|
||||||
|
<color></color>
|
||||||
|
</default>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<default>
|
||||||
|
<attracted>true</attracted>
|
||||||
|
<playertype>0</playertype>
|
||||||
|
</default>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<default>
|
||||||
|
<sizeMin>0.05</sizeMin>
|
||||||
|
<sizeMax>4</sizeMax>
|
||||||
|
<mass>100</mass>
|
||||||
|
<drag>0</drag>
|
||||||
|
<maxLife>10</maxLife>
|
||||||
|
<velMin>-80</velMin>
|
||||||
|
<velMax>80</velMax>
|
||||||
|
<color></color>
|
||||||
|
</default>
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<! XML for particles depending on the active mode >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<default>
|
||||||
|
|
||||||
|
<size></size>
|
||||||
|
|
||||||
|
<color></color>
|
||||||
|
|
||||||
|
<age></age>
|
||||||
|
|
||||||
|
<maxLife></maxLife>
|
||||||
|
|
||||||
|
<mass></mass>
|
||||||
|
|
||||||
|
<velocity></velocity>
|
||||||
|
|
||||||
|
<position></position>
|
||||||
|
|
||||||
|
<transparency></transparency>
|
||||||
|
|
||||||
|
<floor></floor>
|
||||||
|
|
||||||
|
<stelen></stelen>
|
||||||
|
|
||||||
|
<aging>true</aging>
|
||||||
|
|
||||||
|
</default>
|
||||||
|
|
||||||
|
|
||||||
|
<! ----------------------------------------- >
|
||||||
|
|
||||||
|
|
||||||
|
<polymesh>
|
||||||
|
|
||||||
|
<size></size>
|
||||||
|
<color></color>
|
||||||
|
<age></age>
|
||||||
|
<maxLife></maxLife>
|
||||||
|
<mass></mass>
|
||||||
|
<velocity></velocity>
|
||||||
|
<position></position>
|
||||||
|
<transparency></transparency>
|
||||||
|
<floor></floor>
|
||||||
|
<stelen></stelen>
|
||||||
|
<aging>false</aging>
|
||||||
|
|
||||||
|
</polymesh>
|
||||||
|
|
||||||
|
|
||||||
|
<! ----------------------------------------- >
|
||||||
|
|
||||||
|
|
||||||
|
<rfid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</rfid>
|
||||||
|
|
||||||
|
|
||||||
|
<! ----------------------------------------- >
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<! XML for particleSystems, depending on the active mode >
|
||||||
|
|
||||||
|
|
||||||
|
<default>
|
||||||
|
|
||||||
|
<birthrate>4</birthrate>
|
||||||
|
<display>true</display>
|
||||||
|
<connectParticles>false</connectParticles>
|
||||||
|
<playerType>0</playerType>
|
||||||
|
|
||||||
|
</default>
|
||||||
|
|
||||||
|
|
||||||
|
<! ------------------------------------- >
|
||||||
|
|
||||||
|
|
||||||
|
<polymesh>
|
||||||
|
|
||||||
|
<birthrate>0</birthrate>
|
||||||
|
<display>true</display>
|
||||||
|
<connectParticles>false</connectParticles>
|
||||||
|
<playerType>0</playerType>
|
||||||
|
|
||||||
|
</polymesh>
|
||||||
|
|
||||||
|
|
||||||
|
<! ------------------------------------- >
|
||||||
|
|
||||||
|
|
||||||
|
<rfid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</rfid>
|
||||||
|
|
||||||
|
|
||||||
|
<! ------------------------------------- >
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<default>
|
||||||
|
<sizeMin>0.05</sizeMin>
|
||||||
|
<sizeMax>4</sizeMax>
|
||||||
|
<mass>100</mass>
|
||||||
|
<drag>0</drag>
|
||||||
|
<maxLife>10</maxLife>
|
||||||
|
<velMin>-80</velMin>
|
||||||
|
<velMax>80</velMax>
|
||||||
|
<color></color>
|
||||||
|
</default>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<default>
|
||||||
|
<sizeMin>0.05</sizeMin>
|
||||||
|
<sizeMax>4</sizeMax>
|
||||||
|
<mass>100</mass>
|
||||||
|
<drag>0</drag>
|
||||||
|
<maxLife>10</maxLife>
|
||||||
|
<velMin>-80</velMin>
|
||||||
|
<velMax>80</velMax>
|
||||||
|
<color></color>
|
||||||
|
</default>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<setupSquare>
|
||||||
|
<center>
|
||||||
|
<x>0.5</x>
|
||||||
|
<y>0.5</y>
|
||||||
|
</center>
|
||||||
|
<stele1>
|
||||||
|
<x>0.5</x>
|
||||||
|
<y>0.28</y>
|
||||||
|
</stele1>
|
||||||
|
<stele2>
|
||||||
|
<x>0.6905</x>
|
||||||
|
<y>0.39</y>
|
||||||
|
</stele2>
|
||||||
|
<stele3>
|
||||||
|
<x>0.6905</x>
|
||||||
|
<y>0.61</y>
|
||||||
|
</stele3>
|
||||||
|
<stele4>
|
||||||
|
<x>0.5</x>
|
||||||
|
<y>0.72</y>
|
||||||
|
</stele4>
|
||||||
|
<stele5>
|
||||||
|
<x>0.3095</x>
|
||||||
|
<y>0.61</y>
|
||||||
|
</stele5>
|
||||||
|
<stele6>
|
||||||
|
<x>0.3095</x>
|
||||||
|
<y>0.39</y>
|
||||||
|
</stele6>
|
||||||
|
</setupSquare>
|
||||||
|
<setup>
|
||||||
|
<center>
|
||||||
|
<x>0.5</x>
|
||||||
|
<y>0.5</y>
|
||||||
|
</center>
|
||||||
|
<stele1>
|
||||||
|
<x>0.25</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</stele1>
|
||||||
|
<stele2>
|
||||||
|
<x>0.46650635</x>
|
||||||
|
<y>0.125</y>
|
||||||
|
</stele2>
|
||||||
|
<stele3>
|
||||||
|
<x>0.46650635</x>
|
||||||
|
<y>0.375</y>
|
||||||
|
</stele3>
|
||||||
|
<stele4>
|
||||||
|
<x>0.25</x>
|
||||||
|
<y>0.5</y>
|
||||||
|
</stele4>
|
||||||
|
<stele5>
|
||||||
|
<x>0.03349375</x>
|
||||||
|
<y>0.375</y>
|
||||||
|
</stele5>
|
||||||
|
<stele6>
|
||||||
|
<x>0.03349375</x>
|
||||||
|
<y>0.125</y>
|
||||||
|
</stele6>
|
||||||
|
</setup>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// XML_information.cpp
|
||||||
|
// Projekt_FORUM
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 14.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "XML_information.hpp"
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// XML_information.hpp
|
||||||
|
// Projekt_FORUM
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 14.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofxXmlSettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class XML_information {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//ofxXmlSettings xmlParticleSystems;
|
||||||
|
//ofxXmlSettings xmlParticles; // ??? wo soll das hin ???
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,409 @@
|
|||||||
|
//
|
||||||
|
// checkedInVisitor.cpp
|
||||||
|
// Projekt_FORUM
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 19.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "checkedInVisitor.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckedInVisitor::CheckedInVisitor(){
|
||||||
|
|
||||||
|
started = false;
|
||||||
|
xVelocityMax = 1.5000;
|
||||||
|
age = 0;
|
||||||
|
setupInOfAppIsFinished = false;
|
||||||
|
startingAnimationIsFinished = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckedInVisitor::~CheckedInVisitor(){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void CheckedInVisitor::setup(int _playerType, int _checkedInStele, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
//Everytime a visitor checks in, we will generate a "CheckedInVisitor".
|
||||||
|
//Depending, what playerType checked in, a different image will be loaded into ofImage imageOfType, representing the playerType.
|
||||||
|
//We also scale and set the default color here. Later we might be able to also pass the "greatWhole" information about the currentMode of the system,
|
||||||
|
//so we can play around with the CheckedInVisitors as well.
|
||||||
|
|
||||||
|
k1 = ofRandom(0.3,0.5); // random value for k1*sin(...)+...
|
||||||
|
k2 = ofRandom(0.3,1.2); // random value for ...*sin(k2*age)+....
|
||||||
|
k3 = ofRandom(0.8, 1.2);
|
||||||
|
|
||||||
|
checkedInStele = _checkedInStele;
|
||||||
|
playerType = _playerType;
|
||||||
|
|
||||||
|
|
||||||
|
switch ( playerType ){
|
||||||
|
|
||||||
|
case 1: {
|
||||||
|
|
||||||
|
imageOfType.load("images/image1_color.png");
|
||||||
|
hexagon.load("images/hexagon_1.png");
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2: {
|
||||||
|
|
||||||
|
imageOfType.load("images/image2_color.png");
|
||||||
|
hexagon.load("images/hexagon_2.png");
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case 3: {
|
||||||
|
|
||||||
|
imageOfType.load("images/image3_color.png");
|
||||||
|
hexagon.load("images/hexagon_3.png");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case 4: {
|
||||||
|
|
||||||
|
imageOfType.load("images/image4_color.png");
|
||||||
|
hexagon.load("images/hexagon_4.png");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
imageOfType.load("images/noplayertype.png");
|
||||||
|
|
||||||
|
} //end of switch
|
||||||
|
|
||||||
|
setupPosition(sceneWidth, sceneHeight, checkedInStele);
|
||||||
|
|
||||||
|
|
||||||
|
imageOfType.resize(imageOfType.getWidth()*0.5, imageOfType.getHeight()*0.5);
|
||||||
|
hexagon.resize(hexagon.getWidth()*0.5, hexagon.getHeight()*0.5);
|
||||||
|
// pixelsWithValues(sceneWidth, sceneHeight, hexagon);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void CheckedInVisitor::update(float deltaT, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
aging(deltaT);
|
||||||
|
move(deltaT, sceneWidth, sceneHeight);
|
||||||
|
|
||||||
|
if(age > 3 && started == false){
|
||||||
|
|
||||||
|
setupVelocity();
|
||||||
|
started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateAttractingPixels();
|
||||||
|
|
||||||
|
positionLastFrame = position;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::draw(){
|
||||||
|
|
||||||
|
ofSetColor(255,255,255);
|
||||||
|
imageOfType.draw(position);
|
||||||
|
hexagon.draw(position);
|
||||||
|
if(attractingPixelsOfHexagon.size()){
|
||||||
|
ofDrawBitmapString(ofToString(attractingPixelsOfHexagon.at(0).x), position.x, position.y - 20);
|
||||||
|
ofDrawBitmapString(ofToString(position.x), position.x, position.y - 40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
ofVec2f CheckedInVisitor::getPosition(){
|
||||||
|
|
||||||
|
return position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
ofVec2f CheckedInVisitor::getBottom(){
|
||||||
|
|
||||||
|
ofVec2f bottom = this->position;
|
||||||
|
bottom.x += hexagon.getWidth()/2;
|
||||||
|
bottom.y += hexagon.getHeight()*0.99;
|
||||||
|
|
||||||
|
return bottom;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::aging(float deltaT){
|
||||||
|
|
||||||
|
|
||||||
|
age += deltaT;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
vector<ofVec2f> CheckedInVisitor::getPositionsOfAttractingPixels(){
|
||||||
|
|
||||||
|
return attractingPixelsOfHexagon;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
bool CheckedInVisitor::getIfEmitterIsDeleted(){
|
||||||
|
|
||||||
|
return emitterHasBeenDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::updateAttractingPixels(){
|
||||||
|
|
||||||
|
float differenceX = positionLastFrame.x - position.x;
|
||||||
|
float differenceY = positionLastFrame.y - position.y;
|
||||||
|
|
||||||
|
for(int i = 0; i < attractingPixelsOfHexagon.size(); i++){
|
||||||
|
|
||||||
|
attractingPixelsOfHexagon.at(i).x -= differenceX;
|
||||||
|
attractingPixelsOfHexagon.at(i).y -= differenceY;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::pixelsWithValues(float sceneWidth, float sceneHeight, ofImage _hexagon){
|
||||||
|
|
||||||
|
int hexagonWidth = _hexagon.getWidth();
|
||||||
|
int hexagonHeight = _hexagon.getHeight();
|
||||||
|
|
||||||
|
ofPixels pixels;
|
||||||
|
pixels = hexagon.getPixels();
|
||||||
|
|
||||||
|
int counter = 11;
|
||||||
|
// Iterate trough the pixels, skip 3 do 1 because only 1 channel is needed
|
||||||
|
for(int i = 3; i <= pixels.size(); i+=4){
|
||||||
|
|
||||||
|
if(pixels[i] > 0){ //if the pixel has a value jump into saving it
|
||||||
|
|
||||||
|
int width = pixels.getWidth();
|
||||||
|
|
||||||
|
int y = i / 4 / width ;
|
||||||
|
|
||||||
|
int x = i / 4 % width ;
|
||||||
|
|
||||||
|
ofVec2f pixelPosition;
|
||||||
|
pixelPosition.set(position.x + x, position.y + y);
|
||||||
|
|
||||||
|
if(counter > 10){
|
||||||
|
attractingPixelsOfHexagon.push_back(pixelPosition);
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::setupPosition(int sceneWidth, int sceneHeight, int checkedInStele){
|
||||||
|
|
||||||
|
|
||||||
|
position.y = sceneHeight - imageOfType.getHeight()/2;
|
||||||
|
|
||||||
|
position.x = sceneHeight + ((sceneWidth - sceneHeight)/6)*(checkedInStele - 1); //Hinter Kreis + 1/2 Stele
|
||||||
|
position.x += (sceneWidth - sceneHeight)/12 - imageOfType.getWidth()/4;
|
||||||
|
|
||||||
|
positionLastFrame = position;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::setupCornerPositions(float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
//save the corners of the generated hexagon as positions into an array
|
||||||
|
|
||||||
|
//try with ofCircles
|
||||||
|
ofSetColor(255,0,0);
|
||||||
|
ofDrawCircle(position.x + hexagon.getWidth()/4, position.y, 10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// attractingPixelsOfHexagon.push_back(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::setPosition(ofVec2f _position){
|
||||||
|
|
||||||
|
position = _position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::setStateOfSetup(bool stateToSet){
|
||||||
|
|
||||||
|
setupInOfAppIsFinished = stateToSet;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
bool CheckedInVisitor::getStateOfSetup(){
|
||||||
|
|
||||||
|
return setupInOfAppIsFinished;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::move(float deltaT, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
int startingSpeed = 65;
|
||||||
|
|
||||||
|
if(startingAnimationIsFinished != true){
|
||||||
|
startingAnimation(startingSpeed, sceneWidth, sceneHeight);
|
||||||
|
position += velocity * startingSpeed * deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startingAnimationIsFinished == true){
|
||||||
|
position.y += k1*sin(age*k2);
|
||||||
|
position += velocity * startingSpeed * deltaT * k3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//jump from right to left
|
||||||
|
if(position.x > (sceneWidth - (sceneWidth - 0.5*sceneHeight)/36 )){
|
||||||
|
position.x = sceneHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::startingAnimation(float startingSpeed, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
if(position.y < sceneHeight*0.4){
|
||||||
|
|
||||||
|
velocity.y *= 0.99 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(position.y < sceneHeight*0.4 && startedMovingToTheRight == false){
|
||||||
|
|
||||||
|
velocity.x = 0.1;
|
||||||
|
startedMovingToTheRight = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(velocity.x < xVelocityMax){
|
||||||
|
|
||||||
|
velocity.x *= 1.02;
|
||||||
|
|
||||||
|
}
|
||||||
|
if( (((xVelocityMax - velocity.x) < 0.0001)) && ((velocity.y < 0.0001)) ){
|
||||||
|
velocity.x = xVelocityMax;
|
||||||
|
velocity.y = 0;
|
||||||
|
startingAnimationIsFinished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void CheckedInVisitor::setupVelocity(){
|
||||||
|
|
||||||
|
velocity.set(0.0, -2.0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
float CheckedInVisitor::getAge(){
|
||||||
|
|
||||||
|
return age;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
void CheckedInVisitor::clipToLastCheckedInVisitor(CheckedInVisitor _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 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
//
|
||||||
|
// checkedInVisitor.hpp
|
||||||
|
// Projekt_FORUM
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 19.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ofMain.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CheckedInVisitor {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
CheckedInVisitor();
|
||||||
|
~CheckedInVisitor();
|
||||||
|
|
||||||
|
void setup(int playerType, int checkedInStele, float sceneWidth, float sceneHeight);
|
||||||
|
void update(float deltaT, float sceneWidth, float sceneHeight);
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
void setupVelocity();
|
||||||
|
void setupPosition(int x, int y, int checkedInStele);
|
||||||
|
void setPosition(ofVec2f position);
|
||||||
|
ofVec2f getPosition();
|
||||||
|
ofVec2f getBottom();
|
||||||
|
|
||||||
|
void fillAttractingPixelsVector(float sceneWidth, float sceneHeight);
|
||||||
|
void pixelsWithValues(float sceneWidth, float sceneHeight, ofImage hexagon);
|
||||||
|
void updateAttractingPixels();
|
||||||
|
|
||||||
|
|
||||||
|
vector<ofVec2f>getPositionsOfAttractingPixels();
|
||||||
|
void setupCornerPositions(float sceneWidth, float sceneHeight);
|
||||||
|
|
||||||
|
void setStateOfSetup(bool setupFinished);
|
||||||
|
bool getStateOfSetup();
|
||||||
|
|
||||||
|
//Every CheckedInVisitor creates an Emitter for his starting Animation
|
||||||
|
//Following methods will help to not get any bad access errors when emitting
|
||||||
|
// from new attractors and not doing it from older ones
|
||||||
|
bool getIfEmitterIsDeleted();
|
||||||
|
void setIfEmitterIsDeleted(bool isDeleted);
|
||||||
|
|
||||||
|
void setPlayerType();
|
||||||
|
int getPlayerType();
|
||||||
|
|
||||||
|
void startingAnimation(float startingSpeed, float sceneWidth, float sceneHeight);
|
||||||
|
void move(float deltaT, float sceneWidth, float sceneHeight);
|
||||||
|
void aging(float deltaT);
|
||||||
|
float getAge();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void clipToLastCheckedInVisitor(CheckedInVisitor visitor); //A particular "image" can clip its position, depending on the position of the last
|
||||||
|
|
||||||
|
|
||||||
|
ofImage imageOfType;
|
||||||
|
ofImage hexagon;
|
||||||
|
vector<ofVec2f> attractingPixelsOfHexagon;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
int checkedInStele;
|
||||||
|
int playerType;
|
||||||
|
ofVec2f position;
|
||||||
|
ofVec2f positionLastFrame;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ofVec2f velocity;
|
||||||
|
float xVelocityMax;
|
||||||
|
|
||||||
|
bool started;
|
||||||
|
bool startedMovingToTheRight;
|
||||||
|
bool setupInOfAppIsFinished;
|
||||||
|
bool startingAnimationIsFinished;
|
||||||
|
bool emitterHasBeenDeleted;
|
||||||
|
|
||||||
|
|
||||||
|
//Random values between 0.0 and 1.0
|
||||||
|
float k1;
|
||||||
|
float k2;
|
||||||
|
float k3;
|
||||||
|
|
||||||
|
float age;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
//
|
||||||
|
// greatWhole.cpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 17.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "greatWhole.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GreatWhole::GreatWhole()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
GreatWhole::~GreatWhole()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GreatWhole::setup(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void GreatWhole::update(vector<CheckedInVisitor*> checkedInVisitors){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void GreatWhole::draw(){
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
draw the whole avatar vector
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void GreatWhole::addCheckedInVisitor(CheckedInVisitor checkedInVisitors){
|
||||||
|
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
//
|
||||||
|
// greatWhole.hpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 17.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofMain.h"
|
||||||
|
#include "checkedInVisitor.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<CheckedInVisitor*> checkedInVisitors);
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
void addCheckedInVisitor(CheckedInVisitor checkedInVisitors);
|
||||||
|
CheckedInVisitor getCheckedInVisitorAt(int i);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
vector<CheckedInVisitor*> checkedInVisitors;
|
||||||
|
int rows;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
@@ -1,10 +1,21 @@
|
|||||||
|
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
#include "ofApp.h"
|
#include "ofApp.h"
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
int main() {
|
int main( ){
|
||||||
ofSetupOpenGL(1000, 1000, OF_WINDOW); // <-------- setup the GL context
|
|
||||||
ofRunApp(new ofApp());
|
|
||||||
}
|
|
||||||
|
|
||||||
//hahahahahahahahha
|
//ofSetupOpenGL(3840,1200, OF_WINDOW); // <-------- setup the GL context
|
||||||
|
|
||||||
|
ofGLFWWindowSettings settings;
|
||||||
|
settings.setGLVersion(3, 2);
|
||||||
|
settings.setSize(3840, 1200);
|
||||||
|
settings.decorated = false;
|
||||||
|
ofCreateWindow(settings);
|
||||||
|
|
||||||
|
// this kicks off the running of my app
|
||||||
|
// can be OF_WINDOW or OF_FULLSCREEN
|
||||||
|
// pass in width and height too:
|
||||||
|
ofRunApp( new ofApp());
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,337 @@
|
|||||||
|
//
|
||||||
|
// objectPhysics.cpp
|
||||||
|
// particle_combined
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 11.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ObjectPhysics::ObjectPhysics(){
|
||||||
|
|
||||||
|
emitting = 0;
|
||||||
|
attracting = 0;
|
||||||
|
isAVisitorObject = false;
|
||||||
|
age = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
ObjectPhysics::~ObjectPhysics()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ObjectPhysics::update(float deltaT){
|
||||||
|
|
||||||
|
aging(deltaT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ObjectPhysics::setPosition(float x, float y){
|
||||||
|
|
||||||
|
position.set(x,y);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
void ObjectPhysics::setPosition(ofVec2f _position){
|
||||||
|
|
||||||
|
position = _position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
ofVec2f ObjectPhysics::getPosition(){
|
||||||
|
|
||||||
|
return position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
float ObjectPhysics::getAge(){
|
||||||
|
|
||||||
|
return age;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
void ObjectPhysics::setIsVisitor(bool isVisitor){
|
||||||
|
|
||||||
|
isAVisitorObject = isVisitor;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
bool ObjectPhysics::getIsVisitorObject(){
|
||||||
|
|
||||||
|
return isAVisitorObject;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
void ObjectPhysics::setEmitting(bool _emitting){
|
||||||
|
|
||||||
|
emitting = _emitting;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
void ObjectPhysics::setAttracting(bool _attracting){
|
||||||
|
|
||||||
|
attracting = _attracting;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ObjectPhysics::aging(float deltaT){
|
||||||
|
|
||||||
|
if(agingEnabled){
|
||||||
|
age += deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// *** ATTRAKTORS *** ATTRAKTORS *** ATTRAKTORS *** ATTRAKTORS ***
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Attraktor::Attraktor(){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
agingEnabled = false;
|
||||||
|
|
||||||
|
type = "attraktor";
|
||||||
|
|
||||||
|
cout << "Attraktor Konstruktor" << endl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Attraktor::Attraktor(float x, float y){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
|
||||||
|
type = "attraktor";
|
||||||
|
|
||||||
|
position.set(x,y);
|
||||||
|
|
||||||
|
cout << "Attraktor Konstruktor überladen" << endl;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Attraktor::Attraktor(ofVec2f _position){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
|
||||||
|
type = "attraktor";
|
||||||
|
|
||||||
|
position.set(_position);
|
||||||
|
|
||||||
|
// cout << "Attraktor Konstruktor überladen (ofVec2f position)" << endl;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Attraktor::~Attraktor(){
|
||||||
|
|
||||||
|
cout << "Attraktor Destruktor" << endl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// *** EMITTERS *** EMITTERS *** EMITTERS *** EMITTERS ***
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Emitter::Emitter(){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
|
||||||
|
type = "emitter";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Emitter::Emitter(float _x, float _y){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
|
||||||
|
type = "emitter";
|
||||||
|
|
||||||
|
position.set(_x,_y);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Emitter::Emitter(ofVec2f _position){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
|
||||||
|
type = "emitter";
|
||||||
|
|
||||||
|
position.set(_position);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Emitter::~Emitter(){
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// *** EMITTER ON STELE *** EMITTER ON STELE *** EMITTER ON STELE ***
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
EmitterOnStele::EmitterOnStele(){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
agingEnabled = true;
|
||||||
|
|
||||||
|
type = "emitterOnStele";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
EmitterOnStele::EmitterOnStele(float _x, float _y, bool _aging){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
agingEnabled = _aging;
|
||||||
|
|
||||||
|
type = "emitterOnStele";
|
||||||
|
|
||||||
|
position.set(_x,_y);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
EmitterOnStele::EmitterOnStele(ofVec2f _position, bool _aging){
|
||||||
|
|
||||||
|
emitting = true;
|
||||||
|
attracting = false;
|
||||||
|
agingEnabled = _aging;
|
||||||
|
|
||||||
|
type = "emitterOnStele";
|
||||||
|
|
||||||
|
position.set(_position);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
EmitterOnStele::~EmitterOnStele(){
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
// *** ATTRAKTOR ON STELE ***
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
AttraktorOnStele::AttraktorOnStele(){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
|
||||||
|
type = "attraktorStele";
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
AttraktorOnStele::AttraktorOnStele(float x, float y){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
|
||||||
|
type = "attraktorStele";
|
||||||
|
|
||||||
|
position.set(x,y);
|
||||||
|
|
||||||
|
// cout << "AttraktorStele Konstruktor überladen" << endl;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
AttraktorOnStele::AttraktorOnStele(ofVec2f _position){
|
||||||
|
|
||||||
|
emitting = false;
|
||||||
|
attracting = true;
|
||||||
|
|
||||||
|
type = "attraktorStele";
|
||||||
|
|
||||||
|
position.set(_position);
|
||||||
|
|
||||||
|
// cout << "Attraktor Konstruktor überladen (ofVec2f position)" << endl;
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
AttraktorOnStele::~AttraktorOnStele(){
|
||||||
|
|
||||||
|
cout << "AttraktorStelen Destruktor" << endl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
//
|
||||||
|
// objectPhysics.hpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 01.05.19.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofMain.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectPhysics {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ObjectPhysics();
|
||||||
|
~ObjectPhysics();
|
||||||
|
|
||||||
|
void update(float deltaT);
|
||||||
|
|
||||||
|
void setPosition(float x, float y);
|
||||||
|
void setPosition(ofVec2f position);
|
||||||
|
ofVec2f getPosition();
|
||||||
|
|
||||||
|
void setEmitting(bool emitting);
|
||||||
|
void setAttracting(bool attracting);
|
||||||
|
|
||||||
|
void setIsVisitor(bool isVisitor);
|
||||||
|
bool getIsVisitorObject();
|
||||||
|
bool isAVisitorObject;
|
||||||
|
|
||||||
|
void aging(float deltaT);
|
||||||
|
|
||||||
|
string type;
|
||||||
|
|
||||||
|
ofVec2f position;
|
||||||
|
bool emitting; //if true: Particles will emit from the position
|
||||||
|
bool attracting; //if true: Particles will be attracted to the position
|
||||||
|
bool repell; //if true: Particles will be repelled from the position
|
||||||
|
bool agingEnabled;
|
||||||
|
|
||||||
|
|
||||||
|
float getAge();
|
||||||
|
float age;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
float force;
|
||||||
|
float vel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR ******* ATTRAKTOR *******
|
||||||
|
|
||||||
|
class Attraktor: public ObjectPhysics {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Attraktor();
|
||||||
|
Attraktor(float x, float y);
|
||||||
|
Attraktor(ofVec2f position);
|
||||||
|
|
||||||
|
~Attraktor();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER ******* EMITTER *******
|
||||||
|
|
||||||
|
class Emitter: public ObjectPhysics {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
Emitter();
|
||||||
|
Emitter(float x, float y);
|
||||||
|
Emitter(ofVec2f position);
|
||||||
|
~Emitter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// *** EMITTER ON STELE *** EMITTER ON STELE *** EMITTER ON STELE ***
|
||||||
|
|
||||||
|
|
||||||
|
class EmitterOnStele: public ObjectPhysics {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
EmitterOnStele();
|
||||||
|
EmitterOnStele(float x, float y, bool aging);
|
||||||
|
EmitterOnStele(ofVec2f position, bool aging);
|
||||||
|
~EmitterOnStele();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ******* ATTRAKTOR STELEN ******* ATTRAKTOR STELEN ******* ATTRAKTOR STELEN ******* ATTRAKTOR STELEN ******* ATTRAKTOR STELEN *******
|
||||||
|
|
||||||
|
class AttraktorOnStele: public ObjectPhysics {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
AttraktorOnStele();
|
||||||
|
AttraktorOnStele(float x, float y);
|
||||||
|
AttraktorOnStele(ofVec2f position);
|
||||||
|
|
||||||
|
~AttraktorOnStele();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
@@ -1,44 +1,199 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ofMain.h"
|
//addons
|
||||||
#include "particle.h"
|
|
||||||
#include "ofxOsc.h"
|
#include "ofxOsc.h"
|
||||||
#include "ofxGui.h"
|
#include "ofxWarp.h"
|
||||||
|
|
||||||
|
//headers
|
||||||
|
//#include "ofMain.h"
|
||||||
|
#include "particleSystem.hpp"
|
||||||
|
#include "greatWhole.hpp"
|
||||||
|
#include "visitor.hpp"
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
// #include "particle.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// *** SETUP OSC INFORMATION *** SETUP OSC INFORMATION ***
|
||||||
|
|
||||||
//OSC Reciever PORT & HOST IP
|
|
||||||
#define PORT 12345
|
#define PORT 12345
|
||||||
#define HOST "172.20.10.2"
|
//#define HOST "192.168.178.52"
|
||||||
|
|
||||||
class ofApp : public ofBaseApp {
|
|
||||||
|
|
||||||
public:
|
//typeOfView will be used, to toggle between the views of the logical scene and the scene after all the particles have been mapped
|
||||||
|
//enum typeOfView{
|
||||||
|
// LOGIC,
|
||||||
|
// MAPPED
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
|
||||||
|
class ofApp : public ofBaseApp{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
void setup();
|
void setup();
|
||||||
|
void setupWarpStuff();
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void keyPressed(int key);
|
void keyPressed(int key);
|
||||||
void keyReleased(int key);
|
void keyReleased(int key);
|
||||||
void mouseMoved(int x, int y);
|
void mouseMoved(int x, int y);
|
||||||
|
void mouseDragged(int x, int y, int button);
|
||||||
void mousePressed(int x, int y, int button);
|
void mousePressed(int x, int y, int button);
|
||||||
void mouseReleased(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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void drawMappedScene(float x, float y);
|
||||||
|
void drawLogicalScene(float x, float y);
|
||||||
|
|
||||||
|
int getTypeForCheckin(float x);
|
||||||
|
int getSteleForCheckin(float x);
|
||||||
|
|
||||||
|
void drawGrid(float sceneWidth, float sceneHeight, int columns, int rows);
|
||||||
|
void drawStelen(float sceneWidth, float sceneHeight);
|
||||||
|
|
||||||
|
int getBeginOfVisitorsInObjectPhysics();
|
||||||
|
|
||||||
|
void refreshCoordinatesOfVisitorAttraktors(int beginOfVisitorsInObjectPhysicsVector, float sceneHeight);
|
||||||
|
|
||||||
|
ofImage logicalBackground;
|
||||||
|
|
||||||
|
typeOfView activeTypeOfView;
|
||||||
|
bool listeningForStelenInput;
|
||||||
|
|
||||||
|
CheckedInVisitor checkedInVisitor;
|
||||||
|
|
||||||
|
//global mode for the whole scene; particles & particlesystem & objectPhysics will know about this!
|
||||||
|
particleMode currentMode;
|
||||||
|
|
||||||
|
//shall be used for checking if there has be a Change in the mode,
|
||||||
|
//to be able to generate stuff in the update method without generating it in every iteration
|
||||||
|
particleMode lastMode;
|
||||||
|
|
||||||
|
//mode for setting a Mode only for one or more particular system(s)
|
||||||
|
particleMode particularMode;
|
||||||
|
|
||||||
|
string getCurrentModeAsString();
|
||||||
|
bool currentModeHasChanged;
|
||||||
|
|
||||||
|
ofxXmlSettings xmlForSetup;
|
||||||
|
ofxXmlSettings xmlSettings;
|
||||||
|
|
||||||
|
// *** MAGIC INSIDE *** MAGIC INSIDE *** MAGIC INSIDE ***
|
||||||
|
|
||||||
|
vector<ObjectPhysics*> objectPhysics;
|
||||||
|
|
||||||
|
vector<ParticleSystem*> particleSystems;
|
||||||
|
|
||||||
|
vector<Visitor*> visitors;
|
||||||
|
|
||||||
|
vector<CheckedInVisitor*> checkedInVisitors;
|
||||||
|
|
||||||
|
|
||||||
|
//important stuff that regulates, whether a tornado can be triggered or not.
|
||||||
|
//tornadoIsPossible will be set false after the tornado has been triggered
|
||||||
|
//tornadoIsPossible will be set true after some time has passed
|
||||||
|
bool tornadoIsPossible;
|
||||||
|
float tornadoTimer;
|
||||||
|
|
||||||
|
// *** GLOBALS *** GLOBALS *** GLOBALS *** GLOBALS ****
|
||||||
|
|
||||||
|
//Changes in the scene can done with these
|
||||||
|
//We should load these coordinates in the ofApp/setup() depending on the rendered scene, maybe via xml?
|
||||||
|
|
||||||
|
ofVec2f centerOfScene;
|
||||||
|
ofVec2f stele1_bottom;
|
||||||
|
ofVec2f stele1_top;
|
||||||
|
ofVec2f stele2_bottom;
|
||||||
|
ofVec2f stele2_top;
|
||||||
|
ofVec2f stele3_bottom;
|
||||||
|
ofVec2f stele3_top;
|
||||||
|
ofVec2f stele4_bottom;
|
||||||
|
ofVec2f stele4_top;
|
||||||
|
ofVec2f stele5_bottom;
|
||||||
|
ofVec2f stele5_top;
|
||||||
|
ofVec2f stele6_bottom;
|
||||||
|
ofVec2f stele6_top;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Supervision can be done with these
|
||||||
|
|
||||||
|
int COUNT_PARTICLES;
|
||||||
|
//+1 for every new Particle, -1 for every Particle that gets older than the defined maxLife
|
||||||
|
|
||||||
|
int COUNT_VISITORS;
|
||||||
|
//the visitor count will be fed with the nBlobs-value from incoming OSC messages
|
||||||
|
|
||||||
|
int COUNT_VISITORS_LASTFRAME;
|
||||||
|
|
||||||
|
int COUNT_PARTICLESYSTEMS;
|
||||||
|
|
||||||
|
int COUNT_OBJECTPHYSICS;
|
||||||
|
|
||||||
|
int COUNT_CHECKEDINVISITORS;
|
||||||
|
|
||||||
|
//OSC Buffer (we will store the information here and wait for the "go" (checkin) message to use it)
|
||||||
|
int stele;
|
||||||
|
int playerType;
|
||||||
|
|
||||||
|
|
||||||
|
float timerAfterCheckin;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// OSC Receiver
|
|
||||||
|
|
||||||
string oscMsg;
|
string oscMsg;
|
||||||
ofxOscReceiver receiver;
|
ofxOscReceiver receiver;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// *** MAPPING *** MAPPING *** MAPPING *** MAPPING *** MAPPING ***
|
||||||
|
|
||||||
|
ofxWarpController warpControllerCircle;
|
||||||
|
ofxWarpController warpControllerStele1;
|
||||||
|
ofxWarpController warpControllerStele2;
|
||||||
|
ofxWarpController warpControllerStele3;
|
||||||
|
|
||||||
|
ofFbo fbo_warp;
|
||||||
|
ofVec2f sceneSizeWarp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int sceneWidth;
|
||||||
|
int sceneHeight;
|
||||||
|
int sceneHeightLastFrame;
|
||||||
|
|
||||||
|
// *** OSC *** OSC *** OSC *** OSC *** OSC ***
|
||||||
|
|
||||||
|
|
||||||
float timeSent, timeReceived;
|
float timeSent, timeReceived;
|
||||||
|
|
||||||
int nBlobs;
|
|
||||||
int blobCount;
|
|
||||||
|
|
||||||
float xOfCentroid;
|
float deltaT;
|
||||||
float yOfCentroid;
|
|
||||||
|
|
||||||
|
GreatWhole dasGrosseGanze;
|
||||||
|
|
||||||
|
int WINDOWSIZE_WIDTH = 1000;
|
||||||
|
int WINDOWSIZE_HEIGHT = 1000;
|
||||||
|
|
||||||
vector<thParticle*> system;
|
|
||||||
vector<Attractor*> attractors;
|
|
||||||
float birthCount;
|
|
||||||
double time;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,148 +1,555 @@
|
|||||||
|
//
|
||||||
// particle.cpp
|
// particle.cpp
|
||||||
// particleSystem
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "particle.h"
|
#include "particle.hpp"
|
||||||
#include "ofApp.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Particle::Particle()
|
Particle::Particle()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// std::cout << "partikel konstruktor" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Particle::Particle(ofVec2f _position)
|
||||||
|
{
|
||||||
|
|
||||||
|
position = _position;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// std::cout << "partikel konstruktor überladen" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
Particle::~Particle()
|
Particle::~Particle()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
void Particle::setup(ofVec2f _position) {
|
|
||||||
|
void Particle::setup(ofVec2f _position, float sceneHeight){
|
||||||
|
|
||||||
this->position = _position;
|
this->position = _position;
|
||||||
|
|
||||||
vel.set(ofRandom(-3.0, 3.0), ofRandom(-3.0, 3.0));
|
velocity.set(0,0);
|
||||||
|
|
||||||
age = 0.0;
|
age = 0.0;
|
||||||
maxLife = 12.0;
|
maxLife = 25.0;
|
||||||
|
|
||||||
color.set(250, 250, 250);
|
color.set(ofRandom(100,150),ofRandom(100,150),ofRandom(20,255));
|
||||||
|
size = 1.5;
|
||||||
|
mass = 100;
|
||||||
|
|
||||||
size = ofRandom(4.0, 0.01);
|
activeSlowingDown = 0;
|
||||||
|
factorOfSlowingDown = 0.3;
|
||||||
|
|
||||||
|
activeSpeedingUp = factorOfSlowingDown;
|
||||||
|
factorOfSpeedingUp = 1;
|
||||||
|
|
||||||
|
scaleFactorPerDeltaT = 0.002;
|
||||||
|
|
||||||
|
distanceToCenter = 0;
|
||||||
|
angleToCenter = 0;
|
||||||
|
|
||||||
|
aging = true;
|
||||||
|
|
||||||
|
particleIsOnGround = isTheSetupPositionOnTheGround(position, sceneHeight);
|
||||||
|
|
||||||
mass = ofRandom(100, 250);
|
|
||||||
|
|
||||||
tex.load("img/overlay.png");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
void Particle::update(float deltaT, particleMode currentMode, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float _sceneWidth, float _sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
sceneWidth = _sceneWidth;
|
||||||
|
sceneHeight = _sceneHeight;
|
||||||
|
|
||||||
|
|
||||||
|
//angle and distance calculation to be able to map later
|
||||||
|
updateAngleToCenter(sceneHeight/2, sceneHeight/2); //updates the angle of the particle in relation to the center of the logical scene
|
||||||
|
updateDistanceToCenter(sceneHeight/2, sceneHeight/2, sceneHeight); //needs the center of the LED-Floor as reference
|
||||||
|
|
||||||
|
|
||||||
|
switch ( currentMode ) {
|
||||||
|
|
||||||
|
|
||||||
|
case PARTICLE_MODE_DEFAULT: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the PARTICLE do if the mode is 'PARTICLE_MODE_DEFAULT'
|
||||||
|
|
||||||
|
if(currentMode != lastMode && lastMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
activeSpeedingUp = factorOfSlowingDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(activeSpeedingUp < factorOfSpeedingUp){
|
||||||
|
//This is helping to make the transition from faster to slower a little smoother
|
||||||
|
//The particle will be slowed down in every iteration until the "destination"-speed is reached
|
||||||
|
activeSpeedingUp = activeSpeedingUp + deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
attractParticle(objectPhysics, checkedInVisitors);
|
||||||
|
|
||||||
|
|
||||||
|
position += activeSpeedingUp * (velocity * deltaT) ;
|
||||||
|
|
||||||
|
aging = true;
|
||||||
|
|
||||||
|
if(aging == true){
|
||||||
|
age += deltaT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void Particle::update(float deltaT, vector<Attractor*>* attractors) {
|
|
||||||
|
|
||||||
ofVec2f force;
|
|
||||||
counterOfActiveAttractors = 0;
|
|
||||||
for (int i = 0; i < attractors->size(); i++) {
|
|
||||||
if (attractors->at(i)->getX() == 0 && attractors->at(i)->getY() == 0) {
|
|
||||||
force = 0 * force.getNormalized();
|
|
||||||
vel += force;
|
|
||||||
vel = mass * vel.getNormalized();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
counterOfActiveAttractors++;
|
//------------------------
|
||||||
force.set(attractors->at(i)->getX() - position.x, attractors->at(i)->getY() - position.y);
|
|
||||||
|
|
||||||
if (force.length() < 150) {
|
|
||||||
force = 60 * force.getNormalized();
|
|
||||||
size = size + ofRandom(.01, 0.01);
|
|
||||||
|
|
||||||
vel += force;
|
case PARTICLE_MODE_POLYMESH: {
|
||||||
vel = mass * vel.getNormalized();
|
|
||||||
|
//what does the PARTICLE do if its mode is 'PARTICLE_MODE_POLYMESH'
|
||||||
|
if(currentMode != lastMode){
|
||||||
|
activeSlowingDown = 1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
force = 0 * force.getNormalized();
|
if(activeSlowingDown > factorOfSlowingDown){
|
||||||
vel += force;
|
//This is helping to make the transition from faster to slower a little smoother
|
||||||
vel = mass * vel.getNormalized();
|
//The particle will be slowed down in every iteration until the "destination"-speed is reached
|
||||||
|
activeSlowingDown = activeSlowingDown - deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
position += activeSlowingDown * (velocity * deltaT) ;
|
||||||
|
|
||||||
|
aging = true;
|
||||||
|
|
||||||
|
if(aging == true){
|
||||||
|
age += deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
|
||||||
|
case PARTICLE_MODE_TORNADO: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the PARTICLE do if the mode is 'PARTICLE_MODE_TORNADO'
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
case PARTICLE_MODE_RFID: {
|
||||||
|
|
||||||
|
//what does the PARTICLE do if its mode is 'PARTICLE_MODE_RFID'
|
||||||
|
|
||||||
|
if(currentMode != lastMode && lastMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
activeSpeedingUp = factorOfSlowingDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(activeSpeedingUp < factorOfSpeedingUp){
|
||||||
|
//This is helping to make the transition from faster to slower a little smoother
|
||||||
|
//The particle will be slowed down in every iteration until the "destination"-speed is reached
|
||||||
|
activeSpeedingUp = activeSpeedingUp + deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
position += activeSpeedingUp * (velocity * deltaT) ;
|
||||||
|
|
||||||
|
size += scaleFactorPerDeltaT * deltaT ;
|
||||||
|
|
||||||
|
aging = true;
|
||||||
|
|
||||||
|
if(aging == true){
|
||||||
|
age += deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
default: {}
|
||||||
|
|
||||||
|
} //end of switch
|
||||||
|
|
||||||
|
|
||||||
|
// *** PARTICLE MOVEMENT CONTROL AREA *** PARTICLE MOVEMENT CONTROL AREA ***
|
||||||
|
|
||||||
|
|
||||||
|
//first we slow down the particle in their y-direction,
|
||||||
|
if(particleIsOnGround == false){
|
||||||
|
if(velocity.y < 0 && velocity.y > -0.4){
|
||||||
|
velocity.y *= 0.995;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(distanceToCenter > sceneHeight/4*3){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(particleIsOnGround == false){
|
||||||
|
if(position.x < (sceneHeight)){
|
||||||
|
position.x = sceneWidth;
|
||||||
|
}
|
||||||
|
else if(position.x >= sceneWidth){
|
||||||
|
position.x = sceneHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
age += deltaT * .5;
|
size += scaleFactorPerDeltaT * age ;
|
||||||
position += (vel * deltaT);
|
|
||||||
|
|
||||||
// *** COLLISION *** COLLISION *** COLLISION *** COLLISION *** COLLISION *** COLLISION
|
lastMode = currentMode;
|
||||||
|
|
||||||
//if (position.x <= 0 || position.x >= ofGetWidth()) {
|
|
||||||
//vel.x = -vel.x;
|
|
||||||
//position += (vel * deltaT);
|
|
||||||
//}
|
|
||||||
//else if (position.y <= 0 || position.y >= ofGetHeight()) {
|
|
||||||
//vel.y = -vel.y;
|
|
||||||
//position += (vel * deltaT);
|
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
//position += (vel * deltaT);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//void thParticle::update(float deltaT, ofVec2f attractor){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// age += deltaT;
|
|
||||||
//
|
|
||||||
// ofVec2f force = attractor - position;
|
|
||||||
// color.set(250,250, 250, (1 - age / maxLife) * 255);
|
|
||||||
//
|
|
||||||
// if( force.length() < 40 && force.length() > 11 ){
|
|
||||||
// velocity = velocity.getNormalized() * mass;
|
|
||||||
// velocity += 0.01 * force ;
|
|
||||||
//
|
|
||||||
// }else if(force.length() < 12){
|
|
||||||
// velocity = velocity.getNormalized() * mass;
|
|
||||||
// velocity += 5 * force ;
|
|
||||||
//
|
|
||||||
// }else{
|
|
||||||
//
|
|
||||||
// velocity = velocity.getNormalized() * mass;
|
|
||||||
// velocity += 0.12 * force ;
|
|
||||||
// }
|
|
||||||
// position += velocity * deltaT;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
void Particle::draw() {
|
void Particle::draw(typeOfView activeTypeOfView){
|
||||||
|
|
||||||
color.set(getAgeNorm() * 241,241/ getAgeNorm() ,219);
|
updateColor();
|
||||||
|
ofSetColor(color);
|
||||||
ofSetColor(color, (1 - getAgeNorm()) * 255);
|
|
||||||
//tex.setColor(color);
|
|
||||||
//tex.draw(position, size, size);
|
|
||||||
|
|
||||||
|
ofSetCircleResolution(10);
|
||||||
|
mapParticle(sceneWidth, sceneHeight);
|
||||||
ofDrawCircle(position, size);
|
ofDrawCircle(position, size);
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
if(activeTypeOfView == MAPPED){
|
||||||
|
ofDrawBitmapString(distanceToCenter, position);
|
||||||
|
}
|
||||||
|
ofSetCircleResolution(35);
|
||||||
|
|
||||||
|
|
||||||
float Particle::getAgeNorm() {
|
|
||||||
return age / maxLife;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
float Particle::getMaxLife() {
|
float Particle::getMaxLife(){
|
||||||
return 1;
|
|
||||||
|
return maxLife;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//-----------------------------------
|
||||||
|
|
||||||
|
float Particle::getAngle(){
|
||||||
|
|
||||||
|
return angleToCenter;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
ofVec2f Particle::getPosition(){
|
||||||
|
|
||||||
|
return position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
void Particle::setRandomVelocity(){
|
||||||
|
|
||||||
|
velocity.set(ofRandom(-50,50), ofRandom(-50,50));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
void Particle::setRandomVelocityOnlyGoingUp(){
|
||||||
|
|
||||||
|
velocity.set(ofRandom(-50,50), ofRandom(-50,-1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Particle::updateColor(){
|
||||||
|
|
||||||
|
if(getAgeNorm() >= 1){
|
||||||
|
color.set(69 + getAgeNorm() * 104, 164 - getAgeNorm() * 95 , 220, (color , 0));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
color.set(69 + getAgeNorm() * 104, 164 - getAgeNorm() * 95 , 220, (color, (1 - getAgeNorm()) * 255 ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
void Particle::attractParticle(vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors){
|
||||||
|
|
||||||
|
if(particleIsOnGround == true){
|
||||||
|
|
||||||
|
for(int i = 0; i < objectPhysics->size(); i++){
|
||||||
|
|
||||||
|
if(( (*objectPhysics).at(i)->type == "attraktor" ) && (objectPhysics->at(i)->attracting == true)){
|
||||||
|
|
||||||
|
ofVec2f force;
|
||||||
|
|
||||||
|
force.set(objectPhysics->at(i)->getPosition() - position);
|
||||||
|
|
||||||
|
if(force.length() < 150){
|
||||||
|
velocity += force.getNormalized() * 40;
|
||||||
|
}
|
||||||
|
if(force.length() < 50){
|
||||||
|
velocity -= force.getNormalized() * 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(particleIsOnGround == false){
|
||||||
|
|
||||||
|
for(int i = 0; i < checkedInVisitors->size(); i++){
|
||||||
|
|
||||||
|
float ageOfCheckedInVisitor = checkedInVisitors->at(i)->getAge();
|
||||||
|
|
||||||
|
if(( ageOfCheckedInVisitor < 30.0 )){
|
||||||
|
|
||||||
|
ofVec2f force;
|
||||||
|
force.set(checkedInVisitors->at(i)->getBottom() - position);
|
||||||
|
float forceLength = force.length();
|
||||||
|
|
||||||
|
if(forceLength < 250){
|
||||||
|
force = force.getNormalized()* 30 * 4/checkedInVisitors->at(i)->getAge();
|
||||||
|
velocity += force;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
float Particle::getAgeNorm(){
|
||||||
|
|
||||||
|
return age/maxLife;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Particle::updateAngleToCenter(float centerX, float centerY){
|
||||||
|
|
||||||
|
|
||||||
|
//case 1 ( distance =< radius )
|
||||||
|
ofVec2f center(centerX, centerY);
|
||||||
|
|
||||||
|
ofVec2f particleToCenter = position - center;
|
||||||
|
//Subtraction: (position of particle) - (position of floor center) = vector between center and particle
|
||||||
|
|
||||||
|
ofVec2f referenceVector(0, 0.5);
|
||||||
|
|
||||||
|
angleToCenter = particleToCenter.getNormalized().angle(referenceVector.getNormalized());
|
||||||
|
angleToCenter = angleToCenter + 180;
|
||||||
|
|
||||||
|
//case 2 ( distance > radius
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Particle::updateDistanceToCenter(float centerX, float centerY, float sceneHeight){
|
||||||
|
|
||||||
|
distanceToCenterLastFrame = distanceToCenter;
|
||||||
|
|
||||||
|
if(particleIsOnGround == true){
|
||||||
|
|
||||||
|
ofVec2f centerOfFloor(centerX, centerY);
|
||||||
|
distanceToCenter = position.distance(centerOfFloor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(particleIsOnGround == false){
|
||||||
|
|
||||||
|
distanceToCenter = sceneHeight/2 + sceneHeight - position.y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distanceToCenterLastFrame >= sceneHeight/2 && distanceToCenter < sceneHeight/2){
|
||||||
|
|
||||||
|
//was passiert wenn es vorher größer als radius war, dann kleiner
|
||||||
|
particleJumpedOnGround = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distanceToCenterLastFrame <= sceneHeight/2 && distanceToCenter > sceneHeight/2){
|
||||||
|
|
||||||
|
//was passiert wenn es vorher kleiner als radius war, dann größer
|
||||||
|
particleJumpedOffGround = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
bool Particle::isTheSetupPositionOnTheGround(ofVec2f _position, float sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ofVec2f centerOfFloor(sceneHeight/2, sceneHeight/2);
|
||||||
|
distanceToCenter = _position.distance(centerOfFloor);
|
||||||
|
|
||||||
|
if(distanceToCenter > (sceneHeight/2)){
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Particle::mapParticle(float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
//The mapping works with the information about the particle's distance to the center and its angle to the center (distanceToCenter, angleToCenter).
|
||||||
|
//if the particle gets too far away from the center, it will leave the LED-Floor. Then there is a small black gap.
|
||||||
|
//After that it will hit the "Stelen". The Stelen are represented by a 360degree circle, 40deg for every Stele, 20deg for every black gap in between.
|
||||||
|
|
||||||
|
|
||||||
|
if(particleJumpedOffGround == true){
|
||||||
|
|
||||||
|
position.y = sceneHeight - 20;
|
||||||
|
//sceneWidth noch ändern damit es sich am kreisumfang orientiert
|
||||||
|
position.x = (sceneHeight + angleToCenter/360 * (sceneWidth - sceneHeight));
|
||||||
|
position.x += (sceneWidth - sceneHeight)/12 ; //so we dont have 0 deg exactly at the first pixel of the stelen
|
||||||
|
if(position.x > sceneWidth){
|
||||||
|
|
||||||
|
float difference = position.x - sceneWidth;
|
||||||
|
position.x = sceneHeight + difference;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ofVec2f referenceVector(0.0, 1.0); //will be used to get an angle of the velocityvector
|
||||||
|
referenceVector.getNormalized();
|
||||||
|
|
||||||
|
float lotAmKreisZuAustrittspunkt;
|
||||||
|
|
||||||
|
if(angleToCenter < 90){
|
||||||
|
|
||||||
|
lotAmKreisZuAustrittspunkt = 270 - angleToCenter;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(angleToCenter >= 90){
|
||||||
|
|
||||||
|
lotAmKreisZuAustrittspunkt = angleToCenter - 90;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float velocityAngleZuReference = velocity.angle(referenceVector);
|
||||||
|
// velocity = velocity.rotate(270 - lotAmKreisZuAustrittspunkt);
|
||||||
|
float k = velocity.length();
|
||||||
|
velocity.set(0, -k);
|
||||||
|
particleJumpedOffGround = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// cout << "particleJumpedOffGround" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(particleJumpedOnGround == true){
|
||||||
|
|
||||||
|
|
||||||
|
//Vorerst nicht implementiert
|
||||||
|
// particleJumpedOnGround = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(distanceToCenter > sceneHeight/2){
|
||||||
|
|
||||||
|
particleIsOnGround = false;
|
||||||
|
|
||||||
|
}else if(distanceToCenter <= sceneHeight/2){
|
||||||
|
|
||||||
|
particleIsOnGround = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//setze bei übertritt einmal y auf sceneHeight
|
||||||
|
//setze x genau auf angle/360 * sceneWidth
|
||||||
|
//setze velocity neu mit weg über gedrehtes lot (siehe blatt)
|
||||||
|
//führe berechnung normal weiter aus
|
||||||
|
|
||||||
|
|
||||||
|
//correcting the velocity to the new way it is going to be displayed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
//
|
||||||
|
// particle.hpp
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofMain.h"
|
||||||
|
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
#include "visitor.hpp"
|
||||||
|
#include "checkedInVisitor.hpp"
|
||||||
|
|
||||||
|
enum typeOfView{
|
||||||
|
|
||||||
|
LOGIC,
|
||||||
|
MAPPED
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum particleMode{
|
||||||
|
|
||||||
|
PARTICLE_MODE_DEFAULT,
|
||||||
|
PARTICLE_MODE_POLYMESH,
|
||||||
|
PARTICLE_MODE_RFID,
|
||||||
|
PARTICLE_MODE_TORNADO
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Particle {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Particle();
|
||||||
|
Particle(ofVec2f _position);
|
||||||
|
|
||||||
|
~Particle();
|
||||||
|
|
||||||
|
void setup(ofVec2f position, float sceneHeight);
|
||||||
|
bool isTheSetupPositionOnTheGround(ofVec2f position, float sceneHeight);
|
||||||
|
|
||||||
|
void update(float deltaT, particleMode currentModeParticle, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight);
|
||||||
|
|
||||||
|
void draw(typeOfView activeTypeOfView);
|
||||||
|
|
||||||
|
float getMaxLife();
|
||||||
|
float getAgeNorm();
|
||||||
|
float getAngle();
|
||||||
|
ofVec2f getPosition();
|
||||||
|
|
||||||
|
void setRandomVelocity();
|
||||||
|
void setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
void updateColor();
|
||||||
|
// void setColor(int r, int g, int b);
|
||||||
|
|
||||||
|
void attractParticle(vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors);
|
||||||
|
|
||||||
|
void updateAngleToCenter(float centerX, float centerY);
|
||||||
|
void updateDistanceToCenter(float centerX, float centerY, float sceneHeight);
|
||||||
|
|
||||||
|
|
||||||
|
bool particleIsOnGround;
|
||||||
|
bool particleJumpedOffGround;
|
||||||
|
bool particleJumpedOnGround;
|
||||||
|
|
||||||
|
void mapParticle(float sceneWidth, float sceneHeight);
|
||||||
|
bool borderCollission();
|
||||||
|
|
||||||
|
typeOfView activeTypeOfView;
|
||||||
|
|
||||||
|
particleMode currentMode;
|
||||||
|
particleMode lastMode;
|
||||||
|
|
||||||
|
float sceneWidth;
|
||||||
|
float sceneHeight;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ofVec2f velocity;
|
||||||
|
ofVec2f position;
|
||||||
|
ofVec2f mappedPosition;
|
||||||
|
|
||||||
|
float factorOfSlowingDown;
|
||||||
|
float activeSlowingDown;
|
||||||
|
float factorOfSpeedingUp;
|
||||||
|
float activeSpeedingUp;
|
||||||
|
|
||||||
|
//Mapping information
|
||||||
|
float angleToCenter;
|
||||||
|
|
||||||
|
float distanceToCenter;
|
||||||
|
float distanceToCenterLastFrame;
|
||||||
|
|
||||||
|
float age;
|
||||||
|
float maxLife;
|
||||||
|
bool aging;
|
||||||
|
|
||||||
|
float size;
|
||||||
|
float scaleFactorPerDeltaT;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,305 @@
|
|||||||
|
//
|
||||||
|
// particleSystem.cpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "particleSystem.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ParticleSystem::ParticleSystem(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
ParticleSystem::~ParticleSystem(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::setup(){
|
||||||
|
|
||||||
|
|
||||||
|
// xmlParticleSystems.loadFile("xml/particleSystem.xml");
|
||||||
|
|
||||||
|
// this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
// std::cout << "breakpoint particleSystem_1 erreicht, particleSystem_setup beendet" << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
//*** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE ***
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::update(float deltaT, particleMode currentMode, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
//preparation
|
||||||
|
|
||||||
|
double DELTA_T_IN_SECONDS = deltaT/1000;
|
||||||
|
|
||||||
|
this->currentMode = currentMode;
|
||||||
|
|
||||||
|
// *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH ***
|
||||||
|
|
||||||
|
|
||||||
|
//If the particlesystem itself needs some logic, it will happen in the following switch!
|
||||||
|
|
||||||
|
|
||||||
|
switch ( currentMode )
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
case PARTICLE_MODE_DEFAULT: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_DEFAULT'
|
||||||
|
|
||||||
|
|
||||||
|
// value a = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value b = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value c = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value d = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value e ....
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// PARTICLESYSTEM_BIRTHRATE = xmlParticleSystems.getValue("default:birthrate", 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PARTICLESYSTEM_BIRTHRATE = 1; //testing default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// std::cout << "birthrate from xml: " + ofToString(PARTICLESYSTEM_BIRTHRATE) << std::endl;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
case PARTICLE_MODE_POLYMESH: {
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_POLYMESH'
|
||||||
|
|
||||||
|
PARTICLESYSTEM_BIRTHRATE = 0;
|
||||||
|
updateLines(currentMode, objectPhysics);
|
||||||
|
|
||||||
|
// PARTICLESYSTEM_BIRTHRATE = xmlParticleSystems.getValue("polymesh:birthrate", 0);
|
||||||
|
int PARTICLESYSTEM_BIRTHRATE_CHECKEDINVISITORS = 4;
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE_CHECKEDINVISITORS){
|
||||||
|
|
||||||
|
for(int i = 0; i < checkedInVisitors->size(); i++){
|
||||||
|
|
||||||
|
if( checkedInVisitors->at(i)->getAge() <= 7){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(checkedInVisitors->at(i)->getBottom(), sceneHeight);
|
||||||
|
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
case PARTICLE_MODE_RFID: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_RFID'
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE){
|
||||||
|
|
||||||
|
for(int i = 0; i < checkedInVisitors->size(); i++){
|
||||||
|
|
||||||
|
if( checkedInVisitors->at(i)->getAge() <= 5){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(checkedInVisitors->at(i)->getBottom(), sceneHeight);
|
||||||
|
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
default: {
|
||||||
|
|
||||||
|
//following two lines only help for compiling right now
|
||||||
|
|
||||||
|
int a = 0;
|
||||||
|
a++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of switch
|
||||||
|
|
||||||
|
// std::cout << "breakpoint particleSystem_2 erreicht, switch anweisung beendet" << std::endl;
|
||||||
|
|
||||||
|
// *** BIRTH CONTROL *** BIRTH CONTROL *** BIRTH CONTROL ***
|
||||||
|
|
||||||
|
//the system will emit a new particle for every emitter, as long as the PRODUCED_PER_EMITTER is smaller than the wanted BIRTHRATE
|
||||||
|
//PPE is growing until it reaches deltaT, so the while statement will be executed more often, if deltaT gets bigger
|
||||||
|
//as long as the birthcount grows and is lower then the birthrate (depending on the mode (XML) ) it will emit once for every emitter
|
||||||
|
//that is active (bool emitting = true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE){
|
||||||
|
|
||||||
|
for(int i = 0; i < objectPhysics->size(); i++){
|
||||||
|
|
||||||
|
// if(( (*objectPhysics).at(i)->type == "emitter" ) && (objectPhysics->at(i)->emitting == true)){
|
||||||
|
if( objectPhysics->at(i)->emitting == true){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(objectPhysics->at(i)->getPosition(), sceneHeight);
|
||||||
|
if(objectPhysics->at(i)->type == "emitterOnStele"){
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
}else{
|
||||||
|
particles.back()->setRandomVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// *** PARTICLE SYSTEM UPDATING ITS PARTICLES *** *** PARTICLE SYSTEM UPDATING ITS PARTICLES *** PARTICLE SYSTEM UPDATING ITS PARTICLES ***
|
||||||
|
|
||||||
|
//for "alle partikel im system" update in abhängigkeit vom übergebenen "mode"
|
||||||
|
//The following lines will start working, when Particle::update has been reworked is active and particleMode implemented
|
||||||
|
|
||||||
|
for (int p = 0; p < particles.size(); p++){
|
||||||
|
|
||||||
|
particles.at(p)->update(deltaT, currentMode, objectPhysics, checkedInVisitors, sceneWidth, sceneHeight);
|
||||||
|
|
||||||
|
//Delete particles that reached maxAge
|
||||||
|
if(currentMode != PARTICLE_MODE_POLYMESH){
|
||||||
|
if (particles.at(p)->getAgeNorm() > 1) {
|
||||||
|
delete particles.at(p);
|
||||||
|
particles.erase(particles.begin() + p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::draw(typeOfView activeTypeOfView){
|
||||||
|
|
||||||
|
for(int i = 0; i < particles.size(); i++){
|
||||||
|
|
||||||
|
particles.at(i)->draw(activeTypeOfView);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( currentMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
for(int i = 0; i < lines.size(); i++){
|
||||||
|
|
||||||
|
ofDrawLine(lines.at(i)->point1, lines.at(i)->point2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
void ParticleSystem::updateLines(particleMode currentMode, vector<ObjectPhysics*>* objectPhysics){
|
||||||
|
|
||||||
|
lines.clear();
|
||||||
|
|
||||||
|
if(currentMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
|
||||||
|
for(int i = 0; i < objectPhysics->size(); i++){
|
||||||
|
|
||||||
|
if(( (*objectPhysics).at(i)->type == "attraktor" ) && (objectPhysics->at(i)->attracting == true)){
|
||||||
|
|
||||||
|
for(int p = 0; p < particles.size(); p++){
|
||||||
|
|
||||||
|
if(particles.at(p)->particleIsOnGround==true){
|
||||||
|
|
||||||
|
ofVec2f distance = particles.at(p)->getPosition() - objectPhysics->at(i)->getPosition();
|
||||||
|
|
||||||
|
if(distance.length() < 150){
|
||||||
|
|
||||||
|
lines.push_back(new Line(particles.at(p)->getPosition(), objectPhysics->at(i)->getPosition()));
|
||||||
|
|
||||||
|
for(int p2 = 0; p2 < particles.size(); p2++){
|
||||||
|
|
||||||
|
ofVec2f distance = particles.at(p)->getPosition() - particles.at(p2)->getPosition();
|
||||||
|
|
||||||
|
if(distance.length() < 50){
|
||||||
|
|
||||||
|
lines.push_back(new Line(particles.at(p)->getPosition(), particles.at(p2)->getPosition()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
p2 += 4; //lower value -> worse performance & nicer effect (more connections between the particles)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// p += 2 ; //if your system shows performance issues you might need to activate this line! (downside: effect seems to jump)
|
||||||
|
|
||||||
|
}
|
||||||
|
} //end of for schleife
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
//
|
||||||
|
// particleSystem.hpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "ofxXmlSettings.h"
|
||||||
|
#include "particle.hpp"
|
||||||
|
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
#include "checkedInVisitor.hpp"
|
||||||
|
|
||||||
|
//class Line will be used to draw the polymesh
|
||||||
|
|
||||||
|
class Line {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Line();
|
||||||
|
Line(ofPoint p1, ofPoint p2){
|
||||||
|
point1 = p1;
|
||||||
|
point2= p2;
|
||||||
|
};
|
||||||
|
~Line();
|
||||||
|
|
||||||
|
ofPoint point1;
|
||||||
|
ofPoint point2;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ParticleSystem {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ParticleSystem();
|
||||||
|
~ParticleSystem();
|
||||||
|
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
void update(float deltaT, particleMode mode, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight);
|
||||||
|
void draw(typeOfView activeTypeOfView);
|
||||||
|
|
||||||
|
|
||||||
|
void updateLines(particleMode currentMode, vector<ObjectPhysics*>* objectPhysics);
|
||||||
|
|
||||||
|
|
||||||
|
particleMode currentMode;
|
||||||
|
|
||||||
|
ofxXmlSettings xmlParticleSystems;
|
||||||
|
ofxXmlSettings xmlParticles; // ??? wo soll das hin ???
|
||||||
|
|
||||||
|
vector<Particle*> particles;
|
||||||
|
|
||||||
|
vector<Line*> lines;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
int playerType;
|
||||||
|
//Global for particleSystems-birthrate -> can be used to emit faster/slower
|
||||||
|
|
||||||
|
int PARTICLESYSTEM_BIRTHRATE;
|
||||||
|
int PRODUCED_PER_EMITTER;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
//
|
||||||
|
// visitor.cpp
|
||||||
|
// particle_combined
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 11.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "visitor.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Visitor::Visitor()
|
||||||
|
{
|
||||||
|
|
||||||
|
// ofRunApp.VISITOR_COUNT++;
|
||||||
|
|
||||||
|
std::cout << "Konstruktor visitor" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||