reference.adoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. = Next Generation Particles - Reference
  2. :revnumber: 2.0
  3. :revdate: 2020/07/25
  4. The Parameters for a ParticleController are:
  5. [cols="2", options="header"]
  6. |===
  7. a| name
  8. a| The name to use for the geometry in the scene graph
  9. a| mesh
  10. a| The mesh to use (Usually either PointMesh or QuadMesh)
  11. a| maxParticles
  12. a| The maximum number of particles to allow active at any one time
  13. a| lifeMin
  14. a| The minimum amount of time (in seconds) for which each particle lives
  15. a| lifeMax
  16. a| The maximum amount of time (in seconds) for which each particle lives
  17. a| source
  18. a| The source from which the particles are spawned
  19. a| emissionController
  20. a| The frequency and timing with which particles are spawned. If null then no particles are automatically spawned and they must be triggered manually using emitNextParticle() or emitAllParticles()
  21. a| influencers
  22. a| Zero or more ParticleInfluencers, each of which changes the behaviour of the particles.
  23. |===
  24. All of the following classes have defined Interfaces or Abstract Classes to allow custom implementations and behaviour to easily be plugged into the system.
  25. Javadoc for the system can be found at link:http://www.zero-separation.com/particles/javadoc[http://www.zero-separation.com/particles/javadoc]
  26. == Mesh
  27. The Mesh options are:
  28. [cols="2", options="header"]
  29. |===
  30. a| PointMesh
  31. a| Fastest and most efficient, but also most limited
  32. a| QuadMesh
  33. a| Much more flexible than point mesh, all particles are represented as 2-dimensional quads
  34. a| TemplateMesh
  35. a| Allows particles to be full 3d objects, with the mesh for each particle being generated from one of any number of template meshes. This allows fully 3d particles and takes in texture co-ordinates and even (if required) vertex colours and normals from the original mesh converting them as required.
  36. |===
  37. == Source
  38. The Source options are:
  39. [cols="2", options="header"]
  40. |===
  41. a| PointSource
  42. a| Generates all particles from a specific point with a random velocity. The point itself is a spatial so can be attached to the scene graph and will move with it.
  43. a| MeshSource
  44. a| Generates all particles from a randomly selected point on the given mesh. A random triangle is selected and then the particle emitter from a random point within that triangle along the triangle's normal vector.
  45. a| WeightedMeshSource
  46. a| Provides the same functionality as MeshSource but weights triangles based on their relative size, larger triangles will tend to emit more particles. This provides a more even spread but uses more resources and needs to be kept updated if the mesh changes.
  47. a| ParticleParticleSource
  48. a| Emits particles from another ParticleController. The particle is emitted from a randomly selected active particle and the new particle starts with identical velocity, rotation, etc as the particle it is being emitted from.
  49. |===
  50. == EmissionControllers
  51. [cols="2", options="header"]
  52. |===
  53. a| NULL
  54. a| The NULL EmissionController does not automatically emit any particles, they must be emitted externally by a call to the ParticleController emitNextParticle() or emitAllParticles(). Note that if the ParticleController is not in use for an extended period of time it is recommended that to save resources you pause it by either disabling the controller or removing the Geometry from the scene graph.
  55. a| RegularEmission
  56. a| This EmissionController just emits particles at regular intervals, it will emit multiple particles in one frame if more than one interval has passed since the previous frame.
  57. |===
  58. == Influencers
  59. [cols="2", options="header"]
  60. |===
  61. a| ColorInfluencer
  62. a| Modify the particle's color over time
  63. a| GravityInfluencer
  64. a| Apply steady acceleration in a specified direction over time
  65. a| MultiColorInfluencer
  66. a| Modify the particle's color through multiple colors over time
  67. a| PreferredDestinationInfluencer
  68. a| Move the particle towards a specified point
  69. a| PreferredDirectionInfluencer
  70. a| Rotate the particles velocity towards the given direction over time
  71. a| RandomImpulseInfluencer
  72. a| Apply a random impulse to the particle either at initialization or every frame
  73. a| RandomSpriteInfluencer
  74. a| Select a random sprite for the particle from those available when it is initialized
  75. a| RotationInfluencer
  76. a| Rotate the particle by picking an initial rotational velocity at random and then maintaining it
  77. a| SizeInfluencer
  78. a| Modify the particle's size over time
  79. a| SpatialDestinationInfluencer
  80. a| Move the particle towards a given spatial, it will attempt to reach the current location of the spatial by the end of the particle's life cycle.
  81. a| SpeedInfluencer
  82. a| Modify the particle's speed over time
  83. a| SpriteAnimationInfluencer
  84. a| Animate the particle through the available sprites over time
  85. |===