three-low-poly 1.0.0 → 1.0.1

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/dist/index.d.ts CHANGED
@@ -19,7 +19,6 @@ import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.j
19
19
  import { PerspectiveCamera } from 'three';
20
20
  import { PlaneGeometry } from 'three';
21
21
  import { PointLight } from 'three';
22
- import { Points } from 'three';
23
22
  import { Quaternion } from 'three';
24
23
  import { Shape } from 'three';
25
24
  import { ShapeGeometry } from 'three';
@@ -3764,11 +3763,11 @@ export declare class Star extends Mesh<StarGeometry, MeshStandardMaterial> {
3764
3763
  }
3765
3764
 
3766
3765
  export declare interface StarBurstShapeOptions {
3767
- /** Burst ray count. Defaults to `4`. */
3766
+ /** Burst ray count. Defaults to `4` point diffraction spike. */
3768
3767
  sides?: number;
3769
3768
  innerRadius?: number;
3770
3769
  outerRadius?: number;
3771
- /** Extrusion depth; keep small for flat starbursts. Defaults to `0.05`. */
3770
+ /** Extrusion depth (`orientation: "radial"` only — billboards are flat). Defaults to `0.05`. */
3772
3771
  depth?: number;
3773
3772
  }
3774
3773
 
@@ -3780,27 +3779,27 @@ export declare interface StarBurstShapeOptions {
3780
3779
  * every frame. Parenting to the camera is not supported: Three.js does not render
3781
3780
  * objects attached to the active camera.
3782
3781
  *
3783
- * **Styles**
3782
+ * **Orientation** — the only axis that distinguishes how stars are drawn:
3784
3783
  *
3785
- * - `points` — lightweight `Points` sprites using a canvas starburst texture.
3786
- * - `burst` instanced 3D starbursts ({@link BurstGeometry}) that face the shell center.
3787
- * Uses `DoubleSide` so stars remain visible when the camera sits inside the shell.
3784
+ * - `billboard` — screen-aligned via `SpriteNodeMaterial`, with per-star position, scale,
3785
+ * and rotation supplied as instanced attributes. The field stays visually fixed as the
3786
+ * camera orbits. Flat by construction: only the geometry's XY profile is used.
3787
+ * - `radial` — instanced 3D meshes rotated to face the shell center, drawn `DoubleSide` so
3788
+ * stars stay visible from inside the shell.
3789
+ *
3790
+ * Both orientations render as a single instanced draw call, so the geometry you pass is a
3791
+ * matter of looks rather than cost.
3788
3792
  *
3789
3793
  * **Sizing** — `sizeMin` / `sizeMax` are angular extents (radians at unit distance),
3790
3794
  * multiplied by each star's distance from the origin so stars look similar regardless
3791
3795
  * of shell depth (`minRadius`–`maxRadius`).
3792
3796
  *
3793
- * **Rendering** — `frustumCulled` is disabled and materials use `depthWrite: false` so
3794
- * the field draws reliably as a background layer. For per-star color variation in burst
3795
- * mode, colors are written via `InstancedMesh.setColorAt`, not `vertexColors` on the
3796
- * base material.
3797
- *
3798
3797
  * @example
3799
3798
  * ```typescript
3800
3799
  * const stars = new StarFieldEffect({
3801
- * style: "burst",
3802
3800
  * count: 2500,
3803
3801
  * radius: 480,
3802
+ * rotationJitter: 0, // every burst locked vertical on screen
3804
3803
  * twinkle: true,
3805
3804
  * });
3806
3805
  *
@@ -3813,52 +3812,61 @@ export declare interface StarBurstShapeOptions {
3813
3812
  * }
3814
3813
  * ```
3815
3814
  *
3816
- * Call {@link dispose} when removing the effect to free geometry, materials, and the
3817
- * points sprite texture.
3815
+ * Call {@link dispose} when removing the effect to free geometry and materials.
3818
3816
  */
3819
3817
  export declare class StarFieldEffect extends Object3D {
3820
- readonly style: "points" | "burst";
3818
+ readonly orientation: StarFieldOrientation;
3821
3819
  private readonly field;
3822
3820
  private readonly twinkle;
3823
- private readonly baseSize;
3824
3821
  private readonly baseScales?;
3825
3822
  private readonly twinklePhases?;
3826
- /** Untwinkled per-point RGB (points style), multiplied by each star's pulse each frame. */
3827
- private baseColors?;
3828
- private spriteTexture?;
3823
+ /** Billboard scale attribute, rewritten each frame while twinkling. */
3824
+ private scaleAttribute?;
3829
3825
  private readonly dummy;
3830
3826
  constructor(options?: StarFieldEffectOptions);
3831
- get drawable(): Points | InstancedMesh;
3827
+ get mesh(): InstancedMesh;
3832
3828
  get geometry(): BufferGeometry;
3833
3829
  get material(): Material | Material[];
3834
- /** Release GPU resources held by the field (and sprite texture, if any). */
3830
+ /** Release GPU resources held by the field. */
3835
3831
  dispose(): void;
3836
3832
  /**
3837
3833
  * Animate twinkling. No-op when `twinkle` is `false`.
3838
3834
  *
3839
- * Both styles pulse with a per-star phase offset so stars twinkle out of sync:
3840
- * points modulate per-point brightness (via the color attribute), burst pulses
3841
- * each instance scale. Pass elapsed time in seconds (defaults to `performance.now()`).
3835
+ * Each star pulses on its own phase offset so the field twinkles out of sync. Billboards
3836
+ * rewrite the instanced scale attribute; radial stars rebuild each instance matrix.
3837
+ * Pass elapsed time in seconds (defaults to `performance.now()`).
3842
3838
  */
3843
3839
  update(elapsed?: number): void;
3844
- private createPointsField;
3845
- private createBurstField;
3840
+ /**
3841
+ * Screen-aligned stars. `SpriteNodeMaterial` builds its quad from the geometry's XY and
3842
+ * reads the sprite center from `positionNode` — it never consults `instanceMatrix` — so
3843
+ * every per-star value has to arrive as an instanced attribute.
3844
+ */
3845
+ private createBillboardField;
3846
+ /** Full 3D stars rotated to face the shell center. */
3847
+ private createRadialField;
3846
3848
  }
3847
3849
 
3848
3850
  export declare interface StarFieldEffectOptions {
3849
3851
  /**
3850
- * Rendering style.
3852
+ * How each star faces the viewer.
3851
3853
  *
3852
- * - `points` (default) — billboard sprites with a procedural starburst texture
3853
- * (not the default square `Points` marker).
3854
- * - `burst` instanced {@link BurstGeometry} meshes oriented toward the shell center.
3854
+ * - `billboard` (default) — every star is screen-aligned, so the field holds its
3855
+ * orientation as the camera orbits. Only the geometry's **XY profile** is drawn;
3856
+ * any Z extent is ignored.
3857
+ * - `radial` — full 3D geometry rotated to face the shell center. Depth is real here,
3858
+ * and stars shear as the camera moves, the way any world-space mesh does.
3855
3859
  */
3856
- style?: "points" | "burst";
3857
- /** Shape parameters for both styles; `burst` uses them for geometry, `points` for the sprite. */
3860
+ orientation?: StarFieldOrientation;
3861
+ /** Star shape used to build the default {@link BurstGeometry}. */
3858
3862
  burst?: StarBurstShapeOptions;
3859
- /** Override the burst mesh geometry (`style: "burst"` only). */
3863
+ /** Replace the star geometry entirely. Billboards use its XY profile; radial uses all of it. */
3860
3864
  geometry?: BufferGeometry;
3861
- /** Override the default field material. */
3865
+ /**
3866
+ * Override the default field material. In `billboard` mode this must be a
3867
+ * `SpriteNodeMaterial` — per-star position, scale, and rotation are assigned onto it
3868
+ * as node inputs.
3869
+ */
3862
3870
  material?: Material;
3863
3871
  /** Number of stars. Defaults to `1500`. */
3864
3872
  count?: number;
@@ -3879,8 +3887,26 @@ export declare interface StarFieldEffectOptions {
3879
3887
  color?: ColorRepresentation | ColorRepresentation[];
3880
3888
  /** Enable pulsing brightness; call {@link StarFieldEffect.update} each frame when `true`. */
3881
3889
  twinkle?: boolean;
3890
+ /**
3891
+ * Base star rotation, in radians. Defaults to `0`.
3892
+ *
3893
+ * Measured in screen space for `billboard` and world space for `radial` — the same knob
3894
+ * means different things, because a billboard re-aligns every frame and a radial star
3895
+ * does not.
3896
+ */
3897
+ rotation?: number;
3898
+ /**
3899
+ * Random rotation spread added per star, in radians. Defaults to `Math.PI * 2`.
3900
+ *
3901
+ * `0` aligns every star — with `billboard` that yields a coherent diffraction-spike field
3902
+ * that stays locked as the camera orbits. `2π` is fully random.
3903
+ */
3904
+ rotationJitter?: number;
3882
3905
  }
3883
3906
 
3907
+ /** How each star is turned to face the viewer. */
3908
+ export declare type StarFieldOrientation = "billboard" | "radial";
3909
+
3884
3910
  /**
3885
3911
  * Extruded star prism.
3886
3912
  */