@cueframe/kernel 0.2.14 → 0.2.16
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/_members/animate/index.d.ts +1 -1
- package/dist/_members/animate/three/FrameDepthOfField.d.ts +8 -0
- package/dist/_members/animate/three/depthOfFieldPipeline.d.ts +29 -0
- package/dist/_members/animate/three/index.d.ts +1 -0
- package/dist/_members/brand-derivation/constants.d.ts +5 -4
- package/dist/_members/brand-derivation/contrastSafe.d.ts +7 -2
- package/dist/_members/component-runtime/allowedImports.d.ts +1 -1
- package/dist/_members/component-runtime/allowedImports.d.ts.map +1 -1
- package/dist/_members/component-runtime/bake.d.ts.map +1 -1
- package/dist/_members/component-runtime/browserFirewall.d.ts.map +1 -1
- package/dist/_members/component-runtime/index.d.ts +1 -0
- package/dist/_members/component-runtime/index.d.ts.map +1 -1
- package/dist/_members/component-runtime/localRoot.d.ts +10 -0
- package/dist/_members/component-runtime/localRoot.d.ts.map +1 -1
- package/dist/_members/component-runtime/sourceAdmission.d.ts +12 -0
- package/dist/_members/component-runtime/sourceAdmission.d.ts.map +1 -0
- package/dist/_members/composition/projection/composition-floor.d.ts +5 -5
- package/dist/_members/mcp/generated/harness.d.ts +1 -1
- package/dist/animate.js +3 -1
- package/dist/authoring.js +4 -4
- package/dist/brand-derivation/constants.js +1 -1
- package/dist/brand-derivation.js +6 -6
- package/dist/{chunk-A74FZCPY.js → chunk-5NGYBI5Z.js} +2 -1
- package/dist/{chunk-YH4MCHMS.js → chunk-C4P4NC66.js} +1 -1
- package/dist/{chunk-2KO5EQQS.js → chunk-HA4S2ZGH.js} +78 -1
- package/dist/{chunk-DSMLHYJ4.js → chunk-ILO4NEZ3.js} +19 -14
- package/dist/{chunk-NBCFNHST.js → chunk-LQRW5UPR.js} +212 -78
- package/dist/{chunk-6VWICHOZ.js → chunk-O7G2NXUJ.js} +12 -10
- package/dist/{chunk-YLDMAZZE.js → chunk-QDBVYZSF.js} +1 -1
- package/dist/{chunk-RSEN7JYE.js → chunk-QWIK3HKM.js} +46 -8
- package/dist/{chunk-JF4JJAFP.js → chunk-VG2ND6PX.js} +2 -2
- package/dist/{chunk-3HYJ7O5V.js → chunk-WTGUORWJ.js} +1 -1
- package/dist/{chunk-EWABZ72N.js → chunk-XMAA2HYI.js} +5 -0
- package/dist/{chunk-C2C4AVGL.js → chunk-YROOHMJG.js} +1 -1
- package/dist/{chunk-JAVKDXRY.js → chunk-ZFI3N2ID.js} +4 -4
- package/dist/component-runtime/importPolicy.js +1 -1
- package/dist/component-runtime/render.js +2 -2
- package/dist/component-runtime.js +9 -3
- package/dist/compose.js +13 -13
- package/dist/composition/graphics-plan.js +3 -3
- package/dist/composition/projection.js +8 -8
- package/dist/composition.js +8 -8
- package/dist/mcp/server.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/primitives/effects.js +3 -3
- package/dist/primitives/layouts.js +2 -2
- package/dist/primitives/lib/index.js +2 -2
- package/dist/primitives/lib/tokens.js +2 -2
- package/dist/primitives/lib.js +2 -2
- package/dist/primitives/scenes.js +2 -2
- package/dist/primitives/ui-blocks.js +4 -4
- package/dist/primitives.js +11 -11
- package/dist/render-harness.js +7 -7
- package/package.json +15 -12
- package/dist/{chunk-B3GSTQLR.js → chunk-VLJOIUHL.js} +6 -6
|
@@ -462,9 +462,11 @@ var MoveAlongPath = ({
|
|
|
462
462
|
const pathLength = getLength(path);
|
|
463
463
|
const distance = progress2 * pathLength;
|
|
464
464
|
const point = getPointAtLength(path, distance);
|
|
465
|
+
if (!point) throw new Error(`MoveAlongPath could not resolve a point on path: ${path}`);
|
|
465
466
|
let rotation = 0;
|
|
466
467
|
if (rotate) {
|
|
467
468
|
const tangent = getTangentAtLength(path, distance);
|
|
469
|
+
if (!tangent) throw new Error(`MoveAlongPath could not resolve a tangent on path: ${path}`);
|
|
468
470
|
rotation = Math.atan2(tangent.y - point.y, tangent.x - point.x) * (180 / Math.PI);
|
|
469
471
|
}
|
|
470
472
|
return /* @__PURE__ */ React12.createElement(
|
|
@@ -1058,8 +1060,138 @@ var ThreeCanvas = ({
|
|
|
1058
1060
|
);
|
|
1059
1061
|
};
|
|
1060
1062
|
|
|
1063
|
+
// ../execution/animate/src/three/FrameDepthOfField.tsx
|
|
1064
|
+
import { useLayoutEffect as useLayoutEffect3, useRef } from "react";
|
|
1065
|
+
import { useFrame, useThree as useThree3 } from "@react-three/fiber";
|
|
1066
|
+
|
|
1067
|
+
// ../execution/animate/src/three/depthOfFieldPipeline.ts
|
|
1068
|
+
import {
|
|
1069
|
+
DepthOfFieldEffect,
|
|
1070
|
+
EffectComposer,
|
|
1071
|
+
EffectPass,
|
|
1072
|
+
RenderPass,
|
|
1073
|
+
ToneMappingEffect,
|
|
1074
|
+
ToneMappingMode
|
|
1075
|
+
} from "postprocessing";
|
|
1076
|
+
import {
|
|
1077
|
+
ACESFilmicToneMapping,
|
|
1078
|
+
HalfFloatType,
|
|
1079
|
+
NoToneMapping,
|
|
1080
|
+
Vector4
|
|
1081
|
+
} from "three";
|
|
1082
|
+
var canvasOwners = /* @__PURE__ */ new WeakSet();
|
|
1083
|
+
function validateFrameFocus(props) {
|
|
1084
|
+
const { focusDistance, focusRange, bokehScale = 2, resolutionScale = 0.5 } = props;
|
|
1085
|
+
if (!Number.isFinite(focusDistance) || focusDistance <= 0 || !Number.isFinite(focusRange) || focusRange <= 0 || !Number.isFinite(bokehScale) || bokehScale < 0 || !Number.isFinite(resolutionScale) || resolutionScale <= 0 || resolutionScale > 1) {
|
|
1086
|
+
throw new Error("FrameDepthOfField: expected positive focusDistance/focusRange, nonnegative bokehScale and resolutionScale in (0, 1].");
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
var FrameFocusPipeline = class {
|
|
1090
|
+
constructor(gl, scene, camera, resolutionScale) {
|
|
1091
|
+
this.gl = gl;
|
|
1092
|
+
this.camera = camera;
|
|
1093
|
+
if (!gl.isWebGLRenderer || !camera.isPerspectiveCamera) {
|
|
1094
|
+
throw new Error("FrameDepthOfField requires a WebGLRenderer and a perspective camera.");
|
|
1095
|
+
}
|
|
1096
|
+
if (gl.toneMapping !== NoToneMapping && gl.toneMapping !== ACESFilmicToneMapping) {
|
|
1097
|
+
throw new Error("FrameDepthOfField supports NoToneMapping or ACESFilmicToneMapping.");
|
|
1098
|
+
}
|
|
1099
|
+
if (canvasOwners.has(gl)) throw new Error("Only one FrameDepthOfField may own a canvas.");
|
|
1100
|
+
this.toneMapping = gl.toneMapping;
|
|
1101
|
+
const autoClear = gl.autoClear;
|
|
1102
|
+
this.composer = new EffectComposer(gl, { frameBufferType: HalfFloatType, multisampling: 0 });
|
|
1103
|
+
gl.autoClear = autoClear;
|
|
1104
|
+
this.focus = new DepthOfFieldEffect(camera, { resolutionScale, bokehScale: 2 });
|
|
1105
|
+
const tone = gl.toneMapping === ACESFilmicToneMapping ? [new ToneMappingEffect({ mode: ToneMappingMode.ACES_FILMIC })] : [];
|
|
1106
|
+
this.effectPass = new EffectPass(camera, this.focus, ...tone);
|
|
1107
|
+
this.composer.addPass(new RenderPass(scene, camera));
|
|
1108
|
+
this.composer.addPass(this.effectPass);
|
|
1109
|
+
canvasOwners.add(gl);
|
|
1110
|
+
}
|
|
1111
|
+
gl;
|
|
1112
|
+
camera;
|
|
1113
|
+
composer;
|
|
1114
|
+
focus;
|
|
1115
|
+
effectPass;
|
|
1116
|
+
viewport = new Vector4();
|
|
1117
|
+
scissor = new Vector4();
|
|
1118
|
+
disposed = false;
|
|
1119
|
+
toneMapping;
|
|
1120
|
+
resize(width, height) {
|
|
1121
|
+
this.composer.setSize(width, height, false);
|
|
1122
|
+
}
|
|
1123
|
+
draw(props) {
|
|
1124
|
+
validateFrameFocus(props);
|
|
1125
|
+
if (this.disposed) throw new Error("FrameDepthOfField pipeline was disposed.");
|
|
1126
|
+
const { gl, focus, camera } = this;
|
|
1127
|
+
if (gl.toneMapping !== this.toneMapping) {
|
|
1128
|
+
throw new Error("FrameDepthOfField: renderer tone mapping changed; remount the helper.");
|
|
1129
|
+
}
|
|
1130
|
+
this.effectPass.mainCamera = camera;
|
|
1131
|
+
focus.cocMaterial.focusDistance = props.focusDistance;
|
|
1132
|
+
focus.cocMaterial.focusRange = props.focusRange;
|
|
1133
|
+
focus.bokehScale = props.bokehScale ?? 2;
|
|
1134
|
+
const target = gl.getRenderTarget();
|
|
1135
|
+
if (target !== null) throw new Error("FrameDepthOfField must own the canvas output, not a nested render target.");
|
|
1136
|
+
const autoClear = gl.autoClear;
|
|
1137
|
+
const toneMapping = gl.toneMapping;
|
|
1138
|
+
const scissorTest = gl.getScissorTest();
|
|
1139
|
+
gl.getViewport(this.viewport);
|
|
1140
|
+
gl.getScissor(this.scissor);
|
|
1141
|
+
try {
|
|
1142
|
+
gl.autoClear = false;
|
|
1143
|
+
gl.toneMapping = NoToneMapping;
|
|
1144
|
+
gl.setScissorTest(false);
|
|
1145
|
+
this.composer.render(0);
|
|
1146
|
+
} finally {
|
|
1147
|
+
gl.setRenderTarget(target);
|
|
1148
|
+
gl.setViewport(this.viewport);
|
|
1149
|
+
gl.setScissor(this.scissor);
|
|
1150
|
+
gl.setScissorTest(scissorTest);
|
|
1151
|
+
gl.autoClear = autoClear;
|
|
1152
|
+
gl.toneMapping = toneMapping;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
dispose() {
|
|
1156
|
+
if (this.disposed) return;
|
|
1157
|
+
this.disposed = true;
|
|
1158
|
+
try {
|
|
1159
|
+
this.composer.dispose();
|
|
1160
|
+
} finally {
|
|
1161
|
+
canvasOwners.delete(this.gl);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
// ../execution/animate/src/three/FrameDepthOfField.tsx
|
|
1167
|
+
function FrameDepthOfField(props) {
|
|
1168
|
+
validateFrameFocus(props);
|
|
1169
|
+
const gl = useThree3((state) => state.gl);
|
|
1170
|
+
const scene = useThree3((state) => state.scene);
|
|
1171
|
+
const camera = useThree3((state) => state.camera);
|
|
1172
|
+
const size = useThree3((state) => state.size);
|
|
1173
|
+
const dpr = useThree3((state) => state.viewport.dpr);
|
|
1174
|
+
const pipeline = useRef(null);
|
|
1175
|
+
const resolutionScale = props.resolutionScale ?? 0.5;
|
|
1176
|
+
useLayoutEffect3(() => {
|
|
1177
|
+
const owned = new FrameFocusPipeline(gl, scene, camera, resolutionScale);
|
|
1178
|
+
pipeline.current = owned;
|
|
1179
|
+
return () => {
|
|
1180
|
+
pipeline.current = null;
|
|
1181
|
+
owned.dispose();
|
|
1182
|
+
};
|
|
1183
|
+
}, [gl, scene, camera, resolutionScale]);
|
|
1184
|
+
useLayoutEffect3(() => {
|
|
1185
|
+
pipeline.current?.resize(size.width, size.height);
|
|
1186
|
+
}, [gl, scene, camera, resolutionScale, size.width, size.height, dpr]);
|
|
1187
|
+
useFrame(() => {
|
|
1188
|
+
pipeline.current?.draw(props);
|
|
1189
|
+
}, 1);
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1061
1193
|
// ../execution/animate/src/three/useImageTexture.ts
|
|
1062
|
-
import { useLayoutEffect as
|
|
1194
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef2, useState } from "react";
|
|
1063
1195
|
import { cancelRender, continueRender, delayRender } from "remotion";
|
|
1064
1196
|
import { SRGBColorSpace, TextureLoader } from "three";
|
|
1065
1197
|
|
|
@@ -1080,10 +1212,10 @@ function discardStaleTexture(texture) {
|
|
|
1080
1212
|
// ../execution/animate/src/three/useImageTexture.ts
|
|
1081
1213
|
function useImageTexture(src) {
|
|
1082
1214
|
const [texture, setTexture] = useState(null);
|
|
1083
|
-
const held =
|
|
1215
|
+
const held = useRef2(NO_TEXTURE);
|
|
1084
1216
|
const [firstHandle] = useState(() => src ? delayRender(`three: load texture ${src}`) : null);
|
|
1085
|
-
const firstHandleSpent =
|
|
1086
|
-
|
|
1217
|
+
const firstHandleSpent = useRef2(false);
|
|
1218
|
+
useLayoutEffect4(() => {
|
|
1087
1219
|
const takeHandle = () => {
|
|
1088
1220
|
if (firstHandle !== null && !firstHandleSpent.current) {
|
|
1089
1221
|
firstHandleSpent.current = true;
|
|
@@ -1126,10 +1258,10 @@ function useImageTexture(src) {
|
|
|
1126
1258
|
continueRender(handle);
|
|
1127
1259
|
};
|
|
1128
1260
|
}, [src, firstHandle]);
|
|
1129
|
-
|
|
1261
|
+
useLayoutEffect4(() => {
|
|
1130
1262
|
held.current = commitImageTexture(held.current, texture);
|
|
1131
1263
|
}, [texture]);
|
|
1132
|
-
|
|
1264
|
+
useLayoutEffect4(() => () => {
|
|
1133
1265
|
held.current = releaseImageTexture(held.current);
|
|
1134
1266
|
}, []);
|
|
1135
1267
|
return texture;
|
|
@@ -1617,8 +1749,8 @@ var ContactShadow = ({ y, width, depth, opacity = 0.45, z = 0 }) => {
|
|
|
1617
1749
|
};
|
|
1618
1750
|
|
|
1619
1751
|
// ../execution/animate/src/media/MediaTileScene.tsx
|
|
1620
|
-
import React21, { useCallback, useLayoutEffect as
|
|
1621
|
-
import { useThree as
|
|
1752
|
+
import React21, { useCallback, useLayoutEffect as useLayoutEffect5, useMemo as useMemo4, useRef as useRef3, useState as useState2 } from "react";
|
|
1753
|
+
import { useThree as useThree4 } from "@react-three/fiber";
|
|
1622
1754
|
import { Video } from "@remotion/media";
|
|
1623
1755
|
import { ThreeCanvas as ThreeCanvas2 } from "@remotion/three";
|
|
1624
1756
|
import { BufferAttribute, BufferGeometry, Color, SRGBColorSpace as SRGBColorSpace3, Texture as Texture2, WebGLRenderer } from "three";
|
|
@@ -1735,9 +1867,9 @@ function ImageProducer({ id, stream: stream2, accept, report }) {
|
|
|
1735
1867
|
);
|
|
1736
1868
|
}
|
|
1737
1869
|
function VideoProducer({ id, stream: stream2, accept, report }) {
|
|
1738
|
-
const container =
|
|
1739
|
-
const version =
|
|
1740
|
-
const acceptedFrame =
|
|
1870
|
+
const container = useRef3(null);
|
|
1871
|
+
const version = useRef3(0);
|
|
1872
|
+
const acceptedFrame = useRef3(null);
|
|
1741
1873
|
const frame = useCurrentFrame15();
|
|
1742
1874
|
const handleVideoError = useCallback((error) => {
|
|
1743
1875
|
report(error);
|
|
@@ -1794,7 +1926,7 @@ function geometryForCrop(crop) {
|
|
|
1794
1926
|
return geometry;
|
|
1795
1927
|
}
|
|
1796
1928
|
function StreamTiles({ entry, tiles }) {
|
|
1797
|
-
const invalidate =
|
|
1929
|
+
const invalidate = useThree4((state) => state.invalidate);
|
|
1798
1930
|
const texture = useMemo4(() => {
|
|
1799
1931
|
const value = new Texture2(entry.source);
|
|
1800
1932
|
value.colorSpace = SRGBColorSpace3;
|
|
@@ -1810,11 +1942,11 @@ function StreamTiles({ entry, tiles }) {
|
|
|
1810
1942
|
}
|
|
1811
1943
|
return values;
|
|
1812
1944
|
}, [tiles]);
|
|
1813
|
-
|
|
1945
|
+
useLayoutEffect5(() => {
|
|
1814
1946
|
texture.needsUpdate = true;
|
|
1815
1947
|
invalidate();
|
|
1816
1948
|
}, [entry.version, invalidate, texture]);
|
|
1817
|
-
|
|
1949
|
+
useLayoutEffect5(() => () => {
|
|
1818
1950
|
texture.dispose();
|
|
1819
1951
|
for (const geometry of geometries.values()) geometry.dispose();
|
|
1820
1952
|
}, [geometries, texture]);
|
|
@@ -1836,12 +1968,12 @@ function StreamTiles({ entry, tiles }) {
|
|
|
1836
1968
|
}));
|
|
1837
1969
|
}
|
|
1838
1970
|
function SceneContents({ streamIds, tiles, sources, camera, fog, background, announce, presentationReady, playing }) {
|
|
1839
|
-
const { advance, camera: threeCamera, gl, invalidate } =
|
|
1971
|
+
const { advance, camera: threeCamera, gl, invalidate } = useThree4();
|
|
1840
1972
|
const frame = useCurrentFrame15();
|
|
1841
1973
|
const isRendering = getRemotionEnvironment().isRendering;
|
|
1842
1974
|
const perspective = camera?.perspective ?? 1400;
|
|
1843
1975
|
const { height } = useVideoConfig4();
|
|
1844
|
-
|
|
1976
|
+
useLayoutEffect5(() => {
|
|
1845
1977
|
threeCamera.position.set(camera?.x ?? 0, -(camera?.y ?? 0), perspective - (camera?.z ?? 0));
|
|
1846
1978
|
threeCamera.zoom = camera?.zoom ?? 1;
|
|
1847
1979
|
if ("fov" in threeCamera) threeCamera.fov = 2 * Math.atan(height / (2 * perspective)) * 180 / Math.PI;
|
|
@@ -1855,7 +1987,7 @@ function SceneContents({ streamIds, tiles, sources, camera, fog, background, ann
|
|
|
1855
1987
|
invalidate();
|
|
1856
1988
|
}, [background, camera, frame, gl, height, invalidate, perspective, threeCamera]);
|
|
1857
1989
|
const sourceVersions = streamIds.map((id) => sources[id].version).join(":");
|
|
1858
|
-
|
|
1990
|
+
useLayoutEffect5(() => {
|
|
1859
1991
|
if (isRendering || !playing) advance(performance.now());
|
|
1860
1992
|
else invalidate();
|
|
1861
1993
|
if (presentationReady) announce();
|
|
@@ -1884,9 +2016,9 @@ function MediaTileScene({ streams, tiles, camera, fog, background, style }) {
|
|
|
1884
2016
|
const [sources, setSources] = useState2({});
|
|
1885
2017
|
const [failure, setFailure] = useState2(null);
|
|
1886
2018
|
const [sceneId] = useState2(() => `cueframe-media-tile-${++nextMediaTileSceneId}`);
|
|
1887
|
-
const announcedFrame =
|
|
1888
|
-
const frameGate =
|
|
1889
|
-
|
|
2019
|
+
const announcedFrame = useRef3(null);
|
|
2020
|
+
const frameGate = useRef3(null);
|
|
2021
|
+
useLayoutEffect5(() => {
|
|
1890
2022
|
if (!isRendering) return;
|
|
1891
2023
|
const gate = {
|
|
1892
2024
|
frame,
|
|
@@ -2006,7 +2138,7 @@ function scaleSceneTransform(t, scale) {
|
|
|
2006
2138
|
}
|
|
2007
2139
|
|
|
2008
2140
|
// ../execution/animate/src/scene/v2/builders.tsx
|
|
2009
|
-
import React22, { useLayoutEffect as
|
|
2141
|
+
import React22, { useLayoutEffect as useLayoutEffect9, useMemo as useMemo5, useRef as useRef6 } from "react";
|
|
2010
2142
|
import { DoubleSide as DoubleSide2, FrontSide as FrontSide2 } from "three";
|
|
2011
2143
|
|
|
2012
2144
|
// ../execution/animate/src/scene/deviceOpacity.ts
|
|
@@ -2062,13 +2194,13 @@ function textureImageSize(texture, slot, layerIndex) {
|
|
|
2062
2194
|
}
|
|
2063
2195
|
|
|
2064
2196
|
// ../execution/animate/src/scene/UnlitPlane.tsx
|
|
2065
|
-
import { useLayoutEffect as
|
|
2197
|
+
import { useLayoutEffect as useLayoutEffect6 } from "react";
|
|
2066
2198
|
import { DoubleSide, FrontSide } from "three";
|
|
2067
2199
|
var UNLIT_PLANE_ALPHA_TEST = 0.01;
|
|
2068
2200
|
function UnlitPlane({ texture, fit, color = "#ffffff", transparent = true, depthWrite = true, backface = "hidden", resourceOwner, resourceName }) {
|
|
2069
2201
|
const [rx, ry] = fit.repeat;
|
|
2070
2202
|
const [ox, oy] = fit.offset;
|
|
2071
|
-
|
|
2203
|
+
useLayoutEffect6(() => {
|
|
2072
2204
|
if (texture.repeat.x !== rx || texture.repeat.y !== ry) texture.repeat.set(rx, ry);
|
|
2073
2205
|
if (texture.offset.x !== ox || texture.offset.y !== oy) texture.offset.set(ox, oy);
|
|
2074
2206
|
}, [texture, rx, ry, ox, oy]);
|
|
@@ -2087,8 +2219,8 @@ function UnlitPlane({ texture, fit, color = "#ffffff", transparent = true, depth
|
|
|
2087
2219
|
}
|
|
2088
2220
|
|
|
2089
2221
|
// ../execution/animate/src/scene/useSceneImageTexture.ts
|
|
2090
|
-
import { useLayoutEffect as
|
|
2091
|
-
import { useThree as
|
|
2222
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef4, useState as useState3 } from "react";
|
|
2223
|
+
import { useThree as useThree5 } from "@react-three/fiber";
|
|
2092
2224
|
import { cancelRender as cancelRender3, continueRender as continueRender3, delayRender as delayRender3 } from "remotion";
|
|
2093
2225
|
import { SRGBColorSpace as SRGBColorSpace4, TextureLoader as TextureLoader2 } from "three";
|
|
2094
2226
|
|
|
@@ -2146,13 +2278,13 @@ function advanceRendererOnce(advance) {
|
|
|
2146
2278
|
// ../execution/animate/src/scene/useSceneImageTexture.ts
|
|
2147
2279
|
function useSceneImageTexture(src, slot, what, resourceOwner = `surface:${slot}`) {
|
|
2148
2280
|
const registerActual = useSceneActualResourceRegistrarV1();
|
|
2149
|
-
const advance =
|
|
2281
|
+
const advance = useThree5((s) => s.advance);
|
|
2150
2282
|
const [generations] = useState3(() => new LoadGenerations());
|
|
2151
2283
|
const [firstHandle] = useState3(() => delayRender3(`scene: ${what} "${slot}"`));
|
|
2152
|
-
const firstHandleSpent =
|
|
2284
|
+
const firstHandleSpent = useRef4(false);
|
|
2153
2285
|
const [committed, setCommitted] = useState3(null);
|
|
2154
|
-
const state =
|
|
2155
|
-
|
|
2286
|
+
const state = useRef4(EMPTY_TEXTURE_STATE);
|
|
2287
|
+
useLayoutEffect7(() => {
|
|
2156
2288
|
const token = generations.begin();
|
|
2157
2289
|
let handle;
|
|
2158
2290
|
if (!firstHandleSpent.current) {
|
|
@@ -2195,19 +2327,19 @@ function useSceneImageTexture(src, slot, what, resourceOwner = `surface:${slot}`
|
|
|
2195
2327
|
continueRender3(handle);
|
|
2196
2328
|
};
|
|
2197
2329
|
}, [src, slot, what, resourceOwner, generations, firstHandle, registerActual]);
|
|
2198
|
-
|
|
2330
|
+
useLayoutEffect7(() => {
|
|
2199
2331
|
if (!committed) return;
|
|
2200
2332
|
state.current = onTextureCommitted(state.current, committed, { continueRender: continueRender3, redraw: () => advanceRendererOnce(advance) });
|
|
2201
2333
|
}, [committed, advance]);
|
|
2202
|
-
|
|
2334
|
+
useLayoutEffect7(() => () => {
|
|
2203
2335
|
state.current = onTextureOwnerUnmounted(generations, state.current);
|
|
2204
2336
|
}, [generations]);
|
|
2205
2337
|
return committed?.texture ?? null;
|
|
2206
2338
|
}
|
|
2207
2339
|
|
|
2208
2340
|
// ../execution/animate/src/scene/useWorldTextTexture.ts
|
|
2209
|
-
import { useLayoutEffect as
|
|
2210
|
-
import { useThree as
|
|
2341
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef5, useState as useState4 } from "react";
|
|
2342
|
+
import { useThree as useThree6 } from "@react-three/fiber";
|
|
2211
2343
|
import { cancelRender as cancelRender4, continueRender as continueRender4, delayRender as delayRender4 } from "remotion";
|
|
2212
2344
|
|
|
2213
2345
|
// ../execution/animate/src/scene/fontReadiness.ts
|
|
@@ -2462,18 +2594,18 @@ function createWorldTextTexture(request, registerActual = registerActualSceneRes
|
|
|
2462
2594
|
function useWorldTextTexture(prepared) {
|
|
2463
2595
|
const registerActual = useSceneActualResourceRegistrarV1();
|
|
2464
2596
|
const { layer, index, layout, size, key } = prepared;
|
|
2465
|
-
const advance =
|
|
2466
|
-
const gl =
|
|
2597
|
+
const advance = useThree6((s) => s.advance);
|
|
2598
|
+
const gl = useThree6((s) => s.gl);
|
|
2467
2599
|
const [generations] = useState4(() => new LoadGenerations());
|
|
2468
2600
|
const [firstHandle] = useState4(() => delayRender4(`scene: world text "${layer.id}"`));
|
|
2469
|
-
const firstHandleSpent =
|
|
2601
|
+
const firstHandleSpent = useRef5(false);
|
|
2470
2602
|
const [committed, setCommitted] = useState4(null);
|
|
2471
|
-
const held =
|
|
2472
|
-
const request =
|
|
2473
|
-
|
|
2603
|
+
const held = useRef5(null);
|
|
2604
|
+
const request = useRef5({ layer, layout, size, index });
|
|
2605
|
+
useLayoutEffect8(() => {
|
|
2474
2606
|
request.current = { layer, layout, size, index };
|
|
2475
2607
|
});
|
|
2476
|
-
|
|
2608
|
+
useLayoutEffect8(() => {
|
|
2477
2609
|
const token = generations.begin();
|
|
2478
2610
|
let handle;
|
|
2479
2611
|
if (!firstHandleSpent.current) {
|
|
@@ -2504,11 +2636,11 @@ function useWorldTextTexture(prepared) {
|
|
|
2504
2636
|
continueRender4(handle);
|
|
2505
2637
|
};
|
|
2506
2638
|
}, [key, gl, generations, firstHandle, registerActual]);
|
|
2507
|
-
|
|
2639
|
+
useLayoutEffect8(() => {
|
|
2508
2640
|
if (!committed) return;
|
|
2509
2641
|
held.current = onRasterCommitted(worldTextRasterCache, held.current, committed, { continueRender: continueRender4, redraw: () => advanceRendererOnce(advance) });
|
|
2510
2642
|
}, [committed, advance]);
|
|
2511
|
-
|
|
2643
|
+
useLayoutEffect8(() => () => {
|
|
2512
2644
|
held.current = onRasterOwnerUnmounted(generations, worldTextRasterCache, held.current);
|
|
2513
2645
|
}, [generations]);
|
|
2514
2646
|
return committed?.raster ?? null;
|
|
@@ -2526,7 +2658,7 @@ function LoadedSceneSurface({ src, slot, what, resourceOwner, children }) {
|
|
|
2526
2658
|
var sceneDeviceResourceOwnerV1 = (node) => `${node.kind}:${node.id}`;
|
|
2527
2659
|
var slabContentFit = (width, height, image) => planeFit("contain", { width, height }, image);
|
|
2528
2660
|
function PosedObject({ transform, scale, opacity, children }) {
|
|
2529
|
-
const group =
|
|
2661
|
+
const group = useRef6(null);
|
|
2530
2662
|
const pose = useMemo5(() => sceneLayerPose(scaleSceneTransform(transform, scale)), [
|
|
2531
2663
|
transform.position[0],
|
|
2532
2664
|
transform.position[1],
|
|
@@ -2537,7 +2669,7 @@ function PosedObject({ transform, scale, opacity, children }) {
|
|
|
2537
2669
|
transform.scale,
|
|
2538
2670
|
scale
|
|
2539
2671
|
]);
|
|
2540
|
-
|
|
2672
|
+
useLayoutEffect9(() => {
|
|
2541
2673
|
if (group.current) applyLayerOpacity(group.current, opacity);
|
|
2542
2674
|
}, [opacity]);
|
|
2543
2675
|
return /* @__PURE__ */ React22.createElement("group", { ref: group, visible: opacity > 0, position: pose.position, quaternion: pose.quaternion, scale: pose.scale }, children);
|
|
@@ -2662,11 +2794,11 @@ function useOwnedSlabResources(width, height, thickness, cornerRadius, edgeRadiu
|
|
|
2662
2794
|
{ owner, name: "body-geometry", domain: "gl", bytes: geometryBytes },
|
|
2663
2795
|
{ owner, name: "body-geometry-arrays", domain: "cpu", bytes: geometryBytes }
|
|
2664
2796
|
]), [geometry, geometryBytes, owner, registerActual]);
|
|
2665
|
-
|
|
2797
|
+
useLayoutEffect9(() => () => {
|
|
2666
2798
|
geometry.dispose();
|
|
2667
2799
|
geometryMeasurement();
|
|
2668
2800
|
}, [geometry, geometryMeasurement]);
|
|
2669
|
-
|
|
2801
|
+
useLayoutEffect9(() => () => finish.dispose(), [finish]);
|
|
2670
2802
|
return { geometry, finish };
|
|
2671
2803
|
}
|
|
2672
2804
|
function PageObject({ node, src, contentColor, preparedSurface, scale, surfaceResourceOwner, mountEarly = false }) {
|
|
@@ -2800,9 +2932,9 @@ function assertSceneSurfaceResolution(spec2, output) {
|
|
|
2800
2932
|
}
|
|
2801
2933
|
|
|
2802
2934
|
// ../execution/animate/src/scene/v2/videoBinding.tsx
|
|
2803
|
-
import React23, { useCallback as useCallback2, useLayoutEffect as
|
|
2935
|
+
import React23, { useCallback as useCallback2, useLayoutEffect as useLayoutEffect10, useRef as useRef7, useState as useState5 } from "react";
|
|
2804
2936
|
import { flushSync } from "react-dom";
|
|
2805
|
-
import { useThree as
|
|
2937
|
+
import { useThree as useThree7 } from "@react-three/fiber";
|
|
2806
2938
|
import { Video as Video2 } from "@remotion/media";
|
|
2807
2939
|
import { Sequence, cancelRender as cancelRender5, continueRender as continueRender5, delayRender as delayRender5, useCurrentFrame as useCurrentFrame16 } from "remotion";
|
|
2808
2940
|
import { CanvasTexture as CanvasTexture3, LinearFilter as LinearFilter2, LinearMipmapLinearFilter as LinearMipmapLinearFilter2, SRGBColorSpace as SRGBColorSpace6 } from "three";
|
|
@@ -2827,19 +2959,19 @@ function SceneVideoBindingV1({ src, schedule, contentFrame, width, height, resou
|
|
|
2827
2959
|
const registerActual = useSceneActualResourceRegistrarV1();
|
|
2828
2960
|
const compositionFrame = useCurrentFrame16();
|
|
2829
2961
|
const address = sceneVideoMidpointAddressV1(contentFrame, schedule);
|
|
2830
|
-
const expected =
|
|
2831
|
-
const alive =
|
|
2832
|
-
const canvas =
|
|
2833
|
-
const texture =
|
|
2834
|
-
const releaseTextureMeasurement =
|
|
2835
|
-
const accepted =
|
|
2836
|
-
const revision =
|
|
2837
|
-
const drawReceipt =
|
|
2838
|
-
const readinessHandle =
|
|
2962
|
+
const expected = useRef7("");
|
|
2963
|
+
const alive = useRef7(true);
|
|
2964
|
+
const canvas = useRef7(null);
|
|
2965
|
+
const texture = useRef7(null);
|
|
2966
|
+
const releaseTextureMeasurement = useRef7(null);
|
|
2967
|
+
const accepted = useRef7(null);
|
|
2968
|
+
const revision = useRef7(0);
|
|
2969
|
+
const drawReceipt = useRef7({ request: null, revision: null });
|
|
2970
|
+
const readinessHandle = useRef7(null);
|
|
2839
2971
|
const [binding, setBinding] = useState5(null);
|
|
2840
2972
|
const request = `${contentFrame}:${address.sourceIndex}:${address.mediaFrame}`;
|
|
2841
2973
|
expected.current = request;
|
|
2842
|
-
|
|
2974
|
+
useLayoutEffect10(() => {
|
|
2843
2975
|
alive.current = true;
|
|
2844
2976
|
return () => {
|
|
2845
2977
|
alive.current = false;
|
|
@@ -2914,8 +3046,8 @@ function SceneVideoBindingV1({ src, schedule, contentFrame, width, height, resou
|
|
|
2914
3046
|
)));
|
|
2915
3047
|
}
|
|
2916
3048
|
function SceneVideoTextureCommitV1({ binding }) {
|
|
2917
|
-
const { advance, scene } =
|
|
2918
|
-
|
|
3049
|
+
const { advance, scene } = useThree7((state) => ({ advance: state.advance, scene: state.scene }));
|
|
3050
|
+
useLayoutEffect10(() => {
|
|
2919
3051
|
if (!sceneHasVideoTextureV1(scene, binding.texture)) throw new Error(`${VIDEO_ERROR} matching texture was not attached to a material before readiness.`);
|
|
2920
3052
|
binding.texture.needsUpdate = true;
|
|
2921
3053
|
advance(performance.now());
|
|
@@ -2927,8 +3059,8 @@ function SceneVideoTextureCommitV1({ binding }) {
|
|
|
2927
3059
|
}
|
|
2928
3060
|
|
|
2929
3061
|
// ../execution/animate/src/scene/v2/SceneShotV2.tsx
|
|
2930
|
-
import React26, { useLayoutEffect as
|
|
2931
|
-
import { useThree as
|
|
3062
|
+
import React26, { useLayoutEffect as useLayoutEffect12 } from "react";
|
|
3063
|
+
import { useThree as useThree9 } from "@react-three/fiber";
|
|
2932
3064
|
import { getRemotionEnvironment as getRemotionEnvironment2, Internals as Internals3 } from "remotion";
|
|
2933
3065
|
|
|
2934
3066
|
// ../execution/animate/src/scene/assets.ts
|
|
@@ -3136,8 +3268,8 @@ function sceneFinishingUniforms(post, seed, frame, size, scale) {
|
|
|
3136
3268
|
}
|
|
3137
3269
|
|
|
3138
3270
|
// ../execution/animate/src/scene/FocusPass.tsx
|
|
3139
|
-
import { useLayoutEffect as
|
|
3140
|
-
import { useFrame, useThree as
|
|
3271
|
+
import { useLayoutEffect as useLayoutEffect11, useState as useState6 } from "react";
|
|
3272
|
+
import { useFrame as useFrame2, useThree as useThree8 } from "@react-three/fiber";
|
|
3141
3273
|
|
|
3142
3274
|
// ../execution/animate/src/scene/focusBlur.ts
|
|
3143
3275
|
var FOCUS_TAPS = 8;
|
|
@@ -3161,7 +3293,7 @@ import {
|
|
|
3161
3293
|
DepthFormat,
|
|
3162
3294
|
DepthTexture,
|
|
3163
3295
|
FloatType,
|
|
3164
|
-
HalfFloatType,
|
|
3296
|
+
HalfFloatType as HalfFloatType2,
|
|
3165
3297
|
LinearFilter as LinearFilter3,
|
|
3166
3298
|
NearestFilter,
|
|
3167
3299
|
NoBlending,
|
|
@@ -3173,7 +3305,7 @@ import {
|
|
|
3173
3305
|
UnsignedIntType,
|
|
3174
3306
|
Mesh,
|
|
3175
3307
|
Vector2,
|
|
3176
|
-
Vector4,
|
|
3308
|
+
Vector4 as Vector42,
|
|
3177
3309
|
WebGLRenderTarget
|
|
3178
3310
|
} from "three";
|
|
3179
3311
|
|
|
@@ -3412,8 +3544,8 @@ function finishingUniformValues(lattice) {
|
|
|
3412
3544
|
uVignette: { value: 0 },
|
|
3413
3545
|
uFrameSize: { value: new Vector2(1, 1) },
|
|
3414
3546
|
uGrainBase: { value: new Vector2(0, 0) },
|
|
3415
|
-
uGrainStitch: { value: new
|
|
3416
|
-
uVignetteCore: { value: new
|
|
3547
|
+
uGrainStitch: { value: new Vector42(1, 1, 1, 1) },
|
|
3548
|
+
uVignetteCore: { value: new Vector42(0, 0, 1, 1) },
|
|
3417
3549
|
uVignetteSigma: { value: new Vector2(1, 1) },
|
|
3418
3550
|
tGrainLattice: { value: lattice }
|
|
3419
3551
|
};
|
|
@@ -3460,7 +3592,7 @@ var FocusResources = class {
|
|
|
3460
3592
|
depthTexture.magFilter = NearestFilter;
|
|
3461
3593
|
this.world = new WebGLRenderTarget(width, height, {
|
|
3462
3594
|
format: RGBAFormat,
|
|
3463
|
-
type:
|
|
3595
|
+
type: HalfFloatType2,
|
|
3464
3596
|
minFilter: LinearFilter3,
|
|
3465
3597
|
magFilter: LinearFilter3,
|
|
3466
3598
|
wrapS: ClampToEdgeWrapping,
|
|
@@ -3472,7 +3604,7 @@ var FocusResources = class {
|
|
|
3472
3604
|
});
|
|
3473
3605
|
this.gathered = new WebGLRenderTarget(width, height, {
|
|
3474
3606
|
format: RGBAFormat,
|
|
3475
|
-
type:
|
|
3607
|
+
type: HalfFloatType2,
|
|
3476
3608
|
minFilter: LinearFilter3,
|
|
3477
3609
|
magFilter: LinearFilter3,
|
|
3478
3610
|
wrapS: ClampToEdgeWrapping,
|
|
@@ -3683,17 +3815,17 @@ function assertPassRenderer(resources, gl) {
|
|
|
3683
3815
|
}
|
|
3684
3816
|
function FocusPass({ focus, finishing, scale, frame }) {
|
|
3685
3817
|
const registerActual = useSceneActualResourceRegistrarV1();
|
|
3686
|
-
const gl =
|
|
3687
|
-
const scene =
|
|
3688
|
-
const camera =
|
|
3818
|
+
const gl = useThree8((s) => s.gl);
|
|
3819
|
+
const scene = useThree8((s) => s.scene);
|
|
3820
|
+
const camera = useThree8((s) => s.camera);
|
|
3689
3821
|
const [resources] = useState6(() => new FocusResources(gl, frame.width, frame.height, registerActual));
|
|
3690
|
-
|
|
3822
|
+
useLayoutEffect11(() => {
|
|
3691
3823
|
resources.resize(frame.width, frame.height);
|
|
3692
3824
|
}, [resources, frame.width, frame.height]);
|
|
3693
|
-
|
|
3825
|
+
useLayoutEffect11(() => () => resources.dispose(), [resources]);
|
|
3694
3826
|
assertPassRenderer(resources, gl);
|
|
3695
3827
|
const planes = focusCameraPlanes(camera);
|
|
3696
|
-
|
|
3828
|
+
useFrame2(() => {
|
|
3697
3829
|
renderFocusPass(gl, scene, camera, resources, focusUniforms(focus, scale, planes, frame), finishing);
|
|
3698
3830
|
}, FOCUS_PASS_PRIORITY);
|
|
3699
3831
|
return null;
|
|
@@ -3765,10 +3897,10 @@ function drawSceneFrameV2({ advance, invalidate, isRendering, playing, now }) {
|
|
|
3765
3897
|
else invalidate();
|
|
3766
3898
|
}
|
|
3767
3899
|
function SceneFrameCommitV2({ frame, children }) {
|
|
3768
|
-
const { advance, invalidate } =
|
|
3900
|
+
const { advance, invalidate } = useThree9((state) => ({ advance: state.advance, invalidate: state.invalidate }));
|
|
3769
3901
|
const [playing] = Internals3.Timeline.usePlayingState();
|
|
3770
3902
|
const isRendering = getRemotionEnvironment2().isRendering;
|
|
3771
|
-
|
|
3903
|
+
useLayoutEffect12(() => {
|
|
3772
3904
|
drawSceneFrameV2({ advance, invalidate, isRendering, playing, now: performance.now() });
|
|
3773
3905
|
}, [advance, frame, invalidate, isRendering, playing]);
|
|
3774
3906
|
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, children);
|
|
@@ -4278,6 +4410,7 @@ var sandboxScope = {
|
|
|
4278
4410
|
Graph,
|
|
4279
4411
|
DiGraph,
|
|
4280
4412
|
ThreeCanvas,
|
|
4413
|
+
FrameDepthOfField,
|
|
4281
4414
|
StageCameraRig,
|
|
4282
4415
|
useImageTexture,
|
|
4283
4416
|
StudioRig,
|
|
@@ -4360,6 +4493,7 @@ export {
|
|
|
4360
4493
|
sceneCameraPoseFromV1,
|
|
4361
4494
|
StageCameraRig,
|
|
4362
4495
|
ThreeCanvas,
|
|
4496
|
+
FrameDepthOfField,
|
|
4363
4497
|
useImageTexture,
|
|
4364
4498
|
defaultScreenLayout,
|
|
4365
4499
|
makeDefaultScreenTexture,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
apcaLcFromLuminance,
|
|
3
2
|
clampToFloor,
|
|
3
|
+
contrastRatioFromLuminance,
|
|
4
4
|
deriveContrastSafe,
|
|
5
5
|
relativeLuminance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ILO4NEZ3.js";
|
|
7
7
|
import {
|
|
8
8
|
FLOORS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VG2ND6PX.js";
|
|
10
10
|
import {
|
|
11
11
|
captionFontSource,
|
|
12
12
|
effectiveCaptionFamily
|
|
@@ -360,9 +360,9 @@ function unionExclusionsForAspect(aspect) {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
// ../composition/src/projection/composition-floor.ts
|
|
363
|
-
var FLOOR_VERSION = "floor-
|
|
363
|
+
var FLOOR_VERSION = "floor-v8-2026.09.14";
|
|
364
364
|
var FACE_PADDING = { top: 0.6, bottom: 0.3, side: 0.25 };
|
|
365
|
-
var
|
|
365
|
+
var CAPTION_CONTRAST_FLOOR = 4.5;
|
|
366
366
|
var MIN_ZOOM = 0.4;
|
|
367
367
|
var clamp01 = (v) => Math.max(0, Math.min(1, v));
|
|
368
368
|
function faceKeepOut(face, depthMode = false) {
|
|
@@ -536,11 +536,13 @@ var WHITE_POLE = "#FFFFFF";
|
|
|
536
536
|
function decideLegibility(backdrop, textColor = WHITE_POLE) {
|
|
537
537
|
const textY = relativeLuminance(textColor);
|
|
538
538
|
const worst = backdrop.tiles.reduce(
|
|
539
|
-
(m, tileY) => Math.min(m,
|
|
539
|
+
(m, tileY) => Math.min(m, contrastRatioFromLuminance(textY, tileY)),
|
|
540
540
|
Number.POSITIVE_INFINITY
|
|
541
541
|
);
|
|
542
|
-
if (worst >=
|
|
543
|
-
|
|
542
|
+
if (worst >= CAPTION_CONTRAST_FLOOR) {
|
|
543
|
+
return { contrastTarget: CAPTION_CONTRAST_FLOOR, remedy: "none" };
|
|
544
|
+
}
|
|
545
|
+
return { contrastTarget: CAPTION_CONTRAST_FLOOR, remedy: "scrim" };
|
|
544
546
|
}
|
|
545
547
|
function sampleFrames(win, k = 5) {
|
|
546
548
|
const { startFrame: start, endFrame: end } = win;
|
|
@@ -550,7 +552,7 @@ function sampleFrames(win, k = 5) {
|
|
|
550
552
|
return Array.from({ length: n }, (_, i) => Math.round(start + span * i / (n - 1)));
|
|
551
553
|
}
|
|
552
554
|
function resolveOne(el, region, input) {
|
|
553
|
-
const legibility = el.hasText ? decideLegibility(input.backdrop(region, sampleFrames(el.timeWindow)), el.textColor) : {
|
|
555
|
+
const legibility = el.hasText ? decideLegibility(input.backdrop(region, sampleFrames(el.timeWindow)), el.textColor) : { contrastTarget: CAPTION_CONTRAST_FLOOR, remedy: "none" };
|
|
554
556
|
return { id: el.id, region, legibility };
|
|
555
557
|
}
|
|
556
558
|
function resolveCompositionFloor(input) {
|
|
@@ -668,7 +670,7 @@ export {
|
|
|
668
670
|
lookupSafeZones,
|
|
669
671
|
FLOOR_VERSION,
|
|
670
672
|
FACE_PADDING,
|
|
671
|
-
|
|
673
|
+
CAPTION_CONTRAST_FLOOR,
|
|
672
674
|
MIN_ZOOM,
|
|
673
675
|
faceKeepOut,
|
|
674
676
|
boundingBox,
|