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.

objectPhysics.cpp 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. //
  2. // objectPhysics.cpp
  3. // particle_combined
  4. //
  5. // Created by Sebastian Holzki on 11.06.19.
  6. //
  7. #include "objectPhysics.hpp"
  8. ObjectPhysics::ObjectPhysics(){
  9. emitting = 0;
  10. attracting = 0;
  11. isAVisitorObject = false;
  12. age = 0;
  13. };
  14. // -----------------------------------
  15. ObjectPhysics::~ObjectPhysics()
  16. {
  17. };
  18. // -----------------------------------
  19. void ObjectPhysics::update(float deltaT){
  20. aging(deltaT);
  21. }
  22. // -----------------------------------
  23. void ObjectPhysics::setPosition(float x, float y){
  24. position.set(x,y);
  25. }
  26. // -----------------------------------
  27. void ObjectPhysics::setPosition(ofVec2f _position){
  28. position = _position;
  29. }
  30. // -----------------------------------
  31. ofVec2f ObjectPhysics::getPosition(){
  32. return position;
  33. }
  34. // -----------------------------------
  35. float ObjectPhysics::getAge(){
  36. return age;
  37. }
  38. // -----------------------------------
  39. void ObjectPhysics::setIsVisitor(bool isVisitor){
  40. isAVisitorObject = isVisitor;
  41. }
  42. // -----------------------------------
  43. bool ObjectPhysics::getIsVisitorObject(){
  44. return isAVisitorObject;
  45. }
  46. // -----------------------------------
  47. void ObjectPhysics::setEmitting(bool _emitting){
  48. emitting = _emitting;
  49. }
  50. // -----------------------------------
  51. void ObjectPhysics::setAttracting(bool _attracting){
  52. attracting = _attracting;
  53. }
  54. // -----------------------------------
  55. void ObjectPhysics::aging(float deltaT){
  56. if(agingEnabled){
  57. age += deltaT;
  58. }
  59. }
  60. // ----------------------------------------------------------------------
  61. // *** ATTRAKTORS *** ATTRAKTORS *** ATTRAKTORS *** ATTRAKTORS ***
  62. // ----------------------------------------------------------------------
  63. Attraktor::Attraktor(){
  64. emitting = false;
  65. attracting = true;
  66. agingEnabled = false;
  67. type = "attraktor";
  68. cout << "Attraktor Konstruktor" << endl;
  69. };
  70. // -----------------------------------
  71. Attraktor::Attraktor(float x, float y){
  72. emitting = false;
  73. attracting = true;
  74. type = "attraktor";
  75. position.set(x,y);
  76. cout << "Attraktor Konstruktor überladen" << endl;
  77. };
  78. // -----------------------------------
  79. Attraktor::Attraktor(ofVec2f _position){
  80. emitting = false;
  81. attracting = true;
  82. type = "attraktor";
  83. position.set(_position);
  84. // cout << "Attraktor Konstruktor überladen (ofVec2f position)" << endl;
  85. };
  86. // -----------------------------------
  87. Attraktor::~Attraktor(){
  88. cout << "Attraktor Destruktor" << endl;
  89. };
  90. // ----------------------------------------------------------------------
  91. // *** EMITTERS *** EMITTERS *** EMITTERS *** EMITTERS ***
  92. // ----------------------------------------------------------------------
  93. Emitter::Emitter(){
  94. emitting = true;
  95. attracting = false;
  96. type = "emitter";
  97. };
  98. // -----------------------------------
  99. Emitter::Emitter(float _x, float _y){
  100. emitting = true;
  101. attracting = false;
  102. type = "emitter";
  103. position.set(_x,_y);
  104. };
  105. // -----------------------------------
  106. Emitter::Emitter(ofVec2f _position){
  107. emitting = true;
  108. attracting = false;
  109. type = "emitter";
  110. position.set(_position);
  111. };
  112. // -----------------------------------
  113. Emitter::~Emitter(){
  114. };
  115. // ------------------------------------------------------------------
  116. // *** EMITTER ON STELE *** EMITTER ON STELE *** EMITTER ON STELE ***
  117. // ------------------------------------------------------------------
  118. EmitterOnStele::EmitterOnStele(){
  119. emitting = true;
  120. attracting = false;
  121. agingEnabled = true;
  122. type = "emitterOnStele";
  123. };
  124. // -----------------------------------
  125. EmitterOnStele::EmitterOnStele(float _x, float _y, bool _aging){
  126. emitting = true;
  127. attracting = false;
  128. agingEnabled = _aging;
  129. type = "emitterOnStele";
  130. position.set(_x,_y);
  131. };
  132. // -----------------------------------
  133. EmitterOnStele::EmitterOnStele(ofVec2f _position, bool _aging){
  134. emitting = true;
  135. attracting = false;
  136. agingEnabled = _aging;
  137. type = "emitterOnStele";
  138. position.set(_position);
  139. };
  140. // -----------------------------------
  141. EmitterOnStele::~EmitterOnStele(){
  142. };
  143. // -----------------------------------
  144. // *** ATTRAKTOR ON STELE ***
  145. // -----------------------------------
  146. AttraktorOnStele::AttraktorOnStele(){
  147. emitting = false;
  148. attracting = true;
  149. type = "attraktorStele";
  150. };
  151. // -----------------------------------
  152. AttraktorOnStele::AttraktorOnStele(float x, float y){
  153. emitting = false;
  154. attracting = true;
  155. type = "attraktorStele";
  156. position.set(x,y);
  157. // cout << "AttraktorStele Konstruktor überladen" << endl;
  158. };
  159. // -----------------------------------
  160. AttraktorOnStele::AttraktorOnStele(ofVec2f _position){
  161. emitting = false;
  162. attracting = true;
  163. type = "attraktorStele";
  164. position.set(_position);
  165. // cout << "Attraktor Konstruktor überladen (ofVec2f position)" << endl;
  166. };
  167. // -----------------------------------
  168. AttraktorOnStele::~AttraktorOnStele(){
  169. cout << "AttraktorStelen Destruktor" << endl;
  170. };
  171. // -----------------------------------