@newkrok/three-particles 2.12.0 → 2.13.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/README.md +1 -0
- package/dist/index.d.ts +59 -2
- package/dist/index.js +227 -22
- package/dist/index.js.map +1 -1
- package/dist/three-particles.min.js +1 -1
- package/dist/three-particles.min.js.map +1 -1
- package/llms-full.txt +37 -1
- package/llms.txt +20 -0
- package/package.json +1 -1
package/llms-full.txt
CHANGED
|
@@ -338,6 +338,8 @@ type Renderer = {
|
|
|
338
338
|
depthTest: boolean; // Default: true
|
|
339
339
|
depthWrite: boolean; // Default: false
|
|
340
340
|
rendererType?: RendererType; // Default: RendererType.POINTS
|
|
341
|
+
trail?: TrailConfig; // Only for RendererType.TRAIL
|
|
342
|
+
mesh?: MeshConfig; // Only for RendererType.MESH
|
|
341
343
|
};
|
|
342
344
|
|
|
343
345
|
enum RendererType {
|
|
@@ -348,11 +350,45 @@ enum RendererType {
|
|
|
348
350
|
TRAIL = 'TRAIL', // Ribbon trails behind particles. Each particle records a position
|
|
349
351
|
// history and the renderer builds a camera-facing triangle-strip
|
|
350
352
|
// ribbon through those samples.
|
|
353
|
+
MESH = 'MESH', // 3D mesh particles via GPU instancing. Each particle is rendered
|
|
354
|
+
// as a full 3D mesh with quaternion-based rotation, normals, and
|
|
355
|
+
// directional lighting. Any THREE.BufferGeometry can be used.
|
|
351
356
|
}
|
|
357
|
+
|
|
358
|
+
type MeshConfig = {
|
|
359
|
+
geometry: THREE.BufferGeometry; // The geometry to render for each particle
|
|
360
|
+
};
|
|
352
361
|
```
|
|
353
362
|
|
|
354
363
|
Common blending modes: `THREE.NormalBlending`, `THREE.AdditiveBlending`, `THREE.SubtractiveBlending`
|
|
355
364
|
|
|
365
|
+
### Mesh Particle Configuration
|
|
366
|
+
|
|
367
|
+
When using `RendererType.MESH`, configure mesh-specific properties via `renderer.mesh`:
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
renderer: {
|
|
371
|
+
rendererType: RendererType.MESH,
|
|
372
|
+
blending: THREE.NormalBlending,
|
|
373
|
+
transparent: true,
|
|
374
|
+
depthTest: true,
|
|
375
|
+
depthWrite: true,
|
|
376
|
+
mesh: {
|
|
377
|
+
geometry: new THREE.BoxGeometry(1, 1, 1),
|
|
378
|
+
},
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Mesh particle features:
|
|
383
|
+
- GPU instancing (`InstancedBufferGeometry`) — one draw call for all particles
|
|
384
|
+
- Quaternion-based 3D rotation (particles rotate in all 3 axes)
|
|
385
|
+
- Normals preserved from the source geometry, simple directional lighting from camera
|
|
386
|
+
- Any `THREE.BufferGeometry` works: `BoxGeometry`, `SphereGeometry`, `IcosahedronGeometry`, custom meshes, etc.
|
|
387
|
+
- All modifiers work: sizeOverLifetime, colorOverLifetime, opacityOverLifetime, rotationOverLifetime, noise, force fields, sub-emitters
|
|
388
|
+
- Default texture: solid white 1×1 (preserves mesh shape); point/billboard renderers default to a circle texture
|
|
389
|
+
- Sub-emitter note: sub-emitters do not inherit `RendererType.MESH` or `RendererType.TRAIL` from the parent because mesh geometry and trail config cannot be passed through; sub-emitters fall back to their own `rendererType` or `POINTS` by default
|
|
390
|
+
- Note: `mesh.geometry` is a runtime object (not serializable to JSON); provide it programmatically
|
|
391
|
+
|
|
356
392
|
### Trail / Ribbon Configuration
|
|
357
393
|
|
|
358
394
|
When using `RendererType.TRAIL`, configure trail-specific properties via `renderer.trail`:
|
|
@@ -484,7 +520,7 @@ const system = createParticleSystem({
|
|
|
484
520
|
`BEZIER` | `EASING`
|
|
485
521
|
|
|
486
522
|
### RendererType
|
|
487
|
-
`POINTS` (default — classic point sprites) | `INSTANCED` (GPU instanced quads, no gl_PointSize limit)
|
|
523
|
+
`POINTS` (default — classic point sprites) | `INSTANCED` (GPU instanced quads, no gl_PointSize limit) | `TRAIL` (ribbon trails behind particles) | `MESH` (3D mesh particles via GPU instancing)
|
|
488
524
|
|
|
489
525
|
---
|
|
490
526
|
|
package/llms.txt
CHANGED
|
@@ -76,6 +76,26 @@ function animate() {
|
|
|
76
76
|
- `RendererType.POINTS` (default) — Classic point sprites via `THREE.Points`
|
|
77
77
|
- `RendererType.INSTANCED` — Camera-facing quads via `InstancedBufferGeometry`, removes `gl_PointSize` hardware limit
|
|
78
78
|
- `RendererType.TRAIL` — Ribbon trails behind particles with configurable width, opacity, and color tapering
|
|
79
|
+
- `RendererType.MESH` — Render each particle as a 3D mesh (cubes, spheres, custom geometry) via GPU instancing with quaternion-based 3D rotation and directional lighting. Uses solid white default texture (not circle) to preserve mesh shape. Sub-emitters do not inherit MESH or TRAIL rendererType from parent
|
|
80
|
+
|
|
81
|
+
## Mesh Particle Renderer
|
|
82
|
+
|
|
83
|
+
Configure via `renderer.mesh`:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
renderer: {
|
|
87
|
+
rendererType: RendererType.MESH,
|
|
88
|
+
blending: THREE.NormalBlending,
|
|
89
|
+
transparent: true,
|
|
90
|
+
depthTest: true,
|
|
91
|
+
depthWrite: true,
|
|
92
|
+
mesh: {
|
|
93
|
+
geometry: new THREE.BoxGeometry(1, 1, 1), // Any THREE.BufferGeometry
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Mesh particles use GPU instancing (`InstancedBufferGeometry`). Each particle is a full 3D mesh with quaternion rotation, normals, and UVs preserved. All modifiers (sizeOverLifetime, colorOverLifetime, noise, force fields, sub-emitters) work with mesh particles.
|
|
79
99
|
|
|
80
100
|
## Trail / Ribbon Renderer
|
|
81
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newkrok/three-particles",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Three.js-based high-performance particle system library designed for creating visually stunning particle effects with ease. Perfect for game developers and 3D applications.",
|
|
6
6
|
"main": "./dist/index.js",
|