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.cpp 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // particle.cpp
  3. // emptyExample
  4. //
  5. // Created by Sebastian Holzki on 16.04.19.
  6. //
  7. #pragma once
  8. #include "particle.hpp"
  9. #include "ofApp.h"
  10. Particle::Particle()
  11. {
  12. }
  13. // -----------------------------------
  14. Particle::~Particle()
  15. {
  16. }
  17. // -----------------------------------
  18. void Particle::setup(ofVec2f _position){
  19. this->position = _position;
  20. velocity.set(0,0);
  21. age = 0.0;
  22. maxLife = 12.0;
  23. color.set(250,250,250);
  24. size = 2.0;
  25. mass = 100;
  26. }
  27. // -----------------------------------
  28. void Particle::update(float deltaT, Attractor attractor){
  29. }
  30. // -----------------------------------
  31. void Particle::draw(){
  32. ofDrawCircle(position,size);
  33. }
  34. //-----------------------------------
  35. float Particle::getMaxLife(){
  36. return maxLife;
  37. }
  38. //-----------------------------------
  39. float Particle::getAge(){
  40. return age;
  41. }
  42. //-----------------------------------
  43. void Particle::mapParticle(){
  44. /*
  45. Put an if Statement before it:
  46. if(borderCollission == true){mapParticle()}
  47. The particle will be mapped to a new position, using information about:
  48. - old position
  49. - velocity (direction)
  50. - defined borders in the projection --> globals like window size, angle between "stelen", width of stelen, etc.
  51. if the particle hits a border
  52. */
  53. }