ParticlePlayer_ScriptBinding.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. ConsoleMethod(ParticlePlayer, setParticleAsset, void, 3, 3, "(particleAssetId?) Sets the particle asset Id to play.\n"
  23. "@param particleAssetId The particle asset Id to play.\n"
  24. "@return No return value.")
  25. {
  26. object->setParticle( argv[2] );
  27. }
  28. //-----------------------------------------------------------------------------
  29. ConsoleMethod(ParticlePlayer, getParticleAsset, const char*, 2, 2, "() Gets the particle asset Id.\n"
  30. "@return The particle asset Id.")
  31. {
  32. return object->getParticle();
  33. }
  34. //-----------------------------------------------------------------------------
  35. ConsoleMethod(ParticlePlayer, setCameraIdleDistance, void, 3, 3, "(idleDistance) Sets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  36. "@param pauseDistance The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  37. "@return No return value.")
  38. {
  39. object->setCameraIdleDistance( dAtof(argv[2]) );
  40. }
  41. //-----------------------------------------------------------------------------
  42. ConsoleMethod(ParticlePlayer, getCameraIdleDistance, F32, 2, 2, "() Gets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  43. "@return The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.")
  44. {
  45. return object->getCameraIdleDistance();
  46. }
  47. //-----------------------------------------------------------------------------
  48. ConsoleMethod(ParticlePlayer, setParticleInterpolation, void, 3, 3, "(bool status) Sets whether the intermediate world position, rotation, and size data points of particles between ticks are calculated.\n"
  49. "@return No return value.")
  50. {
  51. object->setParticleInterpolation( dAtof(argv[2]) );
  52. }
  53. //-----------------------------------------------------------------------------
  54. ConsoleMethod(ParticlePlayer, getParticleInterpolation, F32, 2, 2, "() Gets whether the intermediate world position, rotation, and size data points of particles between ticks are calculated.\n"
  55. "@return (bool status) Whether interpolation is calculated or not.")
  56. {
  57. return object->getParticleInterpolation();
  58. }
  59. //-----------------------------------------------------------------------------
  60. ConsoleMethod(ParticlePlayer, setEmissionRateScale, void, 3, 3, "(scale) Sets the scale for the particle player emission rate.\n"
  61. "@param scale The scale for the particle player emission rate.\n"
  62. "@return No return value.")
  63. {
  64. object->setEmissionRateScale( dAtof(argv[2]) );
  65. }
  66. //-----------------------------------------------------------------------------
  67. ConsoleMethod(ParticlePlayer, getEmissionRateScale, F32, 2, 2, "() Gets the scale for the particle player emission rate.\n"
  68. "@return The scale for the particle player emission rate.")
  69. {
  70. return object->getEmissionRateScale();
  71. }
  72. //-----------------------------------------------------------------------------
  73. ConsoleMethod(ParticlePlayer, setSizeScale, void, 3, 3, "(scale) Sets the scale for the particle player particle sizes.\n"
  74. "@param scale The scale for the particle player particle sizes.\n"
  75. "@return No return value.")
  76. {
  77. object->setSizeScale( dAtof(argv[2]) );
  78. }
  79. //-----------------------------------------------------------------------------
  80. ConsoleMethod(ParticlePlayer, getSizeScale, F32, 2, 2, "() Gets the scale for the particle player particle sizes.\n"
  81. "@return The scale for the particle player particle sizes.")
  82. {
  83. return object->getSizeScale();
  84. }
  85. //-----------------------------------------------------------------------------
  86. ConsoleMethod(ParticlePlayer, setForceScale, void, 3, 3, "(scale) Sets the scale for the particle player forces.\n"
  87. "@param scale The scale for the particle player forces.\n"
  88. "@return No return value.")
  89. {
  90. object->setForceScale( dAtof(argv[2]) );
  91. }
  92. //-----------------------------------------------------------------------------
  93. ConsoleMethod(ParticlePlayer, getForceScale, F32, 2, 2, "() Gets the scale for the particle player forces.\n"
  94. "@return The scale for the particle player forces.")
  95. {
  96. return object->getForceScale();
  97. }
  98. //-----------------------------------------------------------------------------
  99. ConsoleMethod(ParticlePlayer, setTimeScale, void, 3, 3, "(scale) Sets the scale for the particle player particle lifetimes.\n"
  100. "@param scale The scale for the particle player particle lifetimes.\n"
  101. "@return No return value.")
  102. {
  103. object->setTimeScale( dAtof(argv[2]) );
  104. }
  105. //-----------------------------------------------------------------------------
  106. ConsoleMethod(ParticlePlayer, getTimeScale, F32, 2, 2, "() Gets the scale for the particle player particle lifetimes.\n"
  107. "@return The scale for the particle player particle lifetimes.")
  108. {
  109. return object->getTimeScale();
  110. }
  111. //-----------------------------------------------------------------------------
  112. ConsoleMethod(ParticlePlayer, play, bool, 2, 3, "([resetParticles]) Starts the particle player playing.\n"
  113. "@param resetParticles Whether to reset any existing particles before starting to play. Default is true.\n"
  114. "@return Returns true on success and false otherwise.")
  115. {
  116. // Fetch the reset-particle flag.
  117. const bool resetParticles = argc >= 3 ? dAtob(argv[2]) : true;
  118. return object->play( resetParticles );
  119. }
  120. //-----------------------------------------------------------------------------
  121. ConsoleMethod(ParticlePlayer, stop, void, 2, 4, "([waitForParticles?, killEffect?]) - Stops the Particle Effect.\n"
  122. "@param waitForParticles Whether or not the effect should wait until all of its particles have run their course, or just stop immediately and delete the particles (default true).\n"
  123. "@param killEffect Whether or not the effect should be deleted after it has stopped (default false).\n"
  124. "@return No return value.")
  125. {
  126. // Fetch the wait-for-particles flag.
  127. const bool waitForParticles = argc >= 3 ? dAtob(argv[2]) : true;
  128. // Fetch the kill-effect flag.
  129. const bool killEffect = argc >= 4 ? dAtob(argv[3]) : false;
  130. // Stop playing.
  131. object->stop( waitForParticles, killEffect );
  132. }
  133. //-----------------------------------------------------------------------------
  134. ConsoleMethod(ParticlePlayer, getIsPlaying, bool, 2, 2, "() Gets whether the particle player is playing or not.\n"
  135. "@return Whether the particle player is playing or not." )
  136. {
  137. return object->getIsPlaying();
  138. }
  139. //-----------------------------------------------------------------------------
  140. ConsoleMethod(ParticlePlayer, setPaused, void, 3, 3, "(paused?) Sets whether the particle player is paused or not.\n"
  141. "@param paused Whether the particle player is paused or not.\n"
  142. "@return No return value.")
  143. {
  144. object->setPaused( dAtob(argv[2]) );
  145. }
  146. //-----------------------------------------------------------------------------
  147. ConsoleMethod(ParticlePlayer, getPaused, bool, 2, 2, "() Gets whether the particle player is paused or not.\n"
  148. "@return Whether the particle player is paused or not.")
  149. {
  150. return object->getPaused();
  151. }
  152. //-----------------------------------------------------------------------------
  153. ConsoleMethod(ParticlePlayer, setEmitterPaused, void, 4, 4, "(paused, emitterIndex) Sets whether the specified particle emitter is paused or not.\n"
  154. "@param paused Whether the specified particle emitter is paused or not.\n"
  155. "@param emitterIndex The index of the emitter to modify.\n"
  156. "@return No return value.")
  157. {
  158. object->setEmitterPaused( dAtob(argv[2]), dAtoi(argv[3]) );
  159. }
  160. //-----------------------------------------------------------------------------
  161. ConsoleMethod(ParticlePlayer, getEmitterPaused, bool, 3, 3, "(emitterIndex) Gets whether the specified particle emitter is paused or not.\n"
  162. "@param emitterIndex The index of the emitter to modify.\n"
  163. "@return Whether the specified particle emitter is paused or not.")
  164. {
  165. return object->getEmitterPaused( dAtob(argv[2]) );
  166. }
  167. //-----------------------------------------------------------------------------
  168. ConsoleMethod(ParticlePlayer, setEmitterVisible, void, 4, 4, "(visible, emitterIndex) Sets whether the specified particle emitter is visible or not.\n"
  169. "@param paused Whether the specified particle emitter is visible or not.\n"
  170. "@param emitterIndex The index of the emitter to modify.\n"
  171. "@return No return value.")
  172. {
  173. object->setEmitterVisible( dAtob(argv[2]), dAtoi(argv[3]) );
  174. }
  175. //-----------------------------------------------------------------------------
  176. ConsoleMethod(ParticlePlayer, getEmitterVisible, bool, 3, 3, "(emitterIndex) Gets whether the specified particle emitter is visible or not.\n"
  177. "@param emitterIndex The index of the emitter to modify.\n"
  178. "@return Whether the specified particle emitter is visible or not.")
  179. {
  180. return object->getEmitterVisible( dAtob(argv[2]) );
  181. }