@rig-c/play 1.28.0 → 1.30.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/dist/_play-runtime.js +57 -12
- package/dist/_play-runtime.js.map +1 -1
- package/dist/composed-camera.d.ts.map +1 -1
- package/dist/composed-take.d.ts +16 -1
- package/dist/composed-take.d.ts.map +1 -1
- package/dist/composed-take.js +392 -76
- package/dist/composed-take.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/loadModel.d.ts +7 -1
- package/dist/loadModel.d.ts.map +1 -1
- package/dist/scene-camera.d.ts.map +1 -1
- package/docs/REFERENCE.md +38 -0
- package/package.json +8 -3
package/dist/_play-runtime.js
CHANGED
|
@@ -2476,9 +2476,8 @@ function posedSlider(r, timelines, t, plant = {}) {
|
|
|
2476
2476
|
};
|
|
2477
2477
|
return { ...r, time: at(tl.time, r.time), mix: at(tl.mix, r.mix) };
|
|
2478
2478
|
}
|
|
2479
|
-
function sliderTime(
|
|
2480
|
-
if (r.bone === null) return
|
|
2481
|
-
const value = sourceValue(state, { source: r.bone, localSource: r.local, offsets: ZERO_OFFSETS }, r.property);
|
|
2479
|
+
function sliderTime(r, value) {
|
|
2480
|
+
if (r.bone === null) return value;
|
|
2482
2481
|
const time = r.to + (value - r.from) * r.scale;
|
|
2483
2482
|
const d = r.timelines.duration;
|
|
2484
2483
|
if (r.loop && d === 0) return 0;
|
|
@@ -2492,10 +2491,11 @@ function valuesAt$1(keys, t) {
|
|
|
2492
2491
|
}
|
|
2493
2492
|
function applySlider(state, r, applied, physics) {
|
|
2494
2493
|
if (r.mix === 0) return [];
|
|
2495
|
-
const
|
|
2494
|
+
const input = r.bone === null ? r.time : sourceValue(state, { source: r.bone, localSource: r.local, offsets: ZERO_OFFSETS }, r.property);
|
|
2495
|
+
const time = sliderTime(r, input);
|
|
2496
2496
|
const d = r.timelines.duration;
|
|
2497
2497
|
const at = r.loop && d !== 0 ? time % d : time;
|
|
2498
|
-
applied?.push({ name: r.name, timelines: r.timelines, at, alpha: r.mix, additive: r.additive, time });
|
|
2498
|
+
applied?.push({ name: r.name, input, timelines: r.timelines, at, alpha: r.mix, additive: r.additive, time });
|
|
2499
2499
|
const alpha = r.mix;
|
|
2500
2500
|
if (physics !== void 0 && state.rules.sliderWritesPhysics) applySliderPhysics(r, at, alpha, physics);
|
|
2501
2501
|
const changed = [];
|
|
@@ -6706,6 +6706,49 @@ function drawnRegions(doc, shown, order, source) {
|
|
|
6706
6706
|
if (unmeasured.length > 0) return { drawn: null, why: `${unmeasured.join("; ")} — which of the two counts the runtime steps it over was not measured` };
|
|
6707
6707
|
return { drawn, why: null };
|
|
6708
6708
|
}
|
|
6709
|
+
class CompileError extends Error {
|
|
6710
|
+
constructor(message, codeOrOptions, options) {
|
|
6711
|
+
super(message, typeof codeOrOptions === "string" ? options : codeOrOptions);
|
|
6712
|
+
if (typeof codeOrOptions === "string") this.code = codeOrOptions;
|
|
6713
|
+
}
|
|
6714
|
+
}
|
|
6715
|
+
const FLOAT32_SCRATCH = new Float32Array(1);
|
|
6716
|
+
const FLOAT32_BITS = new Uint32Array(FLOAT32_SCRATCH.buffer);
|
|
6717
|
+
function f32(n) {
|
|
6718
|
+
const f = Math.fround(n);
|
|
6719
|
+
if (f === 0 || !Number.isFinite(f)) return f === 0 ? 0 : f;
|
|
6720
|
+
const magnitude = Math.abs(f);
|
|
6721
|
+
const sign = f < 0 ? "-" : "";
|
|
6722
|
+
for (let p = 1; p <= 9; p++) {
|
|
6723
|
+
const [mantissa, exponent] = magnitude.toExponential(p - 1).split("e");
|
|
6724
|
+
const nearest = BigInt(mantissa.replace(".", ""));
|
|
6725
|
+
const scale = Number(exponent) - (p - 1);
|
|
6726
|
+
const named = [nearest - 1n, nearest, nearest + 1n].filter(
|
|
6727
|
+
(digits) => digits > 0n && Math.fround(Number(`${digits}e${scale}`)) === magnitude
|
|
6728
|
+
);
|
|
6729
|
+
if (named.length === 0) continue;
|
|
6730
|
+
const chosen = named.reduce((a, b) => closerDecimal(a, b, scale, magnitude));
|
|
6731
|
+
return Number(`${sign}${chosen}e${scale}`);
|
|
6732
|
+
}
|
|
6733
|
+
throw new CompileError(`no decimal of at most 9 significant digits names the float32 of ${n}`, "CE_COMPILE_FLOAT32_DECIMAL_UNREPRESENTABLE");
|
|
6734
|
+
}
|
|
6735
|
+
function closerDecimal(a, b, scale, f) {
|
|
6736
|
+
FLOAT32_SCRATCH[0] = f;
|
|
6737
|
+
const bits = FLOAT32_BITS[0];
|
|
6738
|
+
const biased = bits >>> 23 & 255;
|
|
6739
|
+
const fraction = BigInt(bits & 8388607);
|
|
6740
|
+
const significand = biased === 0 ? fraction : fraction | 0x800000n;
|
|
6741
|
+
const doubled = (biased === 0 ? -149 : biased - 150) + 1;
|
|
6742
|
+
let midpoint = a + b;
|
|
6743
|
+
let float = significand;
|
|
6744
|
+
if (scale >= 0) midpoint *= 10n ** BigInt(scale);
|
|
6745
|
+
else float *= 10n ** BigInt(-scale);
|
|
6746
|
+
if (doubled >= 0) float <<= BigInt(doubled);
|
|
6747
|
+
else midpoint <<= BigInt(-doubled);
|
|
6748
|
+
if (midpoint < float) return b;
|
|
6749
|
+
if (midpoint > float) return a;
|
|
6750
|
+
return a % 2n === 0n ? a : b;
|
|
6751
|
+
}
|
|
6709
6752
|
const liveDrawings = /* @__PURE__ */ new WeakMap();
|
|
6710
6753
|
function renderFrameOf(frame2) {
|
|
6711
6754
|
if ("order" in frame2) return frame2;
|
|
@@ -15063,15 +15106,17 @@ export {
|
|
|
15063
15106
|
CanvasRenderer as b,
|
|
15064
15107
|
poseRawSetup as c,
|
|
15065
15108
|
discoverTurnDials as d,
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15109
|
+
frameOf as e,
|
|
15110
|
+
f32 as f,
|
|
15111
|
+
frameSource as g,
|
|
15112
|
+
rememberComposedClip as h,
|
|
15113
|
+
createAtlasRegions as i,
|
|
15114
|
+
readSetupMesh as j,
|
|
15115
|
+
revokeRegions as k,
|
|
15073
15116
|
loadModel as l,
|
|
15117
|
+
unpackRegions as m,
|
|
15074
15118
|
normalizedDial as n,
|
|
15119
|
+
openTrack as o,
|
|
15075
15120
|
poseRawAnimation as p,
|
|
15076
15121
|
readModel as r,
|
|
15077
15122
|
underNoSkin as u
|