@3driseai/3drise-viewer 0.1.35 → 0.1.37
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.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +3 -1
- package/dist/components/effects/HarmonicShellEffect.d.ts.map +1 -1
- package/dist/components/effects/HarmonicShellEffect.js +165 -173
- package/dist/components/effects/harmonicShellField.d.ts +77 -0
- package/dist/components/effects/harmonicShellField.d.ts.map +1 -0
- package/dist/components/effects/harmonicShellField.js +752 -0
- package/dist/operations/catalogue/inShell.d.ts +22 -0
- package/dist/operations/catalogue/inShell.d.ts.map +1 -0
- package/dist/operations/catalogue/inShell.js +245 -0
- package/dist/operations/catalogue/shaderLayers.d.ts.map +1 -1
- package/dist/operations/catalogue/shaderLayers.js +10 -7
- package/dist/operations/registry.d.ts.map +1 -1
- package/dist/operations/registry.js +2 -1
- package/package.json +3 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
/** The look knobs, as the shell's config carries them (same meaning as the operation's params). */
|
|
3
|
+
export interface InShellLook {
|
|
4
|
+
look: 'film' | 'ghost';
|
|
5
|
+
bands: number;
|
|
6
|
+
seam: number;
|
|
7
|
+
warp: number;
|
|
8
|
+
core: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A shell found this object crossing it: give it the layer now (no data on the object, nothing
|
|
12
|
+
* saved) and keep it until `shellRelease`. An object that already carries the effect itself
|
|
13
|
+
* (its Effects tab, an action; `ownOn`, from the runtime) is left to that.
|
|
14
|
+
*/
|
|
15
|
+
export declare function shellAttach(target: Object3D, look: InShellLook, ownOn?: boolean): boolean;
|
|
16
|
+
/** The object left the shell: take the layer off (only one the shell attached). */
|
|
17
|
+
export declare function shellRelease(target: Object3D): void;
|
|
18
|
+
/** Whether the shell put the effect on this object (as opposed to the object's own effects). */
|
|
19
|
+
export declare const shellAttached: (target: Object3D) => boolean;
|
|
20
|
+
declare const _default: import("..").OperationDefinition;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=inShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inShell.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/inShell.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgJtC,mGAAmG;AACnG,MAAM,WAAW,WAAW;IAAG,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AA4BhH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,UAAQ,GAAG,OAAO,CAevF;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,QAQ5C;AAED,gGAAgG;AAChG,eAAO,MAAM,aAAa,GAAI,QAAQ,QAAQ,KAAG,OAA8D,CAAC;;AAEhH,wBA+BG"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// In shell — the object shows the Harmonic Shell it is in. Per pixel its material
|
|
2
|
+
// evaluates the shell's own field (the shell's harmonics, bound and colours, or
|
|
3
|
+
// its morph target), so the part inside the shell takes the shell's thin-film
|
|
4
|
+
// look with slow scan bands, the crossing gets a seam in the rim colour, and the
|
|
5
|
+
// part outside stays as it is. Per vertex the inside follows the membrane like
|
|
6
|
+
// the contents of a bubble (`warp`). Nothing is baked per object: the shell and
|
|
7
|
+
// the object may both move, the look follows. A state: in → hold → out.
|
|
8
|
+
//
|
|
9
|
+
// The shell is found, not picked: the nearest Harmonic Shell in the scene (by
|
|
10
|
+
// centre), re-checked every tick. An object the shell is wrapping (its morph
|
|
11
|
+
// target) is left alone — it IS the shell's surface, not something inside it.
|
|
12
|
+
import { Matrix4, Vector3 } from 'three';
|
|
13
|
+
import gsap from 'gsap';
|
|
14
|
+
import { defineOperation } from '../types.js';
|
|
15
|
+
import { addLayer, forEachMeshMaterial, removeLayer } from './shaderLayers.js';
|
|
16
|
+
import { createFieldState, fieldUniforms, runProgress } from './transitionField.js';
|
|
17
|
+
import { HSH_FIELD_FUNCS, copyShellUniforms, createShellUniforms, nearestShellField } from '../../components/effects/harmonicShellField.js';
|
|
18
|
+
const P = 'Ins';
|
|
19
|
+
const KEY = 'inShell';
|
|
20
|
+
const STATE = '__opInShell';
|
|
21
|
+
function layerFor(st) {
|
|
22
|
+
return {
|
|
23
|
+
uniforms: {
|
|
24
|
+
...fieldUniforms(P, st.field),
|
|
25
|
+
...st.shell,
|
|
26
|
+
uInsShellInv: st.u.shellInv, uInsShellMat: st.u.shellMat, uInsHas: st.u.has, uInsSelf: st.u.self,
|
|
27
|
+
uInsLook: st.u.look, uInsBands: st.u.bands, uInsSeam: st.u.seam, uInsWarp: st.u.warp, uInsCore: st.u.core,
|
|
28
|
+
},
|
|
29
|
+
common: /* glsl */ `
|
|
30
|
+
varying vec3 vInsWorld;
|
|
31
|
+
varying vec3 vInsView;
|
|
32
|
+
${HSH_FIELD_FUNCS}
|
|
33
|
+
// how much this effect is on right now: its progress, only with a shell, never on the shell's own target
|
|
34
|
+
float insOn(){ return u${P}Progress * uInsHas * (1.0 - uInsSelf); }`,
|
|
35
|
+
vertexPars: /* glsl */ `
|
|
36
|
+
// The bubble's contents follow its membrane: a point inside, at direction n from the
|
|
37
|
+
// shell's centre, is scaled by the membrane's local radius R(n)/R0 — fully at the
|
|
38
|
+
// membrane, fading to the centre (uInsCore) — and blended out across the boundary so
|
|
39
|
+
// the part outside stays rigid. Off while the shell is morphing into a target.
|
|
40
|
+
vec3 insWarp(vec3 pObj){
|
|
41
|
+
float on = insOn() * uInsWarp * (1.0 - uHshMorph * step(0.5, uHshMode));
|
|
42
|
+
if (on <= 0.0) return pObj;
|
|
43
|
+
vec3 pl = (uInsShellInv * modelMatrix * vec4(pObj, 1.0)).xyz;
|
|
44
|
+
float r = length(pl); if (r < 1e-4) return pObj;
|
|
45
|
+
vec3 n = pl / r; float f; float R = hshRadius(n, f); float R0 = uHshBound * uHshSize;
|
|
46
|
+
if (r >= R * 0.98) return pObj; // outside, or at the membrane: untouched
|
|
47
|
+
// zero AT the membrane (the crossing never moves, nothing shows outside), growing inward;
|
|
48
|
+
// the centre stays put too (uInsCore)
|
|
49
|
+
float depth = 1.0 - smoothstep(R * 0.55, R * 0.98, r);
|
|
50
|
+
float k = pow(clamp(r / R0, 0.0, 1.0), mix(0.4, 3.0, uInsCore));
|
|
51
|
+
float w = on * depth * k;
|
|
52
|
+
float rNew = min(r * mix(1.0, R / R0, w), R * 0.985); // never past the membrane
|
|
53
|
+
vec3 plNew = n * rNew;
|
|
54
|
+
return (inverse(modelMatrix) * uInsShellMat * vec4(plNew, 1.0)).xyz;
|
|
55
|
+
}`,
|
|
56
|
+
normal: /* glsl */ `
|
|
57
|
+
if (uInsWarp > 0.0 && insOn() > 0.0) {
|
|
58
|
+
// the warped normal, from two warped neighbours in the tangent plane
|
|
59
|
+
vec3 insUp = abs(objectNormal.y) > 0.99 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);
|
|
60
|
+
vec3 insT1 = normalize(cross(objectNormal, insUp)); vec3 insT2 = cross(objectNormal, insT1);
|
|
61
|
+
float insE = 0.02 * uHshBound;
|
|
62
|
+
vec3 insP0 = insWarp(position);
|
|
63
|
+
vec3 insD = insP0 - position;
|
|
64
|
+
vec3 insP1 = insWarp(position + insT1 * insE), insP2 = insWarp(position + insT2 * insE);
|
|
65
|
+
vec3 insN = cross(insP1 - insP0, insP2 - insP0);
|
|
66
|
+
// only where the vertex itself moved: outside the shell the normal stays the object's own
|
|
67
|
+
if (dot(insD, insD) > 1e-12 && dot(insN, insN) > 1e-14) { insN = normalize(insN); if (dot(insN, objectNormal) < 0.0) insN = -insN; objectNormal = insN; }
|
|
68
|
+
}`,
|
|
69
|
+
vertex: /* glsl */ `
|
|
70
|
+
transformed = insWarp(transformed);
|
|
71
|
+
vInsWorld = (modelMatrix * vec4(transformed, 1.0)).xyz;
|
|
72
|
+
vInsView = (modelViewMatrix * vec4(transformed, 1.0)).xyz;`,
|
|
73
|
+
fragmentPars: /* glsl */ `
|
|
74
|
+
float insInside = 0.0; float insSeam = 0.0; vec3 insFilm = vec3(0.0); float insBands = 0.5;`,
|
|
75
|
+
diffuse: /* glsl */ `
|
|
76
|
+
{
|
|
77
|
+
float on = insOn();
|
|
78
|
+
if (on > 0.0) {
|
|
79
|
+
float field;
|
|
80
|
+
float d = hshDist((uInsShellInv * vec4(vInsWorld, 1.0)).xyz, field);
|
|
81
|
+
float w = max(fwidth(d) * 1.5, 0.003 * uHshBound);
|
|
82
|
+
insInside = (1.0 - smoothstep(-w, w, d)) * on;
|
|
83
|
+
// the membrane over the crossing: a thin bright line, a soft halo fading into the inside
|
|
84
|
+
// one-sided: the glow lives on the inside of the membrane (d < 0); outside only a hair, for anti-aliasing
|
|
85
|
+
float ws = uHshBound * mix(0.012, 0.07, uInsSeam);
|
|
86
|
+
float inSide = d < 0.0 ? 1.0 : exp(-d / max(w, 1e-4));
|
|
87
|
+
float line = exp(-abs(d) / ws) * inSide;
|
|
88
|
+
float halo = (d < 0.0 ? exp(d / (ws * 4.0)) : 0.0) * 0.5;
|
|
89
|
+
insSeam = (line + halo) * step(0.001, uInsSeam) * on;
|
|
90
|
+
// the shell's film at this pixel, seen from the camera; scan bands drift with the shell's clock
|
|
91
|
+
vec3 nv = normalize(cross(dFdx(vInsView), dFdy(vInsView)));
|
|
92
|
+
float ndv = abs(dot(nv, normalize(-vInsView)));
|
|
93
|
+
insFilm = hshFilm(ndv, field);
|
|
94
|
+
insBands = 0.5 + 0.5 * sin((vInsWorld.y / uHshBound - uHshTime * 0.35) * 20.0 + d * 14.0);
|
|
95
|
+
float bands = mix(0.5, insBands, uInsBands);
|
|
96
|
+
vec3 lookFilm = mix(uHshColor * 0.35, insFilm, 0.55 + 0.45 * bands);
|
|
97
|
+
vec3 lookGhost = mix(diffuseColor.rgb, uHshColor, 0.75) * (0.8 + 0.5 * bands);
|
|
98
|
+
diffuseColor.rgb = mix(diffuseColor.rgb, mix(lookFilm, lookGhost, uInsLook), insInside);
|
|
99
|
+
}
|
|
100
|
+
}`,
|
|
101
|
+
// the glow goes on top of the lit result, so unlit materials get it too
|
|
102
|
+
fragment: /* glsl */ `
|
|
103
|
+
outgoingLight += uHshRim * insSeam * 1.4;
|
|
104
|
+
outgoingLight += insFilm * insInside * 0.16 * (0.6 + 0.4 * insBands) * (1.0 - uInsLook);`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// ---------------------------------------------------------------- following the shell
|
|
108
|
+
/** States that are on → their root. One ticker copies the nearest shell's values into each. */
|
|
109
|
+
const live = new Map();
|
|
110
|
+
let tick = null;
|
|
111
|
+
const _pos = new Vector3();
|
|
112
|
+
function sync(root, st) {
|
|
113
|
+
_pos.setFromMatrixPosition(root.matrixWorld);
|
|
114
|
+
const shell = nearestShellField(_pos);
|
|
115
|
+
if (!shell) {
|
|
116
|
+
st.u.has.value = 0;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
copyShellUniforms(shell.uniforms, st.shell);
|
|
120
|
+
// Both matrices from the same world matrix, read now: the shader maps the vertex into shell space
|
|
121
|
+
// with the inverse and back out with the matrix, so they must be exact mutual inverses of one moment.
|
|
122
|
+
// (shell.inv is the shell's own copy from its useFrame, a frame behind a moving shell - using it here
|
|
123
|
+
// displaced a moving object's inside by the frame's motion, mirrored, and jittered the warp.)
|
|
124
|
+
shell.root.updateWorldMatrix(true, false);
|
|
125
|
+
st.u.shellMat.value.copy(shell.root.matrixWorld);
|
|
126
|
+
st.u.shellInv.value.copy(st.u.shellMat.value).invert();
|
|
127
|
+
st.u.has.value = 1;
|
|
128
|
+
st.u.self.value = shell.target === root ? 1 : 0;
|
|
129
|
+
}
|
|
130
|
+
function follow(root, st) {
|
|
131
|
+
live.set(st, root);
|
|
132
|
+
sync(root, st);
|
|
133
|
+
if (tick)
|
|
134
|
+
return;
|
|
135
|
+
tick = () => live.forEach((r, s) => sync(r, s));
|
|
136
|
+
gsap.ticker.add(tick);
|
|
137
|
+
}
|
|
138
|
+
function unfollow(st) {
|
|
139
|
+
if (!live.delete(st) || live.size || !tick)
|
|
140
|
+
return;
|
|
141
|
+
gsap.ticker.remove(tick);
|
|
142
|
+
tick = null;
|
|
143
|
+
}
|
|
144
|
+
function build(target) {
|
|
145
|
+
const st = {
|
|
146
|
+
field: createFieldState(target),
|
|
147
|
+
shell: createShellUniforms(),
|
|
148
|
+
u: { shellInv: { value: new Matrix4() }, shellMat: { value: new Matrix4() }, has: { value: 0 }, self: { value: 0 }, look: { value: 0 }, bands: { value: 1 }, seam: { value: 1 }, warp: { value: 0.6 }, core: { value: 0.5 } },
|
|
149
|
+
mats: new Set(),
|
|
150
|
+
};
|
|
151
|
+
const layer = layerFor(st);
|
|
152
|
+
forEachMeshMaterial(target, (mat, mesh) => {
|
|
153
|
+
if (mesh.userData?.__opFxHelper)
|
|
154
|
+
return;
|
|
155
|
+
if (addLayer(mat, KEY, layer))
|
|
156
|
+
st.mats.add(mat);
|
|
157
|
+
});
|
|
158
|
+
target.userData[STATE] = st;
|
|
159
|
+
return st;
|
|
160
|
+
}
|
|
161
|
+
function setLook(st, p) {
|
|
162
|
+
if (p.look !== undefined)
|
|
163
|
+
st.u.look.value = p.look === 'ghost' ? 1 : 0;
|
|
164
|
+
if (p.bands !== undefined)
|
|
165
|
+
st.u.bands.value = Number(p.bands);
|
|
166
|
+
if (p.seam !== undefined)
|
|
167
|
+
st.u.seam.value = Number(p.seam);
|
|
168
|
+
if (p.warp !== undefined)
|
|
169
|
+
st.u.warp.value = Number(p.warp);
|
|
170
|
+
if (p.core !== undefined)
|
|
171
|
+
st.u.core.value = Number(p.core);
|
|
172
|
+
}
|
|
173
|
+
const AUTO = '__opInShellAuto';
|
|
174
|
+
/**
|
|
175
|
+
* A shell found this object crossing it: give it the layer now (no data on the object, nothing
|
|
176
|
+
* saved) and keep it until `shellRelease`. An object that already carries the effect itself
|
|
177
|
+
* (its Effects tab, an action; `ownOn`, from the runtime) is left to that.
|
|
178
|
+
*/
|
|
179
|
+
export function shellAttach(target, look, ownOn = false) {
|
|
180
|
+
let st = target.userData[STATE];
|
|
181
|
+
if (st) {
|
|
182
|
+
if (target.userData[AUTO]) {
|
|
183
|
+
setLook(st, look);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
// the object's own effect is on: it decides (false = the shell tries again later).
|
|
187
|
+
// A state that is neither auto nor on is a pre-warm passing through: wait for it.
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
if (ownOn)
|
|
191
|
+
return false;
|
|
192
|
+
st = build(target);
|
|
193
|
+
target.userData[AUTO] = true;
|
|
194
|
+
setLook(st, look);
|
|
195
|
+
follow(target, st);
|
|
196
|
+
void runProgress(target, st.field, 1, { duration: 0.25, ease: 'power1.out', hold: true });
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
/** The object left the shell: take the layer off (only one the shell attached). */
|
|
200
|
+
export function shellRelease(target) {
|
|
201
|
+
const st = target.userData[STATE];
|
|
202
|
+
if (!st || !target.userData[AUTO])
|
|
203
|
+
return;
|
|
204
|
+
delete target.userData[AUTO];
|
|
205
|
+
void runProgress(target, st.field, 0, {
|
|
206
|
+
duration: 0.25, ease: 'power1.in',
|
|
207
|
+
onComplete: () => { if (target.userData[STATE] !== st)
|
|
208
|
+
return; unfollow(st); st.mats.forEach(m => removeLayer(m, KEY)); delete target.userData[STATE]; },
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/** Whether the shell put the effect on this object (as opposed to the object's own effects). */
|
|
212
|
+
export const shellAttached = (target) => !!target.userData[AUTO] && !!target.userData[STATE];
|
|
213
|
+
export default defineOperation({
|
|
214
|
+
value: 'inShell',
|
|
215
|
+
label: 'In shell',
|
|
216
|
+
description: 'The object shows the Harmonic Shell it is in: the part inside takes the shell\'s film, the crossing glows, and the inside sways with the membrane — reverting puts the plain object back',
|
|
217
|
+
channel: 'visual',
|
|
218
|
+
multi: true,
|
|
219
|
+
toggles: true,
|
|
220
|
+
usableIn: ['interaction', 'action', 'object'],
|
|
221
|
+
params: {
|
|
222
|
+
look: { type: 'select', label: 'Inside look', default: 'film', options: [{ value: 'film', label: 'Soap film' }, { value: 'ghost', label: 'Ghost tint' }], hint: 'Soap film: the shell\'s thin-film colours. Ghost: the object tinted with the shell colour' },
|
|
223
|
+
bands: { type: 'number', label: 'Scan bands', default: 1, min: 0, max: 1, step: 0.01, hint: 'Bands drifting through the inside with the shell\'s clock' },
|
|
224
|
+
seam: { type: 'number', label: 'Seam', default: 1, min: 0, max: 1, step: 0.01, hint: 'Glow where the object crosses the shell' },
|
|
225
|
+
warp: { type: 'number', label: 'Warp', default: 0.6, min: 0, max: 1.5, step: 0.01, hint: 'How much the inside follows the membrane (needs a mesh with enough vertices to bend)' },
|
|
226
|
+
core: { type: 'number', label: 'Core hold', default: 0.5, min: 0, max: 1, step: 0.01, hint: 'How stiff the centre is: high = only near the membrane moves' },
|
|
227
|
+
duration: { type: 'number', label: 'Duration', default: 1.2, min: 0, max: 8, step: 0.1, unit: 's' },
|
|
228
|
+
},
|
|
229
|
+
apply(target, p) {
|
|
230
|
+
delete target.userData[AUTO]; // the object's own effect takes over from a shell-attached one
|
|
231
|
+
const s = target.userData[STATE] ?? build(target);
|
|
232
|
+
setLook(s, { look: p.look, bands: Number(p.bands), seam: Number(p.seam), warp: Number(p.warp), core: Number(p.core) });
|
|
233
|
+
follow(target, s);
|
|
234
|
+
return runProgress(target, s.field, 1, { duration: Number(p.duration), ease: 'power1.out', hold: true });
|
|
235
|
+
},
|
|
236
|
+
revert(target, p) {
|
|
237
|
+
const s = target.userData[STATE];
|
|
238
|
+
if (!s)
|
|
239
|
+
return;
|
|
240
|
+
return runProgress(target, s.field, 0, {
|
|
241
|
+
duration: Number(p.duration) * Math.max(0.05, s.field.progress.value), ease: 'power1.in',
|
|
242
|
+
onComplete: () => { unfollow(s); s.mats.forEach(m => removeLayer(m, KEY)); delete target.userData[STATE]; },
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaderLayers.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/shaderLayers.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,WAAW,WAAW;IACxB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC7C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAmCD,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,KAAK,QAAQ,KAAG,OAEmE,CAAC;AAO7G;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;IAAE,SA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AAC/D,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAYxD;AAED,iDAAiD;AACjD,eAAO,MAAM,UAAU,4rBAWtB,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,QAAQ,4XAUpB,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,WAAW,4rBAoBvB,CAAC"}
|
|
@@ -263,14 +263,17 @@ export function forEachMeshMaterial(root, fn) {
|
|
|
263
263
|
}
|
|
264
264
|
/** `uniform <type> <name>;` from a uniform's current value. */
|
|
265
265
|
export function uniformDecl(name, v) {
|
|
266
|
+
if (v instanceof Float32Array)
|
|
267
|
+
return `uniform float ${name}[${v.length}];`;
|
|
266
268
|
const type = typeof v === 'number' ? 'float'
|
|
267
|
-
: v?.
|
|
268
|
-
: v?.
|
|
269
|
-
: v?.
|
|
270
|
-
: v?.
|
|
271
|
-
: v?.
|
|
272
|
-
: v?.
|
|
273
|
-
: '
|
|
269
|
+
: v?.isData3DTexture ? 'sampler3D'
|
|
270
|
+
: v?.isColor ? 'vec3'
|
|
271
|
+
: v?.isVector3 ? 'vec3'
|
|
272
|
+
: v?.isVector2 ? 'vec2'
|
|
273
|
+
: v?.isVector4 ? 'vec4'
|
|
274
|
+
: v?.isMatrix4 ? 'mat4'
|
|
275
|
+
: v?.isTexture ? 'sampler2D'
|
|
276
|
+
: 'float';
|
|
274
277
|
return `uniform ${type} ${name};`;
|
|
275
278
|
}
|
|
276
279
|
/** Calm 3D value noise + 3-octave fBm (GLSL). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/operations/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/operations/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAgErF,eAAO,MAAM,UAAU,EAAE,mBAAmB,EAQ3C,CAAC;AAIF,eAAO,MAAM,YAAY,GAAI,MAAM,aAAa,KAAG,mBAAmB,GAAG,SAA6B,CAAC;AAEvG,2GAA2G;AAC3G,eAAO,MAAM,aAAa,GAAI,QAAQ,eAAe,EAAE,OAAM;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAAO,KAAG,mBAAmB,EACG,CAAC;AAE7I,kGAAkG;AAClG,eAAO,MAAM,SAAS,GAAI,QAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAAE,KAAG,gBAC/B,CAAC;AAE1E,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,GAAG,EAAE,mBAAmB,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,eAAe,CAOpG"}
|
|
@@ -45,6 +45,7 @@ import orbit from './catalogue/orbit.js';
|
|
|
45
45
|
import kintsugi from './catalogue/kintsugi.js';
|
|
46
46
|
import rainBeads from './catalogue/rainBeads.js';
|
|
47
47
|
import ivy from './catalogue/ivy.js';
|
|
48
|
+
import inShell from './catalogue/inShell.js';
|
|
48
49
|
import curlSmoke from './catalogue/curlSmoke.js';
|
|
49
50
|
import lidarScan from './catalogue/lidarScan.js';
|
|
50
51
|
import print3d from './catalogue/print3d.js';
|
|
@@ -63,7 +64,7 @@ export const OPERATIONS = [
|
|
|
63
64
|
jelly, flip, spin, swirl, blastOff, vortexDrain, leafFall, pop, driftUp, slingshot, warp, knockAway, turnAway, flyBy, whoosh, slam, moveToFront,
|
|
64
65
|
float, sway, bounce, wobble, pulse, shake, rotate, grow,
|
|
65
66
|
glow, rimLight, dissolve, emberAsh, particleSwarm, hologram, shatter,
|
|
66
|
-
sandErosion, teleport, inkBloom, flock, liquidMetal, metalize, frost, heatCracks, petrify, kintsugi, rainBeads, ivy,
|
|
67
|
+
sandErosion, teleport, inkBloom, flock, liquidMetal, metalize, frost, heatCracks, petrify, kintsugi, rainBeads, ivy, inShell,
|
|
67
68
|
portal, voxelize, unweave, petalPeel, curlSmoke, lidarScan, print3d, silkDrape, ...TRAILS,
|
|
68
69
|
fade, visibility, displayImage,
|
|
69
70
|
zoom, frame, focus, orbit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@3driseai/3drise-common": "^1.0.1",
|
|
42
|
-
"@3driseai/3drise-core": "^1.0.
|
|
42
|
+
"@3driseai/3drise-core": "^1.0.28",
|
|
43
|
+
"three-mesh-bvh": "^0.8.3"
|
|
43
44
|
}
|
|
44
45
|
}
|