Quelcode des Partikelsystems Boden
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

particle.hpp 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // particle.hpp
  3. //
  4. // Created by Sebastian Holzki on 16.04.19.
  5. //
  6. #pragma once
  7. #include <stdio.h>
  8. #include "ofMain.h"
  9. #include "objectPhysics.hpp"
  10. #include "visitor.hpp"
  11. #include "checkedInVisitor.hpp"
  12. enum typeOfView{
  13. LOGIC,
  14. MAPPED
  15. };
  16. enum particleMode{
  17. PARTICLE_MODE_DEFAULT,
  18. PARTICLE_MODE_POLYMESH,
  19. PARTICLE_MODE_RFID,
  20. PARTICLE_MODE_TORNADO
  21. };
  22. class Particle {
  23. public:
  24. Particle();
  25. Particle(ofVec2f _position);
  26. ~Particle();
  27. void setup(ofVec2f position, float sceneHeight);
  28. bool isTheSetupPositionOnTheGround(ofVec2f position, float sceneHeight);
  29. void update(float deltaT, particleMode currentModeParticle, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight);
  30. void draw(typeOfView activeTypeOfView);
  31. float getMaxLife();
  32. float getAgeNorm();
  33. float getAngle();
  34. ofVec2f getPosition();
  35. void setRandomVelocity();
  36. void setRandomVelocityOnlyGoingUp();
  37. void updateColor();
  38. // void setColor(int r, int g, int b);
  39. void attractParticle(vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors);
  40. void updateAngleToCenter(float centerX, float centerY);
  41. void updateDistanceToCenter(float centerX, float centerY, float sceneHeight);
  42. bool particleIsOnGround;
  43. bool particleJumpedOffGround;
  44. bool particleJumpedOnGround;
  45. void mapParticle(float sceneWidth, float sceneHeight);
  46. bool borderCollission();
  47. typeOfView activeTypeOfView;
  48. particleMode currentMode;
  49. particleMode lastMode;
  50. float sceneWidth;
  51. float sceneHeight;
  52. private:
  53. ofVec2f velocity;
  54. ofVec2f position;
  55. ofVec2f mappedPosition;
  56. float factorOfSlowingDown;
  57. float activeSlowingDown;
  58. float factorOfSpeedingUp;
  59. float activeSpeedingUp;
  60. //Mapping information
  61. float angleToCenter;
  62. float distanceToCenter;
  63. float distanceToCenterLastFrame;
  64. float age;
  65. float maxLife;
  66. bool aging;
  67. float size;
  68. float scaleFactorPerDeltaT;
  69. float mass;
  70. ofColor color;
  71. int stele;
  72. //on which "stele" is the particle? --> will affect the movement (mapping), when it reaches borders of its "stele" !
  73. //if border 1/2/3/4 (<,>,v,^), then map particle
  74. };