gamnit :: ParticleSystem :: add
center
with scale
, living for ttl
from time_offset
time_offset
is added to the creation time, it can be used to delay the
apparition of a particle using a positive value.
See the doc of the precise class of program
, or the general ParticleProgram
for information on the effect of these parameters.
# Add a particle at `center` with `scale`, living for `ttl` from `time_offset`
#
# `time_offset` is added to the creation time, it can be used to delay the
# apparition of a particle using a positive value.
#
# See the doc of the precise class of `program`, or the general `ParticleProgram`
# for information on the effect of these parameters.
fun add(center: Point3d[Float], scale: Float, ttl: Float, time_offset: nullable Float)
do
var i = total_particles % n_particles
total_particles += 1
centers[i*3 ] = center.x
centers[i*3+1] = center.y
centers[i*3+2] = center.z
ttls[i] = ttl
scales[i] = scale
time_offset = time_offset or else 0.0
ots[i] = clock.total.to_f + time_offset
end
lib/gamnit/depth/particles.nit:102,2--123,4