@3driseai/3drise-viewer 0.1.29 → 0.1.30
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/animationsV2/ClipsRuntime.d.ts +4 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +66 -2
- package/dist/animationsV2/clipUtils.js +1 -1
- package/dist/animationsV2/sequenceUtils.d.ts +5 -0
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
- package/dist/animationsV2/sequenceUtils.js +10 -0
- package/dist/animationsV2/types.d.ts +6 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +43 -38
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +22 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +6 -17
- package/dist/components/ParticlesGenerator.d.ts.map +1 -1
- package/dist/components/ParticlesGenerator.js +44 -24
- package/dist/components/PickVolume.d.ts +17 -0
- package/dist/components/PickVolume.d.ts.map +1 -0
- package/dist/components/PickVolume.js +20 -0
- package/dist/components/SkyStars.d.ts.map +1 -1
- package/dist/components/SkyStars.js +83 -2
- package/dist/components/TextGenerator.d.ts.map +1 -1
- package/dist/components/TextGenerator.js +3 -2
- package/dist/components/index.d.ts +1 -8
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -4
- package/dist/components/particles/BioluminescentWakeParticles.d.ts +5 -0
- package/dist/components/particles/BioluminescentWakeParticles.d.ts.map +1 -1
- package/dist/components/particles/BioluminescentWakeParticles.js +2 -1
- package/dist/components/particles/BrownianDustParticles.d.ts +5 -0
- package/dist/components/particles/BrownianDustParticles.d.ts.map +1 -1
- package/dist/components/particles/BrownianDustParticles.js +2 -0
- package/dist/components/particles/ChladniSandParticles.d.ts +5 -0
- package/dist/components/particles/ChladniSandParticles.d.ts.map +1 -1
- package/dist/components/particles/ChladniSandParticles.js +2 -1
- package/dist/components/particles/ElectronOrbitalsParticles.d.ts +5 -0
- package/dist/components/particles/ElectronOrbitalsParticles.d.ts.map +1 -1
- package/dist/components/particles/ElectronOrbitalsParticles.js +2 -1
- package/dist/components/particles/FaradayPowderParticles.d.ts +5 -0
- package/dist/components/particles/FaradayPowderParticles.d.ts.map +1 -1
- package/dist/components/particles/FaradayPowderParticles.js +2 -1
- package/dist/components/particles/GrinderSparksParticles.d.ts +5 -0
- package/dist/components/particles/GrinderSparksParticles.d.ts.map +1 -1
- package/dist/components/particles/GrinderSparksParticles.js +2 -1
- package/dist/components/particles/MagneticBottleParticles.d.ts +5 -0
- package/dist/components/particles/MagneticBottleParticles.d.ts.map +1 -1
- package/dist/components/particles/MagneticBottleParticles.js +2 -1
- package/dist/components/particles/NeonRainParticles.d.ts +5 -0
- package/dist/components/particles/NeonRainParticles.d.ts.map +1 -1
- package/dist/components/particles/NeonRainParticles.js +2 -1
- package/dist/components/particles/ShapeBurstParticles.d.ts +5 -0
- package/dist/components/particles/ShapeBurstParticles.d.ts.map +1 -1
- package/dist/components/particles/ShapeBurstParticles.js +2 -1
- package/dist/components/particles/ShapeFlowParticles.d.ts +5 -0
- package/dist/components/particles/ShapeFlowParticles.d.ts.map +1 -1
- package/dist/components/particles/ShapeFlowParticles.js +2 -1
- package/dist/components/particles/TidalStreamParticles.d.ts +5 -0
- package/dist/components/particles/TidalStreamParticles.d.ts.map +1 -1
- package/dist/components/particles/TidalStreamParticles.js +2 -0
- package/dist/components/text/PlainText.d.ts +15 -0
- package/dist/components/text/PlainText.d.ts.map +1 -0
- package/dist/components/text/PlainText.js +4 -0
- package/dist/components/text/TextObjectView.d.ts +3 -1
- package/dist/components/text/TextObjectView.d.ts.map +1 -1
- package/dist/components/text/TextObjectView.js +9 -3
- package/dist/components/text/engine/looks/index.d.ts.map +1 -1
- package/dist/components/text/engine/looks/index.js +2 -1
- package/dist/components/text/engine/looks/plain.d.ts +146 -0
- package/dist/components/text/engine/looks/plain.d.ts.map +1 -0
- package/dist/components/text/engine/looks/plain.js +104 -0
- package/dist/components/text/fonts/bebas-neue.outline.d.ts +3 -0
- package/dist/components/text/fonts/bebas-neue.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/bebas-neue.outline.js +4 -0
- package/dist/components/text/fonts/bebas-neue.strokes.d.ts +3 -0
- package/dist/components/text/fonts/bebas-neue.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/bebas-neue.strokes.js +4 -0
- package/dist/components/text/fonts/index.d.ts +1 -1
- package/dist/components/text/fonts/index.d.ts.map +1 -1
- package/dist/components/text/fonts/index.js +15 -1
- package/dist/components/text/fonts/inter.outline.d.ts +3 -0
- package/dist/components/text/fonts/inter.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/inter.outline.js +4 -0
- package/dist/components/text/fonts/inter.strokes.d.ts +3 -0
- package/dist/components/text/fonts/inter.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/inter.strokes.js +4 -0
- package/dist/components/text/fonts/lora.outline.d.ts +3 -0
- package/dist/components/text/fonts/lora.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/lora.outline.js +4 -0
- package/dist/components/text/fonts/lora.strokes.d.ts +3 -0
- package/dist/components/text/fonts/lora.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/lora.strokes.js +4 -0
- package/dist/components/text/fonts/montserrat.outline.d.ts +3 -0
- package/dist/components/text/fonts/montserrat.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/montserrat.outline.js +4 -0
- package/dist/components/text/fonts/montserrat.strokes.d.ts +3 -0
- package/dist/components/text/fonts/montserrat.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/montserrat.strokes.js +4 -0
- package/dist/components/text/fonts/oswald.outline.d.ts +3 -0
- package/dist/components/text/fonts/oswald.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/oswald.outline.js +4 -0
- package/dist/components/text/fonts/oswald.strokes.d.ts +3 -0
- package/dist/components/text/fonts/oswald.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/oswald.strokes.js +4 -0
- package/dist/components/text/fonts/playfair-display.outline.d.ts +3 -0
- package/dist/components/text/fonts/playfair-display.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/playfair-display.outline.js +4 -0
- package/dist/components/text/fonts/playfair-display.strokes.d.ts +3 -0
- package/dist/components/text/fonts/playfair-display.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/playfair-display.strokes.js +4 -0
- package/dist/components/text/fonts/roboto.outline.d.ts +3 -0
- package/dist/components/text/fonts/roboto.outline.d.ts.map +1 -0
- package/dist/components/text/fonts/roboto.outline.js +4 -0
- package/dist/components/text/fonts/roboto.strokes.d.ts +3 -0
- package/dist/components/text/fonts/roboto.strokes.d.ts.map +1 -0
- package/dist/components/text/fonts/roboto.strokes.js +4 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/index.d.ts.map +1 -1
- package/dist/components/text/index.js +1 -0
- package/dist/components/text/useTextObject.d.ts +1 -0
- package/dist/components/text/useTextObject.d.ts.map +1 -1
- package/dist/components/text/useTextObject.js +23 -11
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/operations/catalogue/flock.d.ts.map +1 -1
- package/dist/operations/catalogue/flock.js +44 -9
- package/dist/operations/catalogue/inkBloom.d.ts.map +1 -1
- package/dist/operations/catalogue/inkBloom.js +46 -9
- package/dist/operations/catalogue/liquidMetal.d.ts.map +1 -1
- package/dist/operations/catalogue/liquidMetal.js +41 -12
- package/dist/operations/catalogue/particleSwarm.d.ts.map +1 -1
- package/dist/operations/catalogue/particleSwarm.js +29 -9
- package/dist/operations/catalogue/petalPeel.d.ts.map +1 -1
- package/dist/operations/catalogue/petalPeel.js +33 -9
- package/dist/operations/catalogue/portal.d.ts.map +1 -1
- package/dist/operations/catalogue/portal.js +33 -11
- package/dist/operations/catalogue/sandErosion.d.ts.map +1 -1
- package/dist/operations/catalogue/sandErosion.js +36 -14
- package/dist/operations/catalogue/teleport.d.ts.map +1 -1
- package/dist/operations/catalogue/teleport.js +43 -12
- package/dist/operations/catalogue/unweave.d.ts.map +1 -1
- package/dist/operations/catalogue/unweave.js +34 -15
- package/dist/operations/catalogue/voxelize.d.ts.map +1 -1
- package/dist/operations/catalogue/voxelize.js +37 -10
- package/dist/triggers/engine.d.ts +1 -1
- package/dist/triggers/engine.d.ts.map +1 -1
- package/dist/triggers/engine.js +3 -0
- package/dist/triggers/hosts/actions.d.ts.map +1 -1
- package/dist/triggers/hosts/actions.js +1 -1
- package/dist/triggers/hosts/interactions.d.ts.map +1 -1
- package/dist/triggers/hosts/interactions.js +1 -1
- package/dist/utils/pickProxy.d.ts +11 -0
- package/dist/utils/pickProxy.d.ts.map +1 -0
- package/dist/utils/pickProxy.js +36 -0
- package/dist/utils/shapes.d.ts +4 -0
- package/dist/utils/shapes.d.ts.map +1 -1
- package/dist/utils/shapes.js +4 -1
- package/dist/utils/textShape.d.ts +24 -0
- package/dist/utils/textShape.d.ts.map +1 -0
- package/dist/utils/textShape.js +102 -0
- package/package.json +2 -2
|
@@ -48,6 +48,10 @@ declare class ClipsRuntime {
|
|
|
48
48
|
private pendingRestore;
|
|
49
49
|
/** last written value per property (targetKey -> JSON) */
|
|
50
50
|
private written;
|
|
51
|
+
/** Discrete values laid last tick, per element (JSON) — to see which elements changed. */
|
|
52
|
+
private laid;
|
|
53
|
+
/** Element -> frames left to re-write its continuous tracks (the layer just changed it). */
|
|
54
|
+
private rewrite;
|
|
51
55
|
/** values written straight from outside (a UI slider): targetKey -> value. */
|
|
52
56
|
private live;
|
|
53
57
|
debug: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipsRuntime.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipsRuntime.ts"],"names":[],"mappings":"
|
|
1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C7D,OAAO,CAAC,QAAQ;IAOhB,oFAAoF;IACpF,OAAO,CAAC,QAAQ;IAWhB,kGAAkG;IAClG,OAAO,CAAC,YAAY;IAepB,mEAAmE;IACnE,OAAO,CAAC,WAAW;IAKnB,iEAAiE;IACjE,OAAO,CAAC,cAAc;IAKtB,mEAAmE;IACnE,OAAO,CAAE,SAAS;IAqBlB,OAAO,CAAC,WAAW;IAsBnB,0EAA0E;IAC1E,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuCvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAKZ,0DAA0D;IAC1D,OAAO,CAAC,SAAS;CAKlB;AAeD,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,QAAA,MAAM,YAAY,cAAqB,CAAC;AACxC,eAAe,YAAY,CAAC"}
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
// A property that stops being driven (stop, a 'restore' end, a sequence entry
|
|
25
25
|
// scrubbed back before its start) is written back to its authored value.
|
|
26
26
|
//
|
|
27
|
+
// Discrete tracks (structural properties: material variant, shape, particle count…)
|
|
28
|
+
// can't be written to a live object. Their winning values at the playhead are laid over
|
|
29
|
+
// the elements' settings as ONE SceneActions layer ('timeline'), recomputed every tick:
|
|
30
|
+
// the element re-renders with them, and when nothing drives them any more (stop,
|
|
31
|
+
// restore, scrub out) the layer drops them — no restore of their own. A continuous
|
|
32
|
+
// track on an element the layer just changed is re-written for a few frames, because
|
|
33
|
+
// the re-render may have rebuilt what it writes to (a new material).
|
|
34
|
+
//
|
|
27
35
|
// Sequence cues switch actions (SceneActions) by time: each tick a sequence works
|
|
28
36
|
// out which of its actions should be on at its current time and applies / reverts
|
|
29
37
|
// only what changed. It reverts only what it applied itself — an action already on
|
|
@@ -38,6 +46,22 @@ import { readNodeValue, restoreNodeTrack } from './nodeTracks.js';
|
|
|
38
46
|
import { cueStatesAt, entryLocalTime, isEntryActive, resolveSequence, cueCommand, clipCueSchedule, firedBetween, } from './sequenceUtils.js';
|
|
39
47
|
/** Longest an autoplaying sequence waits for its targets. */
|
|
40
48
|
const MAX_TARGET_WAIT_MS = 8000;
|
|
49
|
+
/** The SceneActions layer discrete tracks are set through. */
|
|
50
|
+
const TIMELINE_LAYER = 'timeline';
|
|
51
|
+
/** Frames a changed element's continuous tracks are re-written for (its re-render may rebuild their target). */
|
|
52
|
+
const REWRITE_FRAMES = 30;
|
|
53
|
+
/** Deep patch from flat (path -> value) pairs. */
|
|
54
|
+
function patchOf(pairs) {
|
|
55
|
+
const out = {};
|
|
56
|
+
for (const [path, value] of pairs) {
|
|
57
|
+
const parts = path.split('.');
|
|
58
|
+
let cur = out;
|
|
59
|
+
for (let i = 0; i < parts.length - 1; i++)
|
|
60
|
+
cur = (cur[parts[i]] ??= {});
|
|
61
|
+
cur[parts[parts.length - 1]] = value;
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
41
65
|
const targetKey = (state, node, path) => `${state}|${node ?? ''}|${path}`;
|
|
42
66
|
class ClipsRuntime {
|
|
43
67
|
cueRunner = null;
|
|
@@ -57,6 +81,10 @@ class ClipsRuntime {
|
|
|
57
81
|
pendingRestore = [];
|
|
58
82
|
/** last written value per property (targetKey -> JSON) */
|
|
59
83
|
written = new Map();
|
|
84
|
+
/** Discrete values laid last tick, per element (JSON) — to see which elements changed. */
|
|
85
|
+
laid = new Map();
|
|
86
|
+
/** Element -> frames left to re-write its continuous tracks (the layer just changed it). */
|
|
87
|
+
rewrite = new Map();
|
|
60
88
|
/** values written straight from outside (a UI slider): targetKey -> value. */
|
|
61
89
|
live = new Map();
|
|
62
90
|
// --- diagnostics ------------------------------------------------------------------
|
|
@@ -155,6 +183,9 @@ class ClipsRuntime {
|
|
|
155
183
|
this.sequences.clear();
|
|
156
184
|
this.pendingRestore = [];
|
|
157
185
|
this.written.clear();
|
|
186
|
+
this.laid.clear();
|
|
187
|
+
this.rewrite.clear();
|
|
188
|
+
SceneActions.setLayer(TIMELINE_LAYER, null);
|
|
158
189
|
clearApplierCaches();
|
|
159
190
|
this.bumpState();
|
|
160
191
|
}
|
|
@@ -497,10 +528,35 @@ class ClipsRuntime {
|
|
|
497
528
|
const winners = new Map();
|
|
498
529
|
for (const p of this.proposals())
|
|
499
530
|
winners.set(targetKey(p.state, p.node, p.path), p);
|
|
531
|
+
// Discrete winners -> the patch layer (a no-op when unchanged).
|
|
532
|
+
const discrete = new Map();
|
|
533
|
+
for (const p of winners.values()) {
|
|
534
|
+
if (!p.discrete)
|
|
535
|
+
continue;
|
|
536
|
+
const list = discrete.get(p.state) ?? [];
|
|
537
|
+
list.push([p.path, p.value]);
|
|
538
|
+
discrete.set(p.state, list);
|
|
539
|
+
}
|
|
540
|
+
const layer = {};
|
|
541
|
+
for (const [state, pairs] of discrete)
|
|
542
|
+
layer[state] = patchOf(pairs);
|
|
543
|
+
for (const state of new Set([...this.laid.keys(), ...discrete.keys()])) {
|
|
544
|
+
const json = layer[state] ? JSON.stringify(layer[state]) : '';
|
|
545
|
+
if ((this.laid.get(state) ?? '') === json)
|
|
546
|
+
continue;
|
|
547
|
+
if (json)
|
|
548
|
+
this.laid.set(state, json);
|
|
549
|
+
else
|
|
550
|
+
this.laid.delete(state);
|
|
551
|
+
this.rewrite.set(state, REWRITE_FRAMES);
|
|
552
|
+
}
|
|
553
|
+
SceneActions.setLayer(TIMELINE_LAYER, layer);
|
|
500
554
|
const failed = [];
|
|
501
555
|
for (const [key, p] of winners) {
|
|
556
|
+
if (p.discrete)
|
|
557
|
+
continue;
|
|
502
558
|
const json = JSON.stringify(p.value);
|
|
503
|
-
if (this.written.get(key) === json)
|
|
559
|
+
if (this.written.get(key) === json && !this.rewrite.has(p.state))
|
|
504
560
|
continue;
|
|
505
561
|
// Recorded only when it landed: a target that is not mounted yet (a model still
|
|
506
562
|
// loading) is retried next frame instead of being skipped for good.
|
|
@@ -511,6 +567,12 @@ class ClipsRuntime {
|
|
|
511
567
|
}
|
|
512
568
|
if (failed.length)
|
|
513
569
|
this.dlogEvery('failed', 1000, `writes not landed (${failed.length})`, failed.slice(0, 12));
|
|
570
|
+
for (const [state, n] of this.rewrite) {
|
|
571
|
+
if (n <= 1)
|
|
572
|
+
this.rewrite.delete(state);
|
|
573
|
+
else
|
|
574
|
+
this.rewrite.set(state, n - 1);
|
|
575
|
+
}
|
|
514
576
|
if (anyPlaying)
|
|
515
577
|
this.bump();
|
|
516
578
|
}
|
|
@@ -673,6 +735,8 @@ class ClipsRuntime {
|
|
|
673
735
|
this.pendingRestore = [];
|
|
674
736
|
const done = new Set();
|
|
675
737
|
for (const track of tracks) {
|
|
738
|
+
if (track.discrete)
|
|
739
|
+
continue; // the layer drops it on its own
|
|
676
740
|
const key = targetKey(track.state, track.node, track.path);
|
|
677
741
|
if (done.has(key))
|
|
678
742
|
continue;
|
|
@@ -818,7 +882,7 @@ function* sampleTracks(tracks, t) {
|
|
|
818
882
|
const value = sampleTrack(track, t);
|
|
819
883
|
if (value === undefined)
|
|
820
884
|
continue;
|
|
821
|
-
yield { state: track.state, node: track.node, path: track.path, value };
|
|
885
|
+
yield { state: track.state, node: track.node, path: track.path, value, discrete: track.discrete && !track.node };
|
|
822
886
|
}
|
|
823
887
|
}
|
|
824
888
|
const clipsRuntime = new ClipsRuntime();
|
|
@@ -71,7 +71,7 @@ export function sampleTrack(track, t) {
|
|
|
71
71
|
}
|
|
72
72
|
const a = keys[lo];
|
|
73
73
|
const b = keys[hi];
|
|
74
|
-
if (isSteppedValue(a.value) || isSteppedValue(b.value))
|
|
74
|
+
if (track.discrete || isSteppedValue(a.value) || isSteppedValue(b.value))
|
|
75
75
|
return a.value;
|
|
76
76
|
const span = b.t - a.t;
|
|
77
77
|
const p = span > 0 ? easeProgress(a.ease, (t - a.t) / span) : 1;
|
|
@@ -19,6 +19,11 @@ export interface ScheduledCue {
|
|
|
19
19
|
stepIndex: number;
|
|
20
20
|
/** Sequence seconds. */
|
|
21
21
|
time: number;
|
|
22
|
+
/**
|
|
23
|
+
* Set on a step clip's own cue (the ScheduledClip id it came from). Its `cue` is a
|
|
24
|
+
* sequence-shaped copy (id `${entryId}:${cueId}`) — edit it in the clip, not here.
|
|
25
|
+
*/
|
|
26
|
+
fromClip?: string;
|
|
22
27
|
}
|
|
23
28
|
export interface SequenceSchedule {
|
|
24
29
|
/** In priority order (schedule index = activation order). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceUtils.d.ts","sourceRoot":"","sources":["../../src/animationsV2/sequenceUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sequenceUtils.d.ts","sourceRoot":"","sources":["../../src/animationsV2/sequenceUtils.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,WAAW,CAAC;IACjB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D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,MAAM,GAAG,QAAQ,CAEpD;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAkBlG"}
|
|
@@ -33,6 +33,16 @@ export function resolveSequence(seq, clips) {
|
|
|
33
33
|
const time = Math.min(cursor, steps[stepIndex].start + safeDelay(cue.at));
|
|
34
34
|
cues.push({ cue, subject: cueSubject(cue), stepIndex, time });
|
|
35
35
|
});
|
|
36
|
+
// Each step clip's own cues, on the sequence clock.
|
|
37
|
+
for (const e of entries) {
|
|
38
|
+
const speed = safeSpeed(e.stepClip.speed);
|
|
39
|
+
const stepStart = steps[e.stepIndex].start;
|
|
40
|
+
for (const c of clipCueSchedule(e.clip)) {
|
|
41
|
+
const time = Math.min(e.end, e.start + c.time / speed);
|
|
42
|
+
const cue = { ...c.cue, id: `${e.id}:${c.cue.id}`, stepId: seq.steps[e.stepIndex].id, at: time - stepStart };
|
|
43
|
+
cues.push({ cue, subject: c.subject, stepIndex: e.stepIndex, time, fromClip: e.id });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
cues.sort((a, b) => a.time - b.time); // stable: authored order breaks ties
|
|
37
47
|
return { entries, steps, cues, duration: cursor };
|
|
38
48
|
}
|
|
@@ -27,6 +27,12 @@ export interface Track {
|
|
|
27
27
|
/** Sorted by t. */
|
|
28
28
|
keys: Keyframe[];
|
|
29
29
|
muted?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* A structural property (core getDiscreteTrackSpecs): never written per frame. Its value
|
|
32
|
+
* holds from one key to the next (no easing), and the runtime sets it through the
|
|
33
|
+
* SceneActions patch layer — the element re-renders, as when an action changes it.
|
|
34
|
+
*/
|
|
35
|
+
discrete?: boolean;
|
|
30
36
|
}
|
|
31
37
|
export interface AnimationClip {
|
|
32
38
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/animationsV2/types.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAChB,QAAQ,GAAG,MAAM,GACjB,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,aAAa,GAAG,cAAc,GAAG,gBAAgB,GACjD,aAAa,GAAG,cAAc,GAAG,gBAAgB,GACjD,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,gBAAgB,GAAG,eAAe,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,QAAQ,CAAC;IAChB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qJAAqJ;IACrJ,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/animationsV2/types.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAChB,QAAQ,GAAG,MAAM,GACjB,YAAY,GAAG,aAAa,GAAG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AoB;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,6EAA6E;IAC7E,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,+BAA+B;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,oFAAoF;IACpF,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,sBAAsB,CAAC;IACvC,mFAAmF;IACnF,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,EAAE,QAA2B,CAAC;AACvD,eAAO,MAAM,WAAW,2BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EffectsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/EffectsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EffectsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/EffectsGenerator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAsCtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,mGAAmG;IACnG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0FAA0F;IAC1F,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,qFAAqF;IACrF,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAGD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2DrD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { Box3, Sphere } from 'three';
|
|
4
|
+
import PickVolume from './PickVolume.js';
|
|
4
5
|
import MoleculesEffect from './effects/MoleculesEffect.js';
|
|
5
6
|
import ShockwaveEffect from './effects/ShockwaveEffect.js';
|
|
6
7
|
import AuraEffect from './effects/AuraEffect.js';
|
|
@@ -52,44 +53,48 @@ const EffectsGenerator = ({ settings, object, id, keyframes, mouseMove, onObject
|
|
|
52
53
|
const ready = { onObjectReady, onObjectDispose };
|
|
53
54
|
// Every effect takes the domain drivers: live drag, keyframes and pointer bindings.
|
|
54
55
|
const driven = { id, keyframes, mouseMove };
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
56
|
+
// A standalone effect is hit on its unit sphere (boundingRadius 1), never on its sparse points; a hosted one is hit through its host.
|
|
57
|
+
return object ? effect() : _jsx(PickVolume, { radius: boundingRadius * 1.05, children: effect() });
|
|
58
|
+
function effect() {
|
|
59
|
+
switch (config.type) {
|
|
60
|
+
case 'molecules': return _jsx(MoleculesEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
61
|
+
case 'shockwave': return _jsx(ShockwaveEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
62
|
+
case 'aura': return _jsx(AuraEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
63
|
+
case 'dataStream': return _jsx(DataStreamEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
64
|
+
case 'constellation': return _jsx(ConstellationEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
65
|
+
case 'hologram': return _jsx(HologramEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
66
|
+
case 'portal': return _jsx(PortalEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
67
|
+
case 'dnaHelix': return _jsx(DnaHelixEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
68
|
+
case 'orb': return _jsx(OrbEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
69
|
+
case 'lightning': return _jsx(LightningEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
70
|
+
case 'aurora': return _jsx(AuroraEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
71
|
+
case 'forcefield': return _jsx(ForcefieldEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
72
|
+
case 'neuralNetwork': return _jsx(NeuralNetworkEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
73
|
+
case 'blackHole': return _jsx(BlackHoleEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
74
|
+
case 'iceCrystals': return _jsx(IceCrystalsEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
75
|
+
case 'smokePlume': return _jsx(SmokePlumeEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
76
|
+
case 'volumetricFog': return _jsx(VolumetricFogEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
77
|
+
case 'smokeRing': return _jsx(SmokeRingEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
78
|
+
case 'fire': return _jsx(Fire, { hostRef: object, config: config, ...driven, ...ready });
|
|
79
|
+
case 'flares': return _jsx(Flares, { hostRef: object, boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
80
|
+
case 'sparklesBurst': return _jsx(SparklesBurst, { boundingRadius: boundingRadius, config: config, ...driven });
|
|
81
|
+
case 'bubbles': return _jsx(Bubbles, { boundingRadius: boundingRadius, config: config, ...driven });
|
|
82
|
+
case 'glyphs': return _jsx(Glyphs, { boundingRadius: boundingRadius, config: config, ...driven });
|
|
83
|
+
case 'smokeRibbon': return _jsx(SmokeRibbon, { config: config, boundingRadius: boundingRadius, ...driven, ...ready });
|
|
84
|
+
case 'fieldLines': return _jsx(FieldLinesEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
85
|
+
case 'strangeAttractor': return _jsx(StrangeAttractorEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
86
|
+
case 'harmonicShell': return _jsx(HarmonicShellEffect, { boundingRadius: boundingRadius, config: config, ...driven, ...ready });
|
|
87
|
+
case 'galaxy': return _jsx(GalaxyEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
88
|
+
case 'fireflySwarm': return _jsx(FireflySwarmEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
89
|
+
case 'murmuration': return _jsx(MurmurationEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
90
|
+
case 'planetaryRings': return _jsx(PlanetaryRingsEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
91
|
+
case 'waterCaustics': return _jsx(WaterCausticsEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
92
|
+
case 'iceHalo': return _jsx(IceHaloEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
93
|
+
case 'fallingLeaves': return _jsx(FallingLeavesEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
94
|
+
case 'lichtenberg': return _jsx(LichtenbergEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
95
|
+
case 'dandelionSeeds': return _jsx(DandelionSeedsEffect, { boundingRadius: boundingRadius, config: config, hasHost: !!object, ...driven, ...ready });
|
|
96
|
+
default: return null;
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
};
|
|
95
100
|
export default EffectsGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryShape.d.ts","sourceRoot":"","sources":["../../src/components/GeometryShape.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GeometryShape.d.ts","sourceRoot":"","sources":["../../src/components/GeometryShape.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQjH,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE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9D;AACD,wBAAgB,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,EAAE,EAAE,CAKnE;AACD,wBAAgB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,EAAE,EAAE,CAkBnD;AACD,wBAAgB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,EAAE,EAAE,CAKnD;AACD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,EAAE,EAAE,CAuBzF;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG;IAC7F,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,EAAE,EAAE,EAAE,CAAC;CAClB,CAoCJ;AACD,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,EAAE,UAAU,GAAG,QAAQ,CAkBxE;AAMD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAA8B,EAAE,KAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,iBAAiB,+BA2BpL;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,MAAY,EAAE,QAAQ,EAAE,EAAE;IACnD,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,GAQ2E,GAAG,CACtF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useObjectReady } from '../hooks/useObjectReady.js';
|
|
4
4
|
import { EdgesGeometry, WireframeGeometry, Mesh, MeshBasicMaterial, Raycaster, Vector3, DoubleSide, } from 'three';
|
|
5
5
|
import { buildSegmentQuadGeometry } from '@3driseai/3drise-core';
|
|
6
6
|
import { shapeGenerators } from '../utils/shapes.js';
|
|
7
|
+
import { DEFAULT_TEXT_SHAPE_FONT, loadOutlineFont } from '../utils/textShape.js';
|
|
7
8
|
import PointCloud from './PointCloud.js';
|
|
8
9
|
/**
|
|
9
10
|
* World-space half-thickness of a line ribbon at `lineWidth: 1`. Line modes are
|
|
@@ -34,13 +35,32 @@ function normalizeModeConfig(config) {
|
|
|
34
35
|
...(config || {}),
|
|
35
36
|
};
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The text shape's font loads lazily: bumps once per font when it has landed, so the geometry rebuilds. Always
|
|
40
|
+
* waits on the load (an inlined font can land in the microtask between the render that started it and this
|
|
41
|
+
* effect, so "already loaded" here does not mean the geometry above was built with it).
|
|
42
|
+
*/
|
|
43
|
+
function useTextShapeFont(cfg) {
|
|
44
|
+
const font = cfg.type === 'text' ? (cfg.font ?? DEFAULT_TEXT_SHAPE_FONT) : null;
|
|
45
|
+
const [tick, setTick] = useState(0);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (font === null)
|
|
48
|
+
return;
|
|
49
|
+
let dead = false;
|
|
50
|
+
loadOutlineFont(font).then(() => { if (!dead)
|
|
51
|
+
setTick((t) => t + 1); });
|
|
52
|
+
return () => { dead = true; };
|
|
53
|
+
}, [font]);
|
|
54
|
+
return font === null ? 0 : tick;
|
|
55
|
+
}
|
|
37
56
|
export function useShapeGeometry(options) {
|
|
38
57
|
const safeOptions = useMemo(() => normalizeShapeConfig(options), [options]);
|
|
39
58
|
const key = JSON.stringify(safeOptions);
|
|
59
|
+
const fontTick = useTextShapeFont(safeOptions);
|
|
40
60
|
const geometry = useMemo(() => {
|
|
41
61
|
const generator = shapeGenerators[safeOptions.type] ?? shapeGenerators.box;
|
|
42
62
|
return generator(safeOptions);
|
|
43
|
-
}, [safeOptions.type, key]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
63
|
+
}, [safeOptions.type, key, fontTick]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
44
64
|
useEffect(() => () => geometry.dispose(), [geometry]);
|
|
45
65
|
return geometry;
|
|
46
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAA2C,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiBrD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAkBF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8IzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useMemo } from "react";
|
|
3
3
|
import CustomPrimitive from "./CustomPrimitive.js";
|
|
4
4
|
import CreatedObject from "./CreatedObject.js";
|
|
5
|
-
import Text3D from './Text3D.js';
|
|
6
|
-
import Text2D from './Text2D.js';
|
|
7
5
|
import PathRenderer from './PathRenderer.js';
|
|
8
6
|
import GalleryLayout from './GalleryLayout.js';
|
|
9
7
|
import EffectsGenerator from './EffectsGenerator.js';
|
|
@@ -20,7 +18,7 @@ import LayoutInstances from "./LayoutInstances.js";
|
|
|
20
18
|
import { useRuntimeSettings } from "../hooks/useRuntimeSettings.js";
|
|
21
19
|
import { usePresentedVisibility } from "../operations/usePresentedVisibility.js";
|
|
22
20
|
import { SELF_MANAGED_MATERIAL } from "../constants.js";
|
|
23
|
-
import { LAYOUT_CAPABLE_TYPES, getObjectLayoutSupport, normalizeObjectLayout, isGenerativeParticlesConfig
|
|
21
|
+
import { LAYOUT_CAPABLE_TYPES, getObjectLayoutSupport, normalizeObjectLayout, isGenerativeParticlesConfig } from "@3driseai/3drise-core";
|
|
24
22
|
// Slots after the first render with no ready callbacks: one object reports once.
|
|
25
23
|
const NO_READY = {};
|
|
26
24
|
// A point light's shadow is six extra renders; only slot 0 keeps it. Cached per settings
|
|
@@ -47,9 +45,7 @@ const GroupWithChildren = ({ createdObject, children, onObjectReady, onObjectDis
|
|
|
47
45
|
const isGroup = createdObject.type === 'group';
|
|
48
46
|
// Generative particle objects own their shaders, like effects do.
|
|
49
47
|
const selfManagedMaterial = SELF_MANAGED_MATERIAL.has(createdObject.type)
|
|
50
|
-
|| (createdObject.type === 'particles' && isGenerativeParticlesConfig(createdObject.config))
|
|
51
|
-
// The animated text looks own their shaders; the legacy 2d / 3d text (same object type) keeps its material.
|
|
52
|
-
|| (createdObject.type === 'text' && isTextObjectConfig(createdObject.config));
|
|
48
|
+
|| (createdObject.type === 'particles' && isGenerativeParticlesConfig(createdObject.config));
|
|
53
49
|
return (_jsxs(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !isGroup && !selfManagedMaterial, children: [!isGroup && renderObject(createdObject, handleObjectClick), children.map(childNode => (_jsx(ObjectNode, { node: childNode, handleObjectClick: handleObjectClick, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }, childNode.objectId)))] }, createdObject.id));
|
|
54
50
|
};
|
|
55
51
|
const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick }) => {
|
|
@@ -95,15 +91,8 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
|
|
|
95
91
|
// handleObjectClick={handleObjectClick}
|
|
96
92
|
// />
|
|
97
93
|
// ),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (isTextObjectConfig(obj.config))
|
|
101
|
-
return (_jsx(TextGenerator, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
102
|
-
const renderMode = obj.config?.renderMode ?? 'bitmap';
|
|
103
|
-
return (_jsx(_Fragment, { children: renderMode === 'text3d'
|
|
104
|
-
? _jsx(Text3D, { textSettings: obj, ...relabel(obj) })
|
|
105
|
-
: _jsx(Text2D, { textSettings: obj, ...relabel(obj) }) }));
|
|
106
|
-
},
|
|
94
|
+
// Text looks (config.type: plain, handwriting, neonTube, …) render through TextGenerator.
|
|
95
|
+
text: (obj, onObjectReady) => (_jsx(TextGenerator, { createdObject: obj, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })),
|
|
107
96
|
particles: (obj, onObjectReady) => {
|
|
108
97
|
// Generative particle objects (config.type) render through ParticlesGenerator;
|
|
109
98
|
// the legacy shape particles keep their own path.
|
|
@@ -180,7 +169,7 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
|
|
|
180
169
|
const shouldRenderAsGroup = hasChildren || createdObject.type === 'group' || createdObject.type === 'effect';
|
|
181
170
|
const renderedObject = shouldRenderAsGroup
|
|
182
171
|
? _jsx(GroupWithChildren, { createdObject: createdObject, children: children, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, renderObject: renderObject })
|
|
183
|
-
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !
|
|
172
|
+
: _jsx(CreatedObject, { createdObject: createdObject, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose, handleObjectClick: handleObjectClick, shouldApply3driseMaterial: !SELF_MANAGED_MATERIAL.has(createdObject.type), children: renderObject(createdObject) }, createdObject.id);
|
|
184
173
|
// createdObject.effects
|
|
185
174
|
// ? <>
|
|
186
175
|
// {renderObject(createdObject)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParticlesGenerator.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesGenerator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ParticlesGenerator.d.ts","sourceRoot":"","sources":["../../src/components/ParticlesGenerator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA8B7D,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC7D,QAAQ,EAAE,2BAA2B,CAAC;IACtC,uFAAuF;IACvF,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,0FAA0F;AAC1F,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAwBzD,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
2
|
+
import PickVolume from './PickVolume.js';
|
|
3
|
+
import TidalStreamParticles, { BOUNDS as TIDALSTREAM_BOUNDS } from './particles/TidalStreamParticles.js';
|
|
4
|
+
import BrownianDustParticles, { BOUNDS as BROWNIANDUST_BOUNDS } from './particles/BrownianDustParticles.js';
|
|
5
|
+
import BioluminescentWakeParticles, { BOUNDS as BIOLUMINESCENTWAKE_BOUNDS } from './particles/BioluminescentWakeParticles.js';
|
|
6
|
+
import ElectronOrbitalsParticles, { BOUNDS as ELECTRONORBITALS_BOUNDS } from './particles/ElectronOrbitalsParticles.js';
|
|
7
|
+
import GrinderSparksParticles, { BOUNDS as GRINDERSPARKS_BOUNDS } from './particles/GrinderSparksParticles.js';
|
|
8
|
+
import ChladniSandParticles, { BOUNDS as CHLADNISAND_BOUNDS } from './particles/ChladniSandParticles.js';
|
|
9
|
+
import FaradayPowderParticles, { BOUNDS as FARADAYPOWDER_BOUNDS } from './particles/FaradayPowderParticles.js';
|
|
10
|
+
import NeonRainParticles, { BOUNDS as NEONRAIN_BOUNDS } from './particles/NeonRainParticles.js';
|
|
11
|
+
import MagneticBottleParticles, { BOUNDS as MAGNETICBOTTLE_BOUNDS } from './particles/MagneticBottleParticles.js';
|
|
12
|
+
import ShapeBurstParticles, { BOUNDS as SHAPEBURST_BOUNDS } from './particles/ShapeBurstParticles.js';
|
|
13
|
+
import ShapeFlowParticles, { BOUNDS as SHAPEFLOW_BOUNDS } from './particles/ShapeFlowParticles.js';
|
|
14
|
+
/** Each variant's pick volume (sim units, × size): the same sphere it culls itself with. */
|
|
15
|
+
const PICK_BOUNDS = {
|
|
16
|
+
tidalStream: TIDALSTREAM_BOUNDS,
|
|
17
|
+
brownianDust: BROWNIANDUST_BOUNDS,
|
|
18
|
+
bioluminescentWake: BIOLUMINESCENTWAKE_BOUNDS,
|
|
19
|
+
electronOrbitals: ELECTRONORBITALS_BOUNDS,
|
|
20
|
+
grinderSparks: GRINDERSPARKS_BOUNDS,
|
|
21
|
+
chladniSand: CHLADNISAND_BOUNDS,
|
|
22
|
+
faradayPowder: FARADAYPOWDER_BOUNDS,
|
|
23
|
+
neonRain: NEONRAIN_BOUNDS,
|
|
24
|
+
magneticBottle: MAGNETICBOTTLE_BOUNDS,
|
|
25
|
+
shapeBurst: SHAPEBURST_BOUNDS,
|
|
26
|
+
shapeFlow: SHAPEFLOW_BOUNDS,
|
|
27
|
+
};
|
|
13
28
|
/** Standalone generative particle objects (type 'particles'), switched on config.type. */
|
|
14
29
|
const ParticlesGenerator = ({ settings, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
15
30
|
const { config, animations } = settings;
|
|
@@ -17,19 +32,24 @@ const ParticlesGenerator = ({ settings, mouseMove, onObjectReady, onObjectDispos
|
|
|
17
32
|
return null;
|
|
18
33
|
const size = config.size ?? 1;
|
|
19
34
|
const ready = { onObjectReady, onObjectDispose, mouseMove };
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
// Hover / click hit the system's volume (its own culling sphere, × size), never a sprite.
|
|
36
|
+
const b = PICK_BOUNDS[config.type] ?? { center: [0, 0, 0], radius: 1.3 };
|
|
37
|
+
return _jsx(PickVolume, { center: [b.center[0] * size, b.center[1] * size, b.center[2] * size], radius: b.radius * size * 1.05, children: variant() });
|
|
38
|
+
function variant() {
|
|
39
|
+
switch (config.type) {
|
|
40
|
+
case 'tidalStream': return _jsx(TidalStreamParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
41
|
+
case 'brownianDust': return _jsx(BrownianDustParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
42
|
+
case 'bioluminescentWake': return _jsx(BioluminescentWakeParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
43
|
+
case 'electronOrbitals': return _jsx(ElectronOrbitalsParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
44
|
+
case 'grinderSparks': return _jsx(GrinderSparksParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
45
|
+
case 'chladniSand': return _jsx(ChladniSandParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
46
|
+
case 'faradayPowder': return _jsx(FaradayPowderParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
47
|
+
case 'neonRain': return _jsx(NeonRainParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
48
|
+
case 'magneticBottle': return _jsx(MagneticBottleParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
49
|
+
case 'shapeBurst': return _jsx(ShapeBurstParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
50
|
+
case 'shapeFlow': return _jsx(ShapeFlowParticles, { id: settings.id, size: size, config: config, animations: animations, ...ready });
|
|
51
|
+
default: return null;
|
|
52
|
+
}
|
|
33
53
|
}
|
|
34
54
|
};
|
|
35
55
|
export default ParticlesGenerator;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PickVolumeProps {
|
|
3
|
+
/** Sphere centre and radius in world units of the parent (already multiplied by the object's size). */
|
|
4
|
+
center?: [number, number, number];
|
|
5
|
+
radius: number;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hover / click land on one invisible sphere over a generative object's volume, never on what it draws: the
|
|
10
|
+
* sprites of a particle system live on the GPU (the CPU attributes are seeds, not positions), an effect's points
|
|
11
|
+
* are sparse, and a user who clicks a cloud means the cloud. The children are taken out of raycasting as they
|
|
12
|
+
* appear (a build can add meshes after mount), so the sphere is the only hit target. Its geometry also gives the
|
|
13
|
+
* selection gizmo a true bounding box.
|
|
14
|
+
*/
|
|
15
|
+
declare const PickVolume: React.FC<PickVolumeProps>;
|
|
16
|
+
export default PickVolume;
|
|
17
|
+
//# sourceMappingURL=PickVolume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickVolume.d.ts","sourceRoot":"","sources":["../../src/components/PickVolume.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,MAAM,WAAW,eAAe;IAC5B,uGAAuG;IACvG,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAWzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|