123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //
- // 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
-
- };
|