public override void initParticle(Emitter emitter, Particle particle) { ParticleImpl particleImpl = (ParticleImpl)particle; float dt = 0; EmitterData emitterData = (EmitterData)emitter.data(); GeneratorPeriodic generator = (GeneratorPeriodic)emitter.generator(); GeneratorImpl generatorImpl = (GeneratorImpl)generator.impl(); particleImpl._lifetime = 0F; float rnd_ = 0F + emitter.random()() * (1F - 0F); float _path_in = _math.clamp_(rnd_, 0, 1); _math.PathRes _path_srch = _path_in < 0.495668?_math.pathRes(0, (_path_in - 0F) * 2.01748F):_math.pathRes(1, (_path_in - 0.495668F) * 1.98282F); _math.vec2 _path_pos; _math.pathLerp1(out _path_pos, this._path[_path_srch.s], _path_srch.i); _math.vec3 conv3d_ = _math.vec3_(_path_pos.x, _path_pos.y, 0F); particleImpl._Position = _math.addv3_(conv3d_, emitter.position()); _math.vec3 randvec_ = _math.randv3gen_(100F, emitter.random()); particleImpl._Velocity = randvec_; particleImpl._Angle = 0F; particle.position_ = particleImpl._Position; _math.setv2(out particleImpl.prevPosition_, particle.position_.x, particle.position_.y); }
public override void updateParticle(Emitter emitter, Particle particle, float dt) { ParticleImpl particleImpl = (ParticleImpl)particle; EmitterData emitterData = (EmitterData)emitter.data(); GeneratorPeriodic generator = (GeneratorPeriodic)emitter.generator(); GeneratorImpl generatorImpl = (GeneratorImpl)generator.impl(); particleImpl._lifetime += dt; _math.vec3 value_ = _math.vec3_(0F, -300F, 0F); _math.vec3 fmove_fs = value_; _math.vec3 fmove_vs = _math.vec3_(0F, 0F, 0F); float fmove_dtl = dt; _math.vec3 fmove_v = particleImpl._Velocity; _math.vec3 fmove_p = particleImpl._Position; while (fmove_dtl > 0.0001F) { float fmove_dtp = fmove_dtl; _math.vec3 fmove_fsd = fmove_fs; _math.vec3 fmove_rw = _math.subv3_(fmove_vs, fmove_v); float fmove_rwl = _math.lengthv3sq_(fmove_rw); if (fmove_rwl > 0.0001F) { fmove_rwl = (float)Math.Sqrt(fmove_rwl); _math.vec3 fmove_rwn = _math.divv3scalar_(fmove_rw, fmove_rwl); float fmove_df = 0.01F * 1F * fmove_rwl; if (fmove_df * fmove_dtp > 0.2F) { fmove_dtp = 0.2F / fmove_df; } _math.addv3(out fmove_fsd, fmove_fsd, _math.mulv3scalar_(fmove_rwn, fmove_rwl * fmove_df)); } _math.addv3(out fmove_v, fmove_v, _math.mulv3scalar_(fmove_fsd, fmove_dtp)); _math.addv3(out fmove_p, fmove_p, _math.mulv3scalar_(fmove_v, fmove_dtp)); fmove_dtl -= fmove_dtp; } particleImpl._Position = fmove_p; particleImpl._Velocity = fmove_v; float move_ = particleImpl._Angle + particleImpl._Rot__speed * dt; particleImpl._Angle = move_; particle.position_ = particleImpl._Position; float value_a = 2F; if (particleImpl._lifetime > value_a) { particle.dead_ = true; } float value_b = 30F; float _plot_out; float _plot_in0 = (particleImpl._lifetime < 0F?0F:(particleImpl._lifetime > 1F?1F:particleImpl._lifetime)); _math.PathRes _plot_srch0 = _math.pathRes(0, (_plot_in0 - 0F) * 1F); _math.funcLerp(out _plot_out, this._plot[0][_plot_srch0.s], _plot_srch0.i); float expr_ = (value_b * _plot_out); float expr_a = (particleImpl._lifetime / value_a); float _plota_out; float _plota_in0 = (expr_a < 0F?0F:(expr_a > 1F?1F:expr_a)); _math.PathRes _plota_srch0 = _math.pathRes(0, (_plota_in0 - 0F) * 1F); _math.funcLerp(out _plota_out, this._plota[0][_plota_srch0.s], _plota_srch0.i); particleImpl.size1_ = expr_; particleImpl.alpha_ = _plota_out; }
public override void updateParticle(Emitter emitter, Particle particle, float dt) { ParticleImpl particleImpl = (ParticleImpl)particle; EmitterData emitterData = (EmitterData)emitter.data(); GeneratorPeriodic generator = (GeneratorPeriodic)emitter.generator(); GeneratorImpl generatorImpl = (GeneratorImpl)generator.impl(); particleImpl._lifetime += dt; _math.vec3 noise_a = _math.mulv3scalar_(_math.vec3_(100F, 50F, 30F), emitter.effect().time()); _math.addv3(out noise_a, noise_a, particleImpl._Position); _math.vec3 noise_i = _math.mulv3scalar_(noise_a, 1.0F / 500F); _math.vec3 noise = _math.noisePixelLinear3_(noise_i); _math.mulv3(out noise, noise, _math.vec3_(0.0078125F, 0.0078125F, 0.0078125F)); _math.addv3(out noise, noise, _math.vec3_(-1F, -1F, -1F)); _math.mulv3scalar(out noise, noise, 600F); _math.vec3 fmove_fs = noise; _math.vec3 fmove_vs = _math.vec3_(0F, 0F, 0F); float fmove_dtl = dt; _math.vec3 fmove_v = particleImpl._Velocity; _math.vec3 fmove_p = particleImpl._Position; while (fmove_dtl > 0.0001F) { float fmove_dtp = fmove_dtl; _math.vec3 fmove_fsd = fmove_fs; _math.vec3 fmove_rw = _math.subv3_(fmove_vs, fmove_v); float fmove_rwl = _math.lengthv3sq_(fmove_rw); if (fmove_rwl > 0.0001F) { fmove_rwl = (float)Math.Sqrt(fmove_rwl); _math.vec3 fmove_rwn = _math.divv3scalar_(fmove_rw, fmove_rwl); float fmove_df = 0.01F * 1F * fmove_rwl; if (fmove_df * fmove_dtp > 0.2F) { fmove_dtp = 0.2F / fmove_df; } _math.addv3(out fmove_fsd, fmove_fsd, _math.mulv3scalar_(fmove_rwn, fmove_rwl * fmove_df)); } _math.addv3(out fmove_v, fmove_v, _math.mulv3scalar_(fmove_fsd, fmove_dtp)); _math.addv3(out fmove_p, fmove_p, _math.mulv3scalar_(fmove_v, fmove_dtp)); fmove_dtl -= fmove_dtp; } particleImpl._Position = fmove_p; particleImpl._Velocity = fmove_v; particle.position_ = particleImpl._Position; float value_ = 2F; if (particleImpl._lifetime > value_) { particle.dead_ = true; } float expr_ = (particleImpl._lifetime / value_); float _plot_out; float _plot_in0 = (expr_ < 0F?0F:(expr_ > 1F?1F:expr_)); _math.PathRes _plot_srch0 = _math.pathRes(0, (_plot_in0 - 0F) * 1F); _math.funcLerp(out _plot_out, this._plot[0][_plot_srch0.s], _plot_srch0.i); float expr_a = (particleImpl._Size * _plot_out); _math.vec3 expr_b = _math.addv3_(emitterData._Color1, _math.mulv3scalar_(_math.subv3_(emitterData._Color2, emitterData._Color1), particleImpl._Color)); particleImpl.size1_ = expr_a; particleImpl.color_ = expr_b; }
public override void updateParticle(Emitter emitter, Particle particle, float dt) { ParticleImpl particleImpl = (ParticleImpl)particle; EmitterData emitterData = (EmitterData)emitter.data(); GeneratorPeriodic generator = (GeneratorPeriodic)emitter.generator(); GeneratorImpl generatorImpl = (GeneratorImpl)generator.impl(); particleImpl._lifetime += dt; _math.vec3 value_ = _math.vec3_(0F, 800F, 0F); _math.vec3 noise_a = _math.mulv3scalar_(_math.vec3_(100F, 50F, 30F), emitter.effect().time()); _math.addv3(out noise_a, noise_a, particleImpl._Position); _math.vec3 noise_i = _math.mulv3scalar_(noise_a, 1.0F / 1000F); _math.vec3 noise = _math.noisePixelLinear3_(noise_i); _math.mulv3(out noise, noise, _math.vec3_(0.0078125F, 0.0078125F, 0.0078125F)); _math.addv3(out noise, noise, _math.vec3_(-1F, -1F, -1F)); _math.mulv3scalar(out noise, noise, 1200F); _math.vec3 fmove_fs = value_; _math.addv3(out fmove_fs, fmove_fs, noise); _math.vec3 fmove_vs = _math.vec3_(0F, 0F, 0F); float fmove_dtl = dt; _math.vec3 fmove_v = particleImpl._Velocity; _math.vec3 fmove_p = particleImpl._Position; while (fmove_dtl > 0.0001F) { float fmove_dtp = fmove_dtl; _math.vec3 fmove_fsd = fmove_fs; _math.vec3 fmove_rw = _math.subv3_(fmove_vs, fmove_v); float fmove_rwl = _math.lengthv3sq_(fmove_rw); if (fmove_rwl > 0.0001F) { fmove_rwl = (float)Math.Sqrt(fmove_rwl); _math.vec3 fmove_rwn = _math.divv3scalar_(fmove_rw, fmove_rwl); float fmove_df = 0.01F * 1F * fmove_rwl; if (fmove_df * fmove_dtp > 0.2F) { fmove_dtp = 0.2F / fmove_df; } _math.addv3(out fmove_fsd, fmove_fsd, _math.mulv3scalar_(fmove_rwn, fmove_rwl * fmove_df)); } _math.addv3(out fmove_v, fmove_v, _math.mulv3scalar_(fmove_fsd, fmove_dtp)); _math.addv3(out fmove_p, fmove_p, _math.mulv3scalar_(fmove_v, fmove_dtp)); fmove_dtl -= fmove_dtp; } particleImpl._Position = fmove_p; particleImpl._Velocity = fmove_v; particle.position_ = particleImpl._Position; if (particleImpl._lifetime > particleImpl._Max_Life) { particle.dead_ = true; } _math.vec2 value_a = _math.vec2_(6F, 6F); float _plot_out; float _plot_in0 = (particleImpl._lifetime < 0F?0F:(particleImpl._lifetime > 1.35236F?(0F + ((particleImpl._lifetime - 0F) % 1.35236F)):particleImpl._lifetime)); _math.PathRes _plot_srch0 = _plot_in0 < 0.739748?_plot_in0 < 0.4?_plot_in0 < 0.1?_math.pathRes(0, (_plot_in0 - 0F) * 10F):_math.pathRes(1, (_plot_in0 - 0.1F) * 3.33333F):_plot_in0 < 0.558348?_math.pathRes(2, (_plot_in0 - 0.4F) * 6.3152F):_math.pathRes(3, (_plot_in0 - 0.558348F) * 5.51269F):_plot_in0 < 1.03367?_plot_in0 < 0.833292?_math.pathRes(4, (_plot_in0 - 0.739748F) * 10.6901F):_math.pathRes(5, (_plot_in0 - 0.833292F) * 4.99066F):_plot_in0 < 1.2?_math.pathRes(6, (_plot_in0 - 1.03367F) * 6.01203F):_math.pathRes(7, (_plot_in0 - 1.2F) * 6.56334F); _math.funcLerp(out _plot_out, this._plot[0][_plot_srch0.s], _plot_srch0.i); particleImpl.size2_ = value_a; particleImpl.alpha_ = _plot_out; }
public override void updateParticle(Emitter emitter, Particle particle, float dt) { ParticleImpl particleImpl = (ParticleImpl)particle; EmitterData emitterData = (EmitterData)emitter.data(); GeneratorPeriodic generator = (GeneratorPeriodic)emitter.generator(); GeneratorImpl generatorImpl = (GeneratorImpl)generator.impl(); particleImpl._lifetime += dt; _math.vec3 value_ = _math.vec3_(0F, 400F, 0F); _math.vec3 noise_a = _math.mulv3scalar_(_math.vec3_(100F, 50F, 30F), emitter.effect().time()); _math.addv3(out noise_a, noise_a, particleImpl._Position); _math.vec3 noise_i = _math.mulv3scalar_(noise_a, 1.0F / 1000F); _math.vec3 noise = _math.noisePixelLinear3_(noise_i); _math.mulv3(out noise, noise, _math.vec3_(0.0078125F, 0.0078125F, 0.0078125F)); _math.addv3(out noise, noise, _math.vec3_(-1F, -1F, -1F)); _math.mulv3scalar(out noise, noise, 200F); _math.vec3 fmove_fs = value_; _math.addv3(out fmove_fs, fmove_fs, noise); _math.vec3 fmove_vs = _math.vec3_(0F, 0F, 0F); float fmove_dtl = dt; _math.vec3 fmove_v = particleImpl._Velocity; _math.vec3 fmove_p = particleImpl._Position; while (fmove_dtl > 0.0001F) { float fmove_dtp = fmove_dtl; _math.vec3 fmove_fsd = fmove_fs; _math.vec3 fmove_rw = _math.subv3_(fmove_vs, fmove_v); float fmove_rwl = _math.lengthv3sq_(fmove_rw); if (fmove_rwl > 0.0001F) { fmove_rwl = (float)Math.Sqrt(fmove_rwl); _math.vec3 fmove_rwn = _math.divv3scalar_(fmove_rw, fmove_rwl); float fmove_df = 0.01F * 1F * fmove_rwl; if (fmove_df * fmove_dtp > 0.2F) { fmove_dtp = 0.2F / fmove_df; } _math.addv3(out fmove_fsd, fmove_fsd, _math.mulv3scalar_(fmove_rwn, fmove_rwl * fmove_df)); } _math.addv3(out fmove_v, fmove_v, _math.mulv3scalar_(fmove_fsd, fmove_dtp)); _math.addv3(out fmove_p, fmove_p, _math.mulv3scalar_(fmove_v, fmove_dtp)); fmove_dtl -= fmove_dtp; } particleImpl._Position = fmove_p; float value_a = 1.5F; float expr_ = (particleImpl._lifetime / value_a); float _plot_out; float _plot_in0 = (expr_ < 0F?0F:(expr_ > 1F?1F:expr_)); _math.PathRes _plot_srch0 = _math.pathRes(0, (_plot_in0 - 0F) * 15F); _math.funcLerp(out _plot_out, this._plot[0][_plot_srch0.s], _plot_srch0.i); float move_ = particleImpl._Angle + _plot_out * dt; particleImpl._Angle = move_; particleImpl._Velocity = fmove_v; particle.position_ = particleImpl._Position; if (particleImpl._lifetime > value_a) { particle.dead_ = true; } float value_b = 40F; float _plota_out; float _plota_in0 = (expr_ < 0F?0F:(expr_ > 1F?1F:expr_)); _math.PathRes _plota_srch0 = _plota_in0 < 0.2?_math.pathRes(0, (_plota_in0 - 0F) * 75F):_math.pathRes(1, (_plota_in0 - 0.2F) * 18.75F); _math.funcLerp(out _plota_out, this._plota[0][_plota_srch0.s], _plota_srch0.i); float expr_a = (value_b * _plota_out); float _plotb_out; float _plotb_in0 = (expr_ < 0F?0F:(expr_ > 1F?1F:expr_)); _math.PathRes _plotb_srch0 = _plotb_in0 < 0.1?_math.pathRes(0, (_plotb_in0 - 0F) * 10F):_math.pathRes(1, (_plotb_in0 - 0.1F) * 16.6667F); _math.funcLerp(out _plotb_out, this._plotb[0][_plotb_srch0.s], _plotb_srch0.i); particleImpl.size1_ = expr_a; particleImpl.alpha_ = _plotb_out; }