lecodes-sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,7 @@ const TAG_VELOCITY_LIFE = 19
42
42
  const TAG_ORDER = 20
43
43
  const TAG_SMOOTH_PATH = 21
44
44
  const TAG_RIBBON_ORIENT = 22
45
+ const TAG_LIT = 23
45
46
  /** `TrailOptions.orient` → the native axis code (0 = the camera-facing default). */
46
47
  const RIBBON_AXIS: Record<"camera" | "x" | "y" | "z", number> = { camera: 0, x: 1, y: 2, z: 3 }
47
48
 
@@ -54,6 +55,7 @@ export const _particleTags = {
54
55
  RENDER_MODE: TAG_RENDER_MODE, MESH_GEOMETRY: TAG_MESH_GEOMETRY,
55
56
  ANGULAR_VELOCITY: TAG_ANGULAR_VELOCITY, GROUND: TAG_GROUND, VELOCITY_LIFE: TAG_VELOCITY_LIFE,
56
57
  ORDER: TAG_ORDER, SMOOTH_PATH: TAG_SMOOTH_PATH, RIBBON_ORIENT: TAG_RIBBON_ORIENT,
58
+ LIT: TAG_LIT,
57
59
  }
58
60
 
59
61
  // --- curve builders -----------------------------------------------------------------------------
@@ -304,6 +306,15 @@ export type ParticlesOptions = ParticlesMaterialOptions & {
304
306
  * without this the engine picks who covers whom per frame (smoke popping over a fireball).
305
307
  * Default 0; a fireball wants 2, its smoke 1, a smoke trail -1. */
306
308
  order?: number
309
+ /** Sprites take the light of the PLACE each one is in — the level's baked light grid (`env.lightmap.volume`).
310
+ * A sprite is unlit: its colour is the picture, which is right for fire and wrong for dust — a puff kicked up
311
+ * under an awning glows as if it stood in the sun. With `lit` every particle's colour is multiplied by the light
312
+ * where it is, relative to the level's OPEN ground: exactly the authored colour out in the sun, the ambient's
313
+ * share of it (tinted the way the shade is) under a roof — per particle, so a trail of puffs laid from the sun
314
+ * into the shade is lit along its length. Author the colour for the open; nothing else to tune. Without a grid
315
+ * — a level with no bake, a host that has none — the colours are drawn as authored. Points, quads, stretch and
316
+ * `Trail`; mesh particles are lit by their material. Default false. */
317
+ lit?: boolean
307
318
  /** Coarse draw order among ALL blended draws, 0 (first) … 7 (last) — see `Mesh.renderPriority`.
308
319
  * Default 5: meshes sit at 4 and decals at 3, so smoke covers a car's glass and its skid marks
309
320
  * whatever the camera does (the engine's depth sort compares object centres, and an emitter's
@@ -492,6 +503,7 @@ export class Particles extends Node {
492
503
  if (options.rateOverDistance !== undefined) out.push(TAG_RATE_DISTANCE, 1, options.rateOverDistance)
493
504
  if (options.smooth !== undefined) out.push(TAG_SMOOTH_PATH, 1, options.smooth ? 1 : 0)
494
505
  if (options.order !== undefined) out.push(TAG_ORDER, 1, options.order)
506
+ if (options.lit !== undefined) out.push(TAG_LIT, 1, options.lit ? 1 : 0)
495
507
  if (options.rate !== undefined) out.push(TAG_RATE, 1, options.rate)
496
508
  if (options.shape !== undefined) pushShape(out, options.shape)
497
509
  if (options.velocityOverLife !== undefined) pushVelocityLife(out, options.velocityOverLife)
@@ -547,6 +559,8 @@ export class Particles extends Node {
547
559
  /** Lay a frame's spawns along a curve through the emitter's path, not the straight chord. */
548
560
  set smooth(val: boolean) { this._send([ TAG_SMOOTH_PATH, 1, val ? 1 : 0 ]) }
549
561
  set order(val: number) { this._send([ TAG_ORDER, 1, val ]) }
562
+ /** Colours × the baked light where each particle is — see `ParticlesOptions.lit`. */
563
+ set lit(val: boolean) { this._send([ TAG_LIT, 1, val ? 1 : 0 ]) }
550
564
  /** Coarse draw order, 0 … 7 — see `Mesh.renderPriority`. Write-only. */
551
565
  set renderPriority(v: number) {
552
566
  if (_creator.setRenderPriority) _creator.setRenderPriority(this.id, Math.max(0, Math.min(7, Math.round(v))))
@@ -644,6 +658,9 @@ export type TrailOptions = Omit<ParticlesMaterialOptions, "render" | "stretch">
644
658
  * frame rate, since a longer frame bows further off its own chord. Default false; see
645
659
  * `ParticlesOptions.smooth`. */
646
660
  smooth?: boolean
661
+ /** The strip takes the baked light of the place each of its points is at — `ParticlesOptions.lit`. Smoke and
662
+ * dust trails; leave it off for a glowing one. Default false. */
663
+ lit?: boolean
647
664
  /** Which way the strip's WIDTH points.
648
665
  *
649
666
  * `'camera'` (default) rolls the strip about its own length to stay flat to the viewer — it can
@@ -689,6 +706,7 @@ export class Trail extends Node {
689
706
  TAG_LIFETIME, 2, time, time,
690
707
  ]
691
708
  if (options.smooth) out.push(TAG_SMOOTH_PATH, 1, 1)
709
+ if (options.lit) out.push(TAG_LIT, 1, 1)
692
710
  if (options.orient !== undefined || options.faceCamera !== undefined) {
693
711
  this._orient = RIBBON_AXIS[options.orient ?? "camera"]
694
712
  if (options.faceCamera !== undefined) this._faceCamera = options.faceCamera
@@ -732,6 +750,7 @@ export class Trail extends Node {
732
750
 
733
751
  /** Follow a curve through the emitter's path instead of the straight chord between frames. */
734
752
  set smooth(val: boolean) { this._send([ TAG_SMOOTH_PATH, 1, val ? 1 : 0 ]) }
753
+ set lit(val: boolean) { this._send([ TAG_LIT, 1, val ? 1 : 0 ]) }
735
754
 
736
755
  /** Which way the strip's width points — see `TrailOptions.orient`. Keeps the current `faceCamera`. */
737
756
  set orient(val: "camera" | "x" | "y" | "z") {