babylon.quarks 0.27.0 → 0.28.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 +425 -0
- package/README.md +3 -1
- package/dist/babylon.quarks.cjs +1 -1
- package/dist/babylon.quarks.cjs.map +1 -1
- package/dist/babylon.quarks.esm.js +1 -1
- package/dist/babylon.quarks.esm.js.map +1 -1
- package/dist/babylon.quarks.umd.min.js +1 -1
- package/dist/babylon.quarks.umd.min.js.map +1 -1
- package/dist/types/index.d.cts +4256 -831
- package/dist/types/index.d.ts +4256 -831
- package/package.json +7 -2
- package/src/BatchedRenderer.ts +93 -78
- package/src/EffectPool.ts +91 -12
- package/src/MeshSurfaceEmitter.ts +24 -13
- package/src/ParticleEmitter.ts +31 -3
- package/src/ParticleSystem.ts +92 -25
- package/src/QuarksLoader.ts +289 -171
- package/src/QuarksPrefab.ts +301 -94
- package/src/QuarksSerializer.ts +43 -15
- package/src/QuarksUtil.ts +64 -9
- package/src/SpriteBatch.ts +21 -6
- package/src/TrailBatch.ts +12 -6
- package/src/VFXBatch.ts +70 -528
- package/src/batchKey.ts +4 -2
- package/src/batchSettings.ts +546 -0
- package/src/effectDocumentJSON.ts +261 -0
- package/src/effectResources.ts +21 -24
- package/src/envAtlas.ts +8 -2
- package/src/geometryUtil.ts +1 -1
- package/src/index.ts +39 -4
- package/src/nodeId.ts +25 -2
- package/src/shaderProgram.ts +110 -16
- package/src/shaderVariants.ts +24 -4
- package/src/shaders/chunks/blend.ts +31 -0
- package/src/shaders/chunks/fog.ts +8 -3
- package/src/shaders/chunks/soft.ts +6 -5
- package/src/shaders/chunks/surface.ts +2 -2
- package/src/shaders/particle_frag.glsl.ts +3 -1
- package/src/shaders/particle_frag.wgsl.ts +2 -0
- package/src/shaders/particle_physics_frag.glsl.ts +5 -2
- package/src/shaders/particle_physics_frag.wgsl.ts +2 -0
- package/src/shaders/trail_frag.glsl.ts +4 -1
- package/src/shaders/trail_frag.wgsl.ts +2 -0
- package/src/system/EmissionController.ts +2 -4
- package/src/system/EventDispatcher.ts +26 -10
- package/src/system/geometry.ts +22 -29
- package/src/system/materialResolve.ts +56 -7
- package/src/system/normalize.ts +6 -1
- package/src/system/serialization.ts +54 -33
- package/src/system/settingsSchema.ts +32 -10
- package/src/system/types.ts +67 -28
- package/src/trailSettings.ts +9 -6
package/src/trailSettings.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type {TrailSettings, TrailTextureMode} from 'quarks.core';
|
|
2
2
|
|
|
3
|
+
/** A trail's settings other than its start length and side axis, alike in code and in JSON. */
|
|
4
|
+
export type TrailOptions = Omit<TrailSettings, 'startLength' | 'sideAxis'>;
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* The normalised values of a trail's optional settings (`TrailSettings`), each read with its
|
|
5
8
|
* default for a value that is unset or out of range, so the batch, the simulation, JSON and
|
|
@@ -10,13 +13,13 @@ import type {TrailSettings, TrailTextureMode} from 'quarks.core';
|
|
|
10
13
|
export const MAX_TRAIL_TESSELLATION = 16;
|
|
11
14
|
|
|
12
15
|
/** A trail's tessellation, a whole number from 0 (the default: none) to {@link MAX_TRAIL_TESSELLATION}. */
|
|
13
|
-
export function trailTessellation(settings:
|
|
16
|
+
export function trailTessellation(settings: Partial<TrailOptions> | undefined): number {
|
|
14
17
|
const value = Math.round(Number(settings?.tessellation) || 0);
|
|
15
18
|
return Math.min(MAX_TRAIL_TESSELLATION, Math.max(0, value));
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
/** A trail's curve tension, from 0 (the default: Catmull-Rom) to 1 (straight segments). */
|
|
19
|
-
export function trailCurveTension(settings:
|
|
22
|
+
export function trailCurveTension(settings: Partial<TrailOptions> | undefined): number {
|
|
20
23
|
const value = Number(settings?.curveTension) || 0;
|
|
21
24
|
return Math.min(1, Math.max(0, value));
|
|
22
25
|
}
|
|
@@ -24,19 +27,19 @@ export function trailCurveTension(settings: TrailSettings | undefined): number {
|
|
|
24
27
|
const TEXTURE_MODES: readonly TrailTextureMode[] = ['stretch', 'tile', 'distributePerSegment', 'repeatPerSegment'];
|
|
25
28
|
|
|
26
29
|
/** A trail's texture mode, `'stretch'` (the default) unless set to one of the others. */
|
|
27
|
-
export function trailTextureMode(settings:
|
|
30
|
+
export function trailTextureMode(settings: Partial<TrailOptions> | undefined): TrailTextureMode {
|
|
28
31
|
const mode = settings?.textureMode;
|
|
29
32
|
return mode !== undefined && TEXTURE_MODES.includes(mode) ? mode : 'stretch';
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/** A trail's texture scale: a finite number above 0, else the default 1. */
|
|
33
|
-
export function trailTextureScale(settings:
|
|
36
|
+
export function trailTextureScale(settings: Partial<TrailOptions> | undefined): number {
|
|
34
37
|
const value = Number(settings?.textureScale);
|
|
35
38
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/** A trail's minimum distance between samples: a finite number of at least 0, else the default 0. */
|
|
39
|
-
export function trailMinVertexDistance(settings:
|
|
42
|
+
export function trailMinVertexDistance(settings: Partial<TrailOptions> | undefined): number {
|
|
40
43
|
const value = Number(settings?.minVertexDistance);
|
|
41
44
|
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
42
45
|
}
|
|
@@ -45,7 +48,7 @@ export function trailMinVertexDistance(settings: TrailSettings | undefined): num
|
|
|
45
48
|
* How long a trail keeps a sample, in seconds: a finite number above 0, else `Infinity` (the
|
|
46
49
|
* default, as 0 is: until the history is full).
|
|
47
50
|
*/
|
|
48
|
-
export function trailLifetime(settings:
|
|
51
|
+
export function trailLifetime(settings: Partial<TrailOptions> | undefined): number {
|
|
49
52
|
const value = Number(settings?.lifetime);
|
|
50
53
|
return Number.isFinite(value) && value > 0 ? value : Infinity;
|
|
51
54
|
}
|