@neutrinoparticles/js-v1.1-phaser 1.0.0 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## CurrentVersion
3
+ ## [1.1.0] - 2026-08-03
4
+
5
+ - Emitter properties can now be **read** as well as written: `getEmitterPropertyValue()`, `hasEmitterProperty()` and `getEmitterProperties()` (which lists every property an effect exposes, with its live value). `setPropertyInEmitter()`, for addressing a single emitter by name, is now available on the effect too
6
+
7
+ - Initial Phaser 3 integration for the JS v1.1 export format (GPU geometry construction, data-texture renderer). Works on WebGL2 and, automatically, on WebGL1 contexts with float vertex textures — Phaser's default WebGL1 context works out of the box.
8
+ - Added perspective projection (Projection3D) support, matching the PIXI and Phaser 4 integrations: pass `projection: new PhaserNeutrino.PerspectiveProjection(angle)` in the effect options and particles scale with their distance from the camera. Particles that cross the near plane are discarded as whole quads.
9
+ - Fixed strip texture seams: a ribbon whose atlas texture repeats along its length no longer shows a muddy "chewed" column at tile junctions when the texture has mipmaps (WebGL2).
10
+ - Emitter-anchored strips no longer show a brief mis-oriented sliver at the emitter end right after a new particle spawns.
11
+ - Fixed broken ribbon (Strip) geometry on sharp bends: a dark wedge was cut out of the ribbon wherever the path bent sharper than the ribbon's own width, and the segments next to the ribbon's ends (near the emitter and at the tail) could render as a twisted, mostly-invisible band or a stray misoriented quad — most visible right where the ribbon is being created when the head particle sits close to the emitter (issue #236).
12
+
13
+ ## [1.0.1] - 2026-07-25
4
14
 
5
15
  - Initial Phaser 3 integration for the JS v1.1 export format (GPU geometry construction, data-texture renderer). Works on WebGL2 and, automatically, on WebGL1 contexts with float vertex textures — Phaser's default WebGL1 context works out of the box.
6
16
  - Fixed strip texture seams: a ribbon whose atlas texture repeats along its length no longer shows a muddy "chewed" column at tile junctions when the texture has mipmaps (WebGL2).
17
+ - Emitter-anchored strips no longer show a brief mis-oriented sliver at the emitter end right after a new particle spawns.
18
+ - Fixed broken ribbon (Strip) geometry on sharp bends: a dark wedge was cut out of the ribbon wherever the path bent sharper than the ribbon's own width, and the segments next to the ribbon's ends (near the emitter and at the tail) could render as a twisted, mostly-invisible band or a stray misoriented quad — most visible right where the ribbon is being created when the head particle sits close to the emitter (issue #236).
package/README.md CHANGED
@@ -187,10 +187,41 @@ effect.unpause();
187
187
  Control exposed emitter properties at runtime. Properties are defined in Emitter Guide or Emitter Scheme in the Editor.
188
188
 
189
189
  ```javascript
190
+ // Write to every emitter that declares the property...
190
191
  effect.setPropertyInAllEmitters('MyParticlesPerSecond', 100);
191
192
  effect.setPropertyInAllEmitters('MyColor', [1.0, 0.5, 0.2]);
193
+
194
+ // ...or address a single emitter by name.
195
+ effect.setPropertyInEmitter('Sparks', 'MyColor', [1.0, 0.5, 0.2]);
196
+ ```
197
+
198
+ Read the current values back. A scalar property returns a `number`, a vector
199
+ property returns a `number[]`, and an unknown property returns `undefined`:
200
+
201
+ ```javascript
202
+ effect.getEmitterPropertyValue('Sparks', 'MyColor'); // [1.0, 0.5, 0.2]
203
+ effect.getEmitterPropertyValue('MyParticlesPerSecond'); // 100 — first emitter with it
204
+
205
+ effect.hasEmitterProperty('Sparks', 'MyColor'); // true
206
+ effect.hasEmitterProperty('NoSuchProperty'); // false
192
207
  ```
193
208
 
209
+ Discover what an effect exposes without knowing the names up front:
210
+
211
+ ```javascript
212
+ for (const p of effect.getEmitterProperties()) {
213
+ // { emitterName: 'Sparks', name: 'MyColor', arity: 3, value: [1, 0.5, 0.2] }
214
+ console.log(p.emitterName, p.name, p.arity, p.value);
215
+ }
216
+ ```
217
+
218
+ Values are read live from the simulation buffer at call time.
219
+
220
+ > **Use only the documented methods above.** Exported effects are minified, and
221
+ > the internal property names/objects they contain (`_globParamMeta`, or whatever
222
+ > short name it was mangled to) are not a stable API — they change between editor
223
+ > versions and differ between commercial and non-commercial exports.
224
+
194
225
  ## Number of Particles
195
226
 
196
227
  ```javascript
@@ -203,6 +234,12 @@ const numParticles = effect.getNumParticles();
203
234
  - **No particles visible:** Make sure the export target in the editor is set to JavaScript v1.1. Verify `texturesBasePath` points to the correct textures directory.
204
235
  - **Turbulence not working:** Set `generateNoise: true` in the plugin config, or call the plugin's `generateNoise()` before creating effects that use noise.
205
236
 
237
+ ## HDR Bloom (optional add-on)
238
+
239
+ The scene-preserving HDR glow that matches the editor preview is currently available for
240
+ **PIXI.js** ([`bloom-v1.1-pixi7`](../bloom-pixi7) / [`bloom-v1.1-pixi8`](../bloom-pixi8)) and
241
+ **MonoGame**. A Phaser bloom add-on is not available yet.
242
+
206
243
  ## Documentation
207
244
 
208
245
  Full documentation at [neutrinoparticles.com](https://neutrinoparticles.com/en/docs/199).
package/dist/Effect.d.ts CHANGED
@@ -2,13 +2,15 @@ import Phaser from 'phaser';
2
2
  import { Pause, Vec2, Vec3 } from './types';
3
3
  import { GamePlugin } from './GamePlugin';
4
4
  import { EffectModel } from './EffectModel';
5
- import { NeutrinoSystem } from './types';
5
+ import { NeutrinoEmitterProperty, NeutrinoSystem } from './types';
6
+ import { PerspectiveProjection } from './PerspectiveProjection';
6
7
  export interface EffectOptions {
7
8
  position?: Vec3;
8
9
  angle?: number;
9
10
  scale?: number;
10
11
  pause?: Pause;
11
12
  generatorsPaused?: boolean;
13
+ projection?: PerspectiveProjection;
12
14
  }
13
15
  /**
14
16
  * A NeutrinoParticles effect on a Phaser scene (JS v1.1 runtime).
@@ -34,6 +36,8 @@ export declare class Effect extends Phaser.GameObjects.GameObject {
34
36
  alpha: number;
35
37
  depth: number;
36
38
  blendMode: number;
39
+ /** Optional v1.0-parity perspective projection (Projection3D). */
40
+ projection?: PerspectiveProjection;
37
41
  private _dataTextureManager;
38
42
  private _worldPosition;
39
43
  private _worldScaledPosition;
@@ -64,6 +68,12 @@ export declare class Effect extends Phaser.GameObjects.GameObject {
64
68
  unpauseGenerators(): void;
65
69
  get generatorsPaused(): boolean;
66
70
  setPropertyInAllEmitters(name: string, value: Vec3 | Vec2 | number): void;
71
+ setPropertyInEmitter(emitterName: string, name: string, value: Vec3 | Vec2 | number): void;
72
+ getEmitterPropertyValue(name: string): number | number[] | undefined;
73
+ getEmitterPropertyValue(emitterName: string, name: string): number | number[] | undefined;
74
+ hasEmitterProperty(name: string): boolean;
75
+ hasEmitterProperty(emitterName: string, name: string): boolean;
76
+ getEmitterProperties(): NeutrinoEmitterProperty[];
67
77
  getNumParticles(): number;
68
78
  setScrollFactor(x: number, y?: number): this;
69
79
  setAlpha(topLeft?: number, _topRight?: number, _bottomLeft?: number, _bottomRight?: number): this;
@@ -2,6 +2,7 @@ import { NeutrinoContext } from "./NeutrinoContext";
2
2
  import { DataTextureManager } from "./DataTextureManager";
3
3
  import { DataTextureManagerGL1 } from "./gl1/DataTextureManagerGL1";
4
4
  import { NeutrinoSubRect } from "./types";
5
+ import { PerspectiveProjection } from "./PerspectiveProjection";
5
6
  export interface RenderParams {
6
7
  /** Effect world transform (2x3) already including world scale. */
7
8
  model: {
@@ -21,6 +22,9 @@ export interface RenderParams {
21
22
  zoom: number;
22
23
  /** Host scene-graph world alpha, multiplied into each particle's alpha. */
23
24
  worldAlpha: number;
25
+ /** Optional v1.0-parity perspective projection (Projection3D); when set,
26
+ * uViewProjMatrix = ortho * perspective (both in screen space). */
27
+ projection?: PerspectiveProjection;
24
28
  /** Per-particle GL textures (one per render-style texture index). */
25
29
  glTextures: (WebGLTexture | null)[];
26
30
  remaps: Array<NeutrinoSubRect | null>;
@@ -43,12 +47,16 @@ export interface RenderParams {
43
47
  */
44
48
  export declare class NeutrinoRenderer {
45
49
  private _orthoMatrix;
50
+ private _perspMatrix;
51
+ private _vpMatrix;
52
+ private _projFrame;
46
53
  private _modelMatrix;
47
54
  private _texSlotMap;
48
55
  private _batchPool;
49
56
  private _batchCount;
50
57
  constructor();
51
58
  render(ctx: NeutrinoContext, dtm: DataTextureManager | DataTextureManagerGL1, dataView: DataView, dataUint32: Uint32Array, instructions: any[], numParticles: number, params: RenderParams): void;
59
+ private _mulMatrix;
52
60
  private _resolveBlend;
53
61
  private _applyBlendMode;
54
62
  }
@@ -62,4 +62,14 @@ export declare class PerspectiveProjection {
62
62
  */
63
63
  transformSize(outSize: Vec2, pos: Vec3, size: Vec2): void;
64
64
  _getScale(pos: Vec3): number;
65
+ /**
66
+ * Writes the projection as a 4x4 column-major matrix operating in screen
67
+ * space, for the GPU render path. Homogeneous equivalent of
68
+ * transformPosition(): clip.xy = p.xy - center * (p.z / z),
69
+ * clip.w = 1 - p.z / z; the z row is zeroed (no depth on this path).
70
+ * setScreenFrame() must have been called before.
71
+ *
72
+ * @param {Float32Array} out 16-element column-major output matrix.
73
+ */
74
+ writeMatrix(out: Float32Array): void;
65
75
  }