pixi-effects 0.42.0 → 0.44.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 +17 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/ai/tools/check.mjs +131 -2
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/{Movie-BHGhg-fJ.d.cts → Movie-B3VOAgwc.d.cts} +5 -3
- package/dist/{Movie-CBVFZ1kg.d.ts → Movie-CQCVUqRs.d.ts} +5 -3
- package/dist/{chunk-NFJKBWYO.js → chunk-4MBTYREC.js} +100 -31
- package/dist/chunk-4MBTYREC.js.map +1 -0
- package/dist/{chunk-WVZLAIKK.cjs → chunk-MAAM45ZX.cjs} +99 -30
- package/dist/chunk-MAAM45ZX.cjs.map +1 -0
- package/dist/index.cjs +25 -25
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/loader.css +1 -1
- package/dist/present.cjs +1 -1
- package/dist/present.d.cts +2 -2
- package/dist/present.d.ts +2 -2
- package/dist/present.js +1 -1
- package/dist/three.cjs +166 -38
- package/dist/three.cjs.map +1 -1
- package/dist/three.d.cts +37 -2
- package/dist/three.d.ts +37 -2
- package/dist/three.js +168 -40
- package/dist/three.js.map +1 -1
- package/dist/{types-DIh93lFb.d.cts → types-C5xo0fzb.d.cts} +92 -1
- package/dist/{types-DIh93lFb.d.ts → types-C5xo0fzb.d.ts} +92 -1
- package/docs/api.md +4 -2
- package/docs/dsl.md +4 -2
- package/llms-full.txt +12 -8
- package/package.json +2 -1
- package/skills/pixi-effects/SKILL.md +2 -2
- package/skills/pixi-effects/reference/recipes.md +2 -2
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Base-DQWIJ6bJ.d.cts +0 -60
- package/dist/Base-Jgkud1Aw.d.ts +0 -60
- package/dist/chunk-NFJKBWYO.js.map +0 -1
- package/dist/chunk-WVZLAIKK.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMAAM45ZX_cjs = require('./chunk-MAAM45ZX.cjs');
|
|
4
4
|
require('./chunk-3HZV3UHU.cjs');
|
|
5
5
|
var chunkX62H3RBG_cjs = require('./chunk-X62H3RBG.cjs');
|
|
6
6
|
var chunkLQDDDIC4_cjs = require('./chunk-LQDDDIC4.cjs');
|
|
@@ -12,99 +12,99 @@ var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, "Movie", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkMAAM45ZX_cjs.Movie; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "animateText", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkMAAM45ZX_cjs.animateText; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "audioEnvelope", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkMAAM45ZX_cjs.audioEnvelope; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "bpmEnvelope", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkMAAM45ZX_cjs.bpmEnvelope; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "cameraPath", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkMAAM45ZX_cjs.cameraPath; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "computeEnvelope", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkMAAM45ZX_cjs.computeEnvelope; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "dismissLoader", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkMAAM45ZX_cjs.dismissLoader; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ease", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkMAAM45ZX_cjs.parseEase; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "failLoader", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkMAAM45ZX_cjs.failLoader; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "followPath", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkMAAM45ZX_cjs.followPath; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "kenBurns", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkMAAM45ZX_cjs.kenBurns; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "measureText", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkMAAM45ZX_cjs.measureText; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "musicBuffer", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkMAAM45ZX_cjs.musicBuffer; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "musicEnvelope", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkMAAM45ZX_cjs.musicEnvelope; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "musicEvents", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkMAAM45ZX_cjs.musicEvents; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "orbit", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkMAAM45ZX_cjs.orbit; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "particles", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkMAAM45ZX_cjs.particles; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "react", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkMAAM45ZX_cjs.react; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "resolveLoader", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkMAAM45ZX_cjs.resolveLoader; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "samplePath", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkMAAM45ZX_cjs.samplePath; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "splitText", {
|
|
94
94
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkMAAM45ZX_cjs.splitText; }
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "stagger", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkMAAM45ZX_cjs.stagger; }
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "wiggle", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkMAAM45ZX_cjs.wiggle; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "withFade", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkMAAM45ZX_cjs.withFade; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "Sequence", {
|
|
110
110
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec,
|
|
3
|
-
export {
|
|
1
|
+
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-B3VOAgwc.cjs';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, e as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, c as SequenceCommon } from './types-C5xo0fzb.cjs';
|
|
3
|
+
export { j as ArcShapeSpec, A as AssetSpec, k as AudioAssetSpec, l as AudioMusicSpec, m as AudioSequenceSpec, n as AudioSfxSpec, B as BlendModeName, o as CanvasInfo, p as CanvasSequenceSpec, q as ChromaKeyFilterSpec, r as CircleShapeSpec, s as CompositionSequenceSpec, C as CompositionSpec, t as CrossfadeTransition, u as CustomFilterSpec, D as DipTransition, v as DissolveTransition, E as EllipseShapeSpec, w as Expr, F as FilterSpec, G as GradientSpec, x as IrisTransition, L as LightSequenceSpec, y as LineShapeSpec, z as LumaTransition, H as MaskRefSpec, J as MatteRefSpec, N as MusicDrum, O as MusicDrums, Q as MusicInstrument, R as MusicLevel, U as MusicTrack, V as NullSequenceSpec, W as PathShapeSpec, X as PolygonShapeSpec, d as PropValue, P as Props, Y as RectShapeSpec, Z as SfxKnobs, _ as SfxOptions, $ as SfxPreset, a0 as SfxVoice, a1 as ShaderSequenceSpec, a2 as ShapeSequenceSpec, a3 as SlideTransition, b as SpaceNow, a as Stop, a4 as StopSpec, a5 as TextSpan, a6 as TransitionCommon, T as TransitionSpec, a7 as VideoSequenceSpec, a8 as WipeTransition, a9 as ZoomTransition } from './types-C5xo0fzb.cjs';
|
|
4
4
|
import { M as MusicEvents } from './soundEntry-DT13DNt8.cjs';
|
|
5
5
|
export { a as AudioInspectOptions, A as AudioReport, b as AudioSourceReport, c as MusicDrumEvents, d as MusicDrumHit, e as MusicNote, f as MusicSummary, g as MusicTrackEvents, S as SoundMeasure, h as SoundReport, i as inspectSound } from './soundEntry-DT13DNt8.cjs';
|
|
6
|
-
import { S as Sequence } from './Base-DQWIJ6bJ.cjs';
|
|
7
6
|
import 'pixi.js';
|
|
8
7
|
|
|
9
8
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec,
|
|
3
|
-
export {
|
|
1
|
+
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-CQCVUqRs.js';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, e as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, c as SequenceCommon } from './types-C5xo0fzb.js';
|
|
3
|
+
export { j as ArcShapeSpec, A as AssetSpec, k as AudioAssetSpec, l as AudioMusicSpec, m as AudioSequenceSpec, n as AudioSfxSpec, B as BlendModeName, o as CanvasInfo, p as CanvasSequenceSpec, q as ChromaKeyFilterSpec, r as CircleShapeSpec, s as CompositionSequenceSpec, C as CompositionSpec, t as CrossfadeTransition, u as CustomFilterSpec, D as DipTransition, v as DissolveTransition, E as EllipseShapeSpec, w as Expr, F as FilterSpec, G as GradientSpec, x as IrisTransition, L as LightSequenceSpec, y as LineShapeSpec, z as LumaTransition, H as MaskRefSpec, J as MatteRefSpec, N as MusicDrum, O as MusicDrums, Q as MusicInstrument, R as MusicLevel, U as MusicTrack, V as NullSequenceSpec, W as PathShapeSpec, X as PolygonShapeSpec, d as PropValue, P as Props, Y as RectShapeSpec, Z as SfxKnobs, _ as SfxOptions, $ as SfxPreset, a0 as SfxVoice, a1 as ShaderSequenceSpec, a2 as ShapeSequenceSpec, a3 as SlideTransition, b as SpaceNow, a as Stop, a4 as StopSpec, a5 as TextSpan, a6 as TransitionCommon, T as TransitionSpec, a7 as VideoSequenceSpec, a8 as WipeTransition, a9 as ZoomTransition } from './types-C5xo0fzb.js';
|
|
4
4
|
import { M as MusicEvents } from './soundEntry-DT13DNt8.js';
|
|
5
5
|
export { a as AudioInspectOptions, A as AudioReport, b as AudioSourceReport, c as MusicDrumEvents, d as MusicDrumHit, e as MusicNote, f as MusicSummary, g as MusicTrackEvents, S as SoundMeasure, h as SoundReport, i as inspectSound } from './soundEntry-DT13DNt8.js';
|
|
6
|
-
import { S as Sequence } from './Base-Jgkud1Aw.js';
|
|
7
6
|
import 'pixi.js';
|
|
8
7
|
|
|
9
8
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, dismissLoader, parseEase as ease, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, musicEvents, orbit, particles, react, resolveLoader, samplePath, splitText, stagger, wiggle, withFade } from './chunk-
|
|
1
|
+
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, dismissLoader, parseEase as ease, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, musicEvents, orbit, particles, react, resolveLoader, samplePath, splitText, stagger, wiggle, withFade } from './chunk-4MBTYREC.js';
|
|
2
2
|
import './chunk-ICI6ACHY.js';
|
|
3
3
|
export { Sequence, noise, noise2, rand, random, registerSequenceType } from './chunk-4QVQ5UJJ.js';
|
|
4
4
|
export { inspectSound } from './chunk-UHNSL2KJ.js';
|
package/dist/loader.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* pixi-effects loader: one line of HTML on the page, a few lines of CSS, no JavaScript of your own.
|
|
3
3
|
*
|
|
4
|
-
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.
|
|
4
|
+
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.44.0/dist/loader.css">
|
|
5
5
|
* <div class="stage" style="position: relative"> <!-- any box the canvas sits in, with position: relative -->
|
|
6
6
|
* <canvas id="stage" width="1280" height="720"></canvas>
|
|
7
7
|
* <div class="pe-loader" data-label="LOADING"></div> <!-- or class="pe-loader pe-loader--bar" -->
|
package/dist/present.cjs
CHANGED
package/dist/present.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Movie, a as MotionBlurSpec } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec,
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-B3VOAgwc.cjs';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-C5xo0fzb.cjs';
|
|
3
3
|
import 'pixi.js';
|
|
4
4
|
import './soundEntry-DT13DNt8.cjs';
|
|
5
5
|
|
package/dist/present.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Movie, a as MotionBlurSpec } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec,
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-CQCVUqRs.js';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-C5xo0fzb.js';
|
|
3
3
|
import 'pixi.js';
|
|
4
4
|
import './soundEntry-DT13DNt8.js';
|
|
5
5
|
|
package/dist/present.js
CHANGED
package/dist/three.cjs
CHANGED
|
@@ -161,7 +161,7 @@ function trackThree(kind) {
|
|
|
161
161
|
live[kind]++;
|
|
162
162
|
if (live[kind] > WARN_ABOVE[kind] && !warned.has(kind)) {
|
|
163
163
|
warned.add(kind);
|
|
164
|
-
console.warn(`pixi-effects: ${live[kind]} three layers are alive with renderer: '${kind}', and a browser keeps ${LIMIT[kind]} for the whole page; layers beyond that draw nothing, without an error. Put several objects in one three layer, destroy layers that are over, ` + (kind === "webgl" ? `or use renderer: 'webgpu' for some (its limit is about 32)` : `or use renderer: 'webgl' for some of them (a different pool of contexts)`));
|
|
164
|
+
console.warn(`pixi-effects: ${live[kind]} three layers are alive with renderer: '${kind}', and a browser keeps ${LIMIT[kind]} for the whole page; layers beyond that draw nothing, without an error. Put several objects in one three layer, destroy layers that are over, ` + (kind === "webgl" ? `or use renderer: 'webgpu' for some (in a movie PixiJS draws on WebGPU they share its GPU device and have no limit; otherwise it is about 32)` : `or use renderer: 'webgl' for some of them (a different pool of contexts), or leave shareGpu on in a movie PixiJS draws on WebGPU (the layers then share its device)`));
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
function releaseThree(kind) {
|
|
@@ -178,6 +178,19 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
178
178
|
backend = null;
|
|
179
179
|
_gpu = false;
|
|
180
180
|
// renderer: 'webgpu': async init and async render
|
|
181
|
+
/** True when the layer draws on PixiJS's own GPU device into a texture PixiJS samples directly (no canvas of its own, no copy, no share of the page's context cap). */
|
|
182
|
+
sharedGpu = false;
|
|
183
|
+
_rt = null;
|
|
184
|
+
// the texture a shared layer draws into
|
|
185
|
+
_sharedTexture = null;
|
|
186
|
+
_texture = null;
|
|
187
|
+
// what the layer's sprite shows (the canvas's, or the shared render target's)
|
|
188
|
+
/** What a rebuilt layer is compared with to take this one's place (core/reuse.ts); null: this layer is never kept (`reuse: false`, no `name`). */
|
|
189
|
+
_key = null;
|
|
190
|
+
/** The layer of the tree being replaced whose state this one is using until the new tree is on stage (`commitReuse`): not this layer's to let go. */
|
|
191
|
+
_borrowed = null;
|
|
192
|
+
/** True once another layer owns this layer's state: destroying this one must not let it go. */
|
|
193
|
+
_donated = false;
|
|
181
194
|
_scene = null;
|
|
182
195
|
_camera = null;
|
|
183
196
|
_ctx = null;
|
|
@@ -209,12 +222,18 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
209
222
|
const width = resolveDim(spec.width, scope) ?? this.parent?.width ?? this.root.width;
|
|
210
223
|
const height = resolveDim(spec.height, scope) ?? this.parent?.height ?? this.root.height;
|
|
211
224
|
const resolution = spec.resolution ?? 1;
|
|
212
|
-
const canvas = document.createElement("canvas");
|
|
213
225
|
const antialias = spec.antialias ?? true;
|
|
214
226
|
const kind = spec.renderer ?? getPageRenderer();
|
|
215
227
|
checkRendererKind(kind, "a three layer's renderer");
|
|
216
228
|
this._gpu = kind === "webgpu";
|
|
217
229
|
this.renderer = kind;
|
|
230
|
+
this._key = spec.reuse === false || !spec.name ? null : JSON.stringify([spec.name, idOf(spec.setup), width, height, resolution, antialias, kind, spec.shareGpu !== false && !!this.root.gpu, !!spec.followCamera, !!spec.followLights, !!spec.followFog]);
|
|
231
|
+
const donor = this._key !== null ? this.root.reuse?.claim(this._key) : null;
|
|
232
|
+
if (donor && donor._lendable()) {
|
|
233
|
+
this._borrow(donor, width, height, spec.name);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const canvas = document.createElement("canvas");
|
|
218
237
|
let renderer;
|
|
219
238
|
if (this._gpu) {
|
|
220
239
|
let mod;
|
|
@@ -223,24 +242,36 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
223
242
|
} catch (err) {
|
|
224
243
|
throw new Error(`pixi-effects: renderer: 'webgpu' needs three 0.17x or later with "three/webgpu" in the import map (${err instanceof Error ? err.message : err})`);
|
|
225
244
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
245
|
+
let shared = spec.shareGpu === false ? void 0 : this.root.gpu;
|
|
246
|
+
for (; ; ) {
|
|
247
|
+
renderer = new mod.WebGPURenderer(shared ? { device: shared.device, alpha: true, antialias } : { canvas, alpha: true, antialias });
|
|
248
|
+
this._renderer = renderer;
|
|
249
|
+
if (!shared) this._track();
|
|
250
|
+
const warn = console.warn;
|
|
251
|
+
let noGpu = false;
|
|
252
|
+
console.warn = (...args) => {
|
|
253
|
+
if (/WebGPU is not available/.test(String(args[0]))) noGpu = true;
|
|
254
|
+
else warn.apply(console, args);
|
|
255
|
+
};
|
|
256
|
+
try {
|
|
257
|
+
await renderer.init();
|
|
258
|
+
if (shared) {
|
|
259
|
+
renderer.setSize(Math.round(width * resolution), Math.round(height * resolution), false);
|
|
260
|
+
renderer.setClearColor(0, 0);
|
|
261
|
+
this._prepareShared(renderer, shared, width, height, resolution, antialias);
|
|
262
|
+
}
|
|
263
|
+
this.backend = noGpu ? "webgl2" : "webgpu";
|
|
264
|
+
break;
|
|
265
|
+
} catch (err) {
|
|
266
|
+
this._disposeRenderer();
|
|
267
|
+
if (!shared) throw err;
|
|
268
|
+
console.warn(`pixi-effects: three layer${spec.name ? ` "${spec.name}"` : ""}: could not draw on PixiJS's GPU device (${err instanceof Error ? err.message : err}); it uses a canvas of its own (shareGpu: false does this on purpose)`);
|
|
269
|
+
shared = void 0;
|
|
270
|
+
this._closing = false;
|
|
271
|
+
} finally {
|
|
272
|
+
console.warn = warn;
|
|
273
|
+
}
|
|
242
274
|
}
|
|
243
|
-
this.backend = noGpu ? "webgl2" : "webgpu";
|
|
244
275
|
} else {
|
|
245
276
|
renderer = new three$1.WebGLRenderer({ canvas, alpha: true, antialias });
|
|
246
277
|
this._renderer = renderer;
|
|
@@ -274,20 +305,59 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
274
305
|
if (!("camera" in this._objects)) this._objects.camera = this._camera;
|
|
275
306
|
if (this._gpu) this._checkWebGpuMaterials(scene, spec.name);
|
|
276
307
|
this._draw(0);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
sprite.cullable = true;
|
|
280
|
-
sprite.width = width;
|
|
281
|
-
sprite.height = height;
|
|
282
|
-
this.target = sprite;
|
|
283
|
-
this.intrinsicWidth = width;
|
|
284
|
-
this.intrinsicHeight = height;
|
|
285
|
-
this.buildFilters();
|
|
308
|
+
this._texture = this._sharedTexture ?? pixi_js.Texture.from(canvas);
|
|
309
|
+
this._makeSprite(this._texture, width, height, spec.name);
|
|
286
310
|
} catch (err) {
|
|
287
311
|
this._disposeRenderer();
|
|
288
312
|
throw err;
|
|
289
313
|
}
|
|
290
314
|
}
|
|
315
|
+
_makeSprite(texture, width, height, name) {
|
|
316
|
+
const sprite = new pixi_js.Sprite({ texture, label: name });
|
|
317
|
+
sprite.cullable = true;
|
|
318
|
+
sprite.width = width;
|
|
319
|
+
sprite.height = height;
|
|
320
|
+
this.target = sprite;
|
|
321
|
+
this.intrinsicWidth = width;
|
|
322
|
+
this.intrinsicHeight = height;
|
|
323
|
+
this.buildFilters();
|
|
324
|
+
}
|
|
325
|
+
/** Reuse (core/reuse.ts): the key this layer is matched by, while it can still lend its state. */
|
|
326
|
+
reuseKey() {
|
|
327
|
+
return this._renderer && !this._donated && !this._closing ? this._key : null;
|
|
328
|
+
}
|
|
329
|
+
_lendable() {
|
|
330
|
+
return this.reuseKey() !== null && !!this._scene && !!this._ctx && !!this._texture;
|
|
331
|
+
}
|
|
332
|
+
/** Take over a layer of the tree being replaced: its scene, renderer, texture and mirrors. Nothing is drawn until the new tree is on stage; the old layer goes on drawing meanwhile. */
|
|
333
|
+
_borrow(d, width, height, name) {
|
|
334
|
+
this.renderer = d.renderer;
|
|
335
|
+
this.backend = d.backend;
|
|
336
|
+
this._gpu = d._gpu;
|
|
337
|
+
this.sharedGpu = d.sharedGpu;
|
|
338
|
+
this._renderer = d._renderer;
|
|
339
|
+
this._scene = d._scene;
|
|
340
|
+
this._camera = d._camera;
|
|
341
|
+
this._ctx = d._ctx;
|
|
342
|
+
this._objects = d._objects;
|
|
343
|
+
this._rt = d._rt;
|
|
344
|
+
this._sharedTexture = d._sharedTexture;
|
|
345
|
+
this._texture = d._texture;
|
|
346
|
+
this._lightMirror = d._lightMirror;
|
|
347
|
+
this._fogMirror = d._fogMirror;
|
|
348
|
+
this._tracked = d._tracked;
|
|
349
|
+
this._borrowed = d;
|
|
350
|
+
if (this.spec && this._threeSpec.followCamera) this._checkFollowShape(width, height, name);
|
|
351
|
+
this._makeSprite(this._texture, width, height, name);
|
|
352
|
+
}
|
|
353
|
+
/** The new tree is on stage: the layer this one borrowed from has given its state away for good. */
|
|
354
|
+
commitReuse() {
|
|
355
|
+
const d = this._borrowed;
|
|
356
|
+
if (!d) return;
|
|
357
|
+
d._donated = true;
|
|
358
|
+
d._tracked = false;
|
|
359
|
+
this._borrowed = null;
|
|
360
|
+
}
|
|
291
361
|
/**
|
|
292
362
|
* Per-frame sync hook. Movie._awaitVideoFrames duck-types on this method
|
|
293
363
|
* (same contract as VideoSequence) and awaits it inside gotoFrame — the
|
|
@@ -310,7 +380,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
310
380
|
}
|
|
311
381
|
}
|
|
312
382
|
this._draw(t);
|
|
313
|
-
this.target?.texture.source.update();
|
|
383
|
+
if (!this.sharedGpu) this.target?.texture.source.update();
|
|
314
384
|
}
|
|
315
385
|
/**
|
|
316
386
|
* `movie.pick`: a ray through the point (u, v) of the layer's picture (0..1, v down) from the layer's camera, and what it meets first: the object's name (its own, or its nearest
|
|
@@ -400,7 +470,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
400
470
|
try {
|
|
401
471
|
this._followSpace(t);
|
|
402
472
|
this._threeSpec.update?.(t, ctx);
|
|
403
|
-
this._draw(t);
|
|
473
|
+
this._draw(t, true);
|
|
404
474
|
g.clearRect(0, 0, w, h);
|
|
405
475
|
g.drawImage(source, 0, 0);
|
|
406
476
|
} catch {
|
|
@@ -503,10 +573,45 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
503
573
|
* follow each other in one task (a seek, an export) would all show the lights of the last animation frame: a lamp keyframed with `three.lamp.intensity` would not move.
|
|
504
574
|
* So before each render the layer advances the node frame itself, and gives `time` the layer's own time (not three's wall clock).
|
|
505
575
|
*/
|
|
506
|
-
_draw(t) {
|
|
576
|
+
_draw(t, toCanvas = false) {
|
|
507
577
|
if (!this._renderer || !this._scene || !this._camera) return;
|
|
508
578
|
if (this._gpu) this._advanceNodeFrame(t);
|
|
509
|
-
|
|
579
|
+
if (!this._rt || toCanvas) {
|
|
580
|
+
this._renderer.render(this._scene, this._camera);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const r = this._renderer;
|
|
584
|
+
r.setOutputRenderTarget(this._rt);
|
|
585
|
+
try {
|
|
586
|
+
this._renderer.render(this._scene, this._camera);
|
|
587
|
+
} finally {
|
|
588
|
+
r.setOutputRenderTarget(null);
|
|
589
|
+
r.setRenderTarget(null);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* A shared layer's texture: a render target of the layer's size, drawn into once (the GPU texture exists only after a draw) and adopted by a PixiJS texture source. Throws when something
|
|
594
|
+
* is not as this expects (the build then makes the layer again on a canvas of its own). Done before `setup`, so nothing the author made yet depends on the renderer.
|
|
595
|
+
*/
|
|
596
|
+
_prepareShared(renderer, shared, width, height, resolution, antialias) {
|
|
597
|
+
const w = Math.round(width * resolution), h = Math.round(height * resolution);
|
|
598
|
+
const rt = new three$1.RenderTarget(w, h, { depthBuffer: true, samples: antialias ? 4 : 0 });
|
|
599
|
+
this._rt = rt;
|
|
600
|
+
const r = renderer;
|
|
601
|
+
if (typeof r.setOutputRenderTarget !== "function") throw new Error("this three has no setOutputRenderTarget");
|
|
602
|
+
r.setOutputRenderTarget(rt);
|
|
603
|
+
try {
|
|
604
|
+
renderer.render(new three$1.Scene(), new three$1.PerspectiveCamera());
|
|
605
|
+
} finally {
|
|
606
|
+
r.setOutputRenderTarget(null);
|
|
607
|
+
r.setRenderTarget(null);
|
|
608
|
+
}
|
|
609
|
+
const gpuTexture = r.backend?.get?.(rt.texture)?.texture;
|
|
610
|
+
if (!gpuTexture || typeof gpuTexture.createView !== "function") throw new Error("three keeps no GPU texture for a render target");
|
|
611
|
+
const source = new pixi_js.TextureSource({ width: w, height: h, format: gpuTexture.format, label: "three layer (shared GPU)" });
|
|
612
|
+
shared.adopt(source, gpuTexture);
|
|
613
|
+
this._sharedTexture = new pixi_js.Texture({ source });
|
|
614
|
+
this.sharedGpu = true;
|
|
510
615
|
}
|
|
511
616
|
/**
|
|
512
617
|
* The author chose renderer: 'webgpu'. Three's WebGPU renderer turns materials into node materials: a ShaderMaterial / RawShaderMaterial cannot run there (three logs an error on
|
|
@@ -601,28 +706,40 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
601
706
|
console.warn("pixi-effects: three renderer dispose threw \u2014", err);
|
|
602
707
|
}
|
|
603
708
|
this._renderer = null;
|
|
709
|
+
try {
|
|
710
|
+
this._rt?.dispose();
|
|
711
|
+
} catch {
|
|
712
|
+
}
|
|
713
|
+
this._rt = null;
|
|
604
714
|
}
|
|
605
715
|
destroy() {
|
|
606
716
|
const spec = this._threeSpec;
|
|
607
|
-
|
|
717
|
+
const kept = this._donated || this._borrowed !== null;
|
|
718
|
+
if (!kept && this._ctx && spec.dispose) {
|
|
608
719
|
try {
|
|
609
720
|
spec.dispose(this._ctx);
|
|
610
721
|
} catch (err) {
|
|
611
722
|
console.warn("pixi-effects: three dispose() threw \u2014", err);
|
|
612
723
|
}
|
|
613
724
|
}
|
|
614
|
-
const texture = this.
|
|
615
|
-
|
|
725
|
+
const texture = this._texture;
|
|
726
|
+
if (!kept) {
|
|
727
|
+
this._lightMirror?.dispose();
|
|
728
|
+
this._fogMirror?.dispose();
|
|
729
|
+
this._disposeRenderer();
|
|
730
|
+
}
|
|
616
731
|
this._lightMirror = null;
|
|
617
|
-
this._fogMirror?.dispose();
|
|
618
732
|
this._fogMirror = null;
|
|
619
|
-
this.
|
|
733
|
+
this._renderer = null;
|
|
734
|
+
this._rt = null;
|
|
620
735
|
this._scene = null;
|
|
621
736
|
this._camera = null;
|
|
622
737
|
this._ctx = null;
|
|
623
738
|
this._objects = {};
|
|
624
739
|
super.destroy();
|
|
625
|
-
texture?.destroy(true);
|
|
740
|
+
if (!kept) texture?.destroy(true);
|
|
741
|
+
this._texture = null;
|
|
742
|
+
this._sharedTexture = null;
|
|
626
743
|
}
|
|
627
744
|
};
|
|
628
745
|
function resolveDim(v, scope) {
|
|
@@ -630,6 +747,17 @@ function resolveDim(v, scope) {
|
|
|
630
747
|
if (typeof v === "number") return v;
|
|
631
748
|
return chunkX62H3RBG_cjs.evaluateExpr(v, scope);
|
|
632
749
|
}
|
|
750
|
+
var ids = /* @__PURE__ */ new WeakMap();
|
|
751
|
+
var lastId = 0;
|
|
752
|
+
function idOf(fn) {
|
|
753
|
+
if (typeof fn !== "function") return 0;
|
|
754
|
+
let id = ids.get(fn);
|
|
755
|
+
if (id === void 0) {
|
|
756
|
+
id = ++lastId;
|
|
757
|
+
ids.set(fn, id);
|
|
758
|
+
}
|
|
759
|
+
return id;
|
|
760
|
+
}
|
|
633
761
|
async function threeGltf(url, options = {}) {
|
|
634
762
|
const label = "pixi-effects: threeGltf";
|
|
635
763
|
if (typeof url !== "string" || !url) throw new Error(`${label}: the first argument is the URL of a .glb or .gltf file`);
|