@cueframe/kernel 0.2.2 → 0.2.4
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 +8 -2
- package/dist/_members/animate/layout/FlexLayout.d.ts +69 -0
- package/dist/_members/animate/layout/fit.d.ts +44 -0
- package/dist/_members/animate/layout/index.d.ts +3 -0
- package/dist/_members/animate/layout/solveFlex.d.ts +70 -0
- package/dist/_members/animate/media/MediaTileScene.d.ts +65 -0
- package/dist/_members/animate/media/recipes.d.ts +61 -0
- package/dist/_members/animate/scene/FocusPass.d.ts +76 -0
- package/dist/_members/animate/scene/UnlitPlane.d.ts +45 -0
- package/dist/_members/animate/scene/__oracle__/cssProjection.d.ts +24 -0
- package/dist/_members/animate/scene/assets.d.ts +21 -0
- package/dist/_members/animate/scene/backdrop.d.ts +7 -0
- package/dist/_members/animate/scene/coordinates.d.ts +58 -0
- package/dist/_members/animate/scene/deviceOpacity.d.ts +18 -0
- package/dist/_members/animate/scene/errors.d.ts +14 -0
- package/dist/_members/animate/scene/finishing.d.ts +69 -0
- package/dist/_members/animate/scene/finishingMath.d.ts +60 -0
- package/dist/_members/animate/scene/finishingPass.d.ts +35 -0
- package/dist/_members/animate/scene/focusBlur.d.ts +56 -0
- package/dist/_members/animate/scene/focusResources.d.ts +190 -0
- package/dist/_members/animate/scene/focusShaders.d.ts +68 -0
- package/dist/_members/animate/scene/fontReadiness.d.ts +27 -0
- package/dist/_members/animate/scene/grainNoise.d.ts +118 -0
- package/dist/_members/animate/scene/index.d.ts +19 -0
- package/dist/_members/animate/scene/internal.d.ts +29 -0
- package/dist/_members/animate/scene/planeFit.d.ts +46 -0
- package/dist/_members/animate/scene/preparedWorldText.d.ts +25 -0
- package/dist/_members/animate/scene/rasterCache.d.ts +30 -0
- package/dist/_members/animate/scene/rasterReadiness.d.ts +33 -0
- package/dist/_members/animate/scene/readiness.d.ts +69 -0
- package/dist/_members/animate/scene/redraw.d.ts +10 -0
- package/dist/_members/animate/scene/render.d.ts +9 -0
- package/dist/_members/animate/scene/scaling.d.ts +13 -0
- package/dist/_members/animate/scene/text.d.ts +40 -0
- package/dist/_members/animate/scene/textLayout.d.ts +78 -0
- package/dist/_members/animate/scene/textureImageSize.d.ts +4 -0
- package/dist/_members/animate/scene/useSceneImageTexture.d.ts +21 -0
- package/dist/_members/animate/scene/useWorldTextTexture.d.ts +21 -0
- package/dist/_members/animate/scene/v2/MeasuredPlaneGeometry.d.ts +7 -0
- package/dist/_members/animate/scene/v2/PhotographicStudioRig.d.ts +11 -0
- package/dist/_members/animate/scene/v2/PreparedSceneShotV1.d.ts +12 -0
- package/dist/_members/animate/scene/v2/SceneShotV2.d.ts +59 -0
- package/dist/_members/animate/scene/v2/builders.d.ts +170 -0
- package/dist/_members/animate/scene/v2/finishes.d.ts +152 -0
- package/dist/_members/animate/scene/v2/lighting.d.ts +119 -0
- package/dist/_members/animate/scene/v2/observePmremTargets.d.ts +4 -0
- package/dist/_members/animate/scene/v2/preparationFacts.d.ts +32 -0
- package/dist/_members/animate/scene/v2/preparedSurface.d.ts +17 -0
- package/dist/_members/animate/scene/v2/projectedResolution.d.ts +2 -0
- package/dist/_members/animate/scene/v2/renderTargetObserver.d.ts +5 -0
- package/dist/_members/animate/scene/v2/runtimeAllocations.d.ts +55 -0
- package/dist/_members/animate/scene/v2/shadow.d.ts +23 -0
- package/dist/_members/animate/scene/v2/slabGeometry.d.ts +134 -0
- package/dist/_members/animate/scene/v2/slots.d.ts +73 -0
- package/dist/_members/animate/scene/v2/videoBinding.d.ts +39 -0
- package/dist/_members/animate/scene/worldBounds.d.ts +19 -0
- package/dist/_members/animate/scene/worldTextRaster.d.ts +87 -0
- package/dist/_members/animate/scene/worldTextTexture.d.ts +32 -0
- package/dist/_members/animate/stage/PerspectiveStage.d.ts +73 -0
- package/dist/_members/animate/stage/camera.d.ts +143 -0
- package/dist/_members/animate/stage/dof.d.ts +9 -0
- package/dist/_members/animate/stage/index.d.ts +6 -0
- package/dist/_members/animate/stage/presets.d.ts +17 -0
- package/dist/_members/animate/three/DeviceMesh.d.ts +256 -0
- package/dist/_members/animate/three/SceneCameraRig.d.ts +12 -0
- package/dist/_members/animate/three/StageCameraRig.d.ts +7 -0
- package/dist/_members/animate/three/StudioRig.d.ts +228 -0
- package/dist/_members/animate/three/ThreeCanvas.d.ts +22 -0
- package/dist/_members/animate/three/defaultScreen.d.ts +23 -0
- package/dist/_members/animate/three/index.d.ts +7 -1
- package/dist/_members/animate/three/textureLifecycle.d.ts +29 -0
- package/dist/_members/animate/three/toneMapping.d.ts +113 -0
- package/dist/_members/animate/three/useImageTexture.d.ts +17 -0
- package/dist/_members/authoring/index.d.ts +2 -0
- package/dist/_members/authoring/scene/index.d.ts +6 -0
- package/dist/_members/authoring/scene/materialize.d.ts +47 -0
- package/dist/_members/authoring/scene/validate.d.ts +80 -0
- package/dist/_members/authoring/scene/wrapper.d.ts +41 -0
- package/dist/_members/component-runtime/allowedImports.d.ts +3 -0
- package/dist/_members/component-runtime/allowedImports.d.ts.map +1 -0
- package/dist/_members/component-runtime/bake.d.ts +8 -0
- package/dist/_members/component-runtime/bake.d.ts.map +1 -1
- package/dist/_members/component-runtime/browserFirewall.d.ts +7 -1
- package/dist/_members/component-runtime/browserFirewall.d.ts.map +1 -1
- package/dist/_members/component-runtime/browserOptions.d.ts +59 -3
- package/dist/_members/component-runtime/browserOptions.d.ts.map +1 -1
- package/dist/_members/component-runtime/canonicalIdentity.d.ts +14 -0
- package/dist/_members/component-runtime/canonicalIdentity.d.ts.map +1 -1
- package/dist/_members/component-runtime/contracts.d.ts +341 -1
- package/dist/_members/component-runtime/contracts.d.ts.map +1 -1
- package/dist/_members/component-runtime/fixtures/imageTileDriftWall.d.ts +5 -0
- package/dist/_members/component-runtime/fixtures/imageTileDriftWall.d.ts.map +1 -0
- package/dist/_members/component-runtime/fixtures/mediaTileMixed.d.ts +5 -0
- package/dist/_members/component-runtime/fixtures/mediaTileMixed.d.ts.map +1 -0
- package/dist/_members/component-runtime/fixtures/mediaTileVideo.d.ts +8 -0
- package/dist/_members/component-runtime/fixtures/mediaTileVideo.d.ts.map +1 -0
- package/dist/_members/component-runtime/importPolicy.d.ts +3 -2
- package/dist/_members/component-runtime/importPolicy.d.ts.map +1 -1
- package/dist/_members/component-runtime/index.d.ts +3 -0
- package/dist/_members/component-runtime/index.d.ts.map +1 -1
- package/dist/_members/component-runtime/livePreviewProxy.d.ts +7 -0
- package/dist/_members/component-runtime/livePreviewProxy.d.ts.map +1 -0
- package/dist/_members/component-runtime/localRoot.d.ts +37 -0
- package/dist/_members/component-runtime/localRoot.d.ts.map +1 -0
- package/dist/_members/component-runtime/mediaResolution.d.ts +25 -0
- package/dist/_members/component-runtime/mediaResolution.d.ts.map +1 -0
- package/dist/_members/component-runtime/render.d.ts +151 -13
- package/dist/_members/component-runtime/render.d.ts.map +1 -1
- package/dist/_members/component-runtime/renderDiagnostics.d.ts +14 -0
- package/dist/_members/component-runtime/renderDiagnostics.d.ts.map +1 -0
- package/dist/_members/component-runtime/sceneAdmission.d.ts +47 -0
- package/dist/_members/component-runtime/sceneAdmission.d.ts.map +1 -0
- package/dist/_members/component-runtime/sourceWorkspace.d.ts +8 -0
- package/dist/_members/component-runtime/sourceWorkspace.d.ts.map +1 -1
- package/dist/_members/component-runtime/webglProbe.d.ts +191 -0
- package/dist/_members/component-runtime/webglProbe.d.ts.map +1 -0
- package/dist/_members/compose/primitiveRegistry.d.ts +2 -6
- package/dist/_members/composition/fonts/bundledFaces.d.ts +150 -0
- package/dist/_members/composition/fonts/captionFaces.d.ts +268 -0
- package/dist/_members/composition/fonts.d.ts +11 -4
- package/dist/_members/composition/graphics-plan/schemas.d.ts +4 -4
- package/dist/_members/composition/ops/types.d.ts +1 -1
- package/dist/_members/composition/primitive-catalog/index.d.ts +4 -0
- package/dist/_members/composition/primitive-catalog/types.d.ts +1 -0
- package/dist/_members/composition/projection/behind-readiness.d.ts +3 -0
- package/dist/_members/composition/projection/brandKit.d.ts +6 -0
- package/dist/_members/composition/projection/composition-floor.d.ts +2 -1
- package/dist/_members/composition/scene/animation.d.ts +25 -0
- package/dist/_members/composition/scene/budget.d.ts +29 -0
- package/dist/_members/composition/scene/budgetPolicy.d.mts +13 -0
- package/dist/_members/composition/scene/clipRules.d.ts +119 -0
- package/dist/_members/composition/scene/constraints.d.ts +61 -0
- package/dist/_members/composition/scene/device.d.ts +21 -0
- package/dist/_members/composition/scene/examples.d.ts +11 -0
- package/dist/_members/composition/scene/index.d.ts +11 -0
- package/dist/_members/composition/scene/photographicRig.d.ts +242 -0
- package/dist/_members/composition/scene/preparedRender.d.ts +239 -0
- package/dist/_members/composition/scene/resolution.d.ts +178 -0
- package/dist/_members/composition/scene/schema.d.ts +351 -0
- package/dist/_members/composition/scene/videoSchedule.d.ts +43 -0
- package/dist/_members/composition/validators/brandKit.d.ts +1 -0
- package/dist/_members/composition/validators/render.d.ts +2 -0
- package/dist/_members/composition-ops/index.d.ts +45 -0
- package/dist/_members/composition-ops/opRecorder.d.ts +1 -1
- package/dist/_members/core/render/compositionRender.d.ts +41 -9
- package/dist/_members/core/render/index.d.ts +9 -2
- package/dist/_members/core/render/sceneCaptureIdentity.d.ts +14 -0
- package/dist/_members/core/render/sceneShotPlan.d.ts +142 -0
- package/dist/_members/core/render/sceneShotPreparation.d.ts +57 -0
- package/dist/_members/core/render/slabDescriptor.d.ts +21 -0
- package/dist/_members/core/render/trackProjection.d.ts +33 -0
- package/dist/_members/core/render/types.d.ts +142 -0
- package/dist/_members/errors/registry.d.ts +6 -0
- package/dist/_members/mcp/adapter.d.ts +5 -0
- package/dist/_members/mcp/generated/harness.d.ts +1 -1
- package/dist/_members/mcp/generated/sceneContract.d.ts +155 -0
- package/dist/_members/mcp/sceneShot.d.ts +38 -0
- package/dist/_members/mcp/sceneShotExample.d.ts +22 -0
- package/dist/_members/media-model/api.d.ts +1 -0
- package/dist/_members/media-model/media-kind.d.ts +1 -1
- package/dist/_members/media-model/testing/mediaStoreContract.d.ts +1 -1
- package/dist/_members/primitives/effects/index.d.ts +1 -0
- package/dist/_members/primitives/effects/stage-camera/config.d.ts +50 -0
- package/dist/_members/primitives/effects/stage-camera/index.d.ts +31 -0
- package/dist/_members/primitives/layouts/flex-layout/config.d.ts +73 -0
- package/dist/_members/primitives/layouts/flex-layout/index.d.ts +4 -0
- package/dist/_members/primitives/layouts/index.d.ts +1 -0
- package/dist/_members/primitives/layouts/picture-in-picture/config.d.ts +1 -1
- package/dist/_members/primitives/lib/frameScale.d.ts +4 -0
- package/dist/_members/primitives/lib/index.d.ts +1 -0
- package/dist/_members/primitives/lib/palette.d.ts +30 -30
- package/dist/_members/primitives/lib/text/contrast.d.ts +2 -1
- package/dist/_members/primitives/lib/text/spec.d.ts +0 -8
- package/dist/_members/primitives/lib/types.d.ts +2 -0
- package/dist/_members/primitives/scenes/device-showcase/config.d.ts +41 -0
- package/dist/_members/primitives/scenes/device-showcase/index.d.ts +36 -0
- package/dist/_members/primitives/scenes/hero-device-assemble/config.d.ts +1 -0
- package/dist/_members/primitives/scenes/hero-device-assemble/index.d.ts +2 -1
- package/dist/_members/primitives/scenes/index.d.ts +1 -0
- package/dist/_members/primitives/ui-blocks/badge-pop/config.d.ts +1 -1
- package/dist/_members/primitives/ui-blocks/device-mockup-zoom/config.d.ts +1 -0
- package/dist/_members/primitives/ui-blocks/device-mockup-zoom/index.d.ts +2 -1
- package/dist/_members/primitives/ui-blocks/terminal-simulator/config.d.ts +1 -1
- package/dist/_members/primitives/ui-blocks/toast-notification/config.d.ts +1 -1
- package/dist/_members/render-harness/cardAssetAdmission.d.ts.map +1 -1
- package/dist/_members/render-harness/cardRender.d.ts.map +1 -1
- package/dist/_members/render-harness/css-tree-subpaths.d.ts +11 -0
- package/dist/_members/render-harness/extractSegments.d.ts +1 -0
- package/dist/_members/render-harness/extractSegments.d.ts.map +1 -1
- package/dist/_members/render-harness/imageHeader.d.ts +14 -0
- package/dist/_members/render-harness/imageHeader.d.ts.map +1 -0
- package/dist/_members/render-harness/index.d.ts +6 -0
- package/dist/_members/render-harness/index.d.ts.map +1 -1
- package/dist/_members/render-harness/materializeSources.d.ts +46 -2
- package/dist/_members/render-harness/materializeSources.d.ts.map +1 -1
- package/dist/_members/render-harness/nodeScenePreparation.d.ts +97 -0
- package/dist/_members/render-harness/nodeScenePreparation.d.ts.map +1 -0
- package/dist/_members/render-harness/remotion-runtime.d.ts +16 -2
- package/dist/_members/render-harness/renderInputAssets.d.ts +1 -1
- package/dist/_members/render-harness/renderInputAssets.d.ts.map +1 -1
- package/dist/_members/render-harness/resolveAssets.d.ts +2 -2
- package/dist/_members/render-harness/resolveAssets.d.ts.map +1 -1
- package/dist/_members/render-harness/sceneShotAssets.d.ts +17 -0
- package/dist/_members/render-harness/sceneShotAssets.d.ts.map +1 -0
- package/dist/animate/preparation-facts.d.ts +1 -0
- package/dist/animate/preparation-facts.js +22 -0
- package/dist/animate.js +336 -1005
- package/dist/authoring/build-tools.js +7 -6
- package/dist/authoring/context.js +5 -4
- package/dist/authoring/prompts.js +1 -1
- package/dist/authoring/scene.d.ts +1 -0
- package/dist/authoring/scene.js +50 -0
- package/dist/authoring/tools.js +6 -5
- package/dist/authoring.js +49 -29
- package/dist/chunk-2L7PYYJK.js +23 -0
- package/dist/chunk-5DJ3IEJR.js +4424 -0
- package/dist/chunk-6BVVCRRD.js +26488 -0
- package/dist/{chunk-DQKSCHFC.js → chunk-6EWRIAZA.js} +187 -66
- package/dist/{chunk-YQ7FFW3G.js → chunk-6VWICHOZ.js} +26 -5
- package/dist/{chunk-C5SEPOWD.js → chunk-7AZLFN26.js} +1798 -702
- package/dist/{chunk-6ID2J64H.js → chunk-7W6ZIKWV.js} +162 -25
- package/dist/{chunk-RETQFTGY.js → chunk-A74FZCPY.js} +42 -5
- package/dist/chunk-BVA3537Z.js +63 -0
- package/dist/{chunk-DHKQ47Q6.js → chunk-DAARYRNT.js} +6 -1
- package/dist/chunk-DQLYWNLC.js +2063 -0
- package/dist/{chunk-HXKTZPRH.js → chunk-E7GIZEPS.js} +1 -1
- package/dist/chunk-EBIBLL7E.js +3619 -0
- package/dist/{chunk-M2TLRXEO.js → chunk-EXY4JJPH.js} +1 -1
- package/dist/{chunk-AWT3P5ZN.js → chunk-FVDFPJHT.js} +1 -1
- package/dist/{chunk-EMGFZ3PR.js → chunk-FWSJLHSV.js} +5 -1
- package/dist/{chunk-TMIBBD5E.js → chunk-I5QWBM3M.js} +280 -113
- package/dist/{chunk-IBMJ33EL.js → chunk-I5RX2QZT.js} +1 -1
- package/dist/{chunk-4FOOBSEE.js → chunk-J3DIUG24.js} +1 -0
- package/dist/{chunk-AD5HWBCE.js → chunk-JX53CVJV.js} +14 -5
- package/dist/{chunk-LNBVTDFR.js → chunk-L2AHS3AW.js} +1 -1
- package/dist/{chunk-BDMTUEEZ.js → chunk-LT4PWSR2.js} +2 -2
- package/dist/chunk-MH3UPKWR.js +3415 -0
- package/dist/{chunk-RFXR7ATW.js → chunk-MN6D3U5N.js} +13 -1
- package/dist/{chunk-IJ7PVJTK.js → chunk-ODUWCQI3.js} +3 -2
- package/dist/chunk-QAGGJHAF.js +16 -0
- package/dist/chunk-QS36DMFG.js +332 -0
- package/dist/{chunk-G5BFI32U.js → chunk-RAXHCRVV.js} +1 -1
- package/dist/{chunk-BIBYZJL3.js → chunk-RL5SO653.js} +3 -3
- package/dist/{chunk-ZSZABOE5.js → chunk-S5H6GH6M.js} +1 -1
- package/dist/{chunk-EEXCDFY5.js → chunk-SD25VQDE.js} +1 -1
- package/dist/chunk-TARKDVP6.js +430 -0
- package/dist/{chunk-XVBOSPZI.js → chunk-TBNTAQJA.js} +6 -6
- package/dist/{chunk-IHFREGFA.js → chunk-TCHPRGC5.js} +18 -2
- package/dist/{chunk-ZCAQHNPI.js → chunk-UKGNHZS4.js} +1 -1
- package/dist/{chunk-ZN6P3KOJ.js → chunk-UN6NY2E6.js} +3 -3
- package/dist/{chunk-WQSGVRFU.js → chunk-UY77TMKD.js} +31 -44
- package/dist/chunk-VKATKWWR.js +1462 -0
- package/dist/{chunk-U5LBYS3N.js → chunk-VLJOIUHL.js} +341 -274
- package/dist/{chunk-CX2IIQ4R.js → chunk-W2245F6G.js} +29 -29
- package/dist/{chunk-GEGRJKKO.js → chunk-W6B7BMLO.js} +1 -1
- package/dist/{chunk-XHUYWVYK.js → chunk-WBNFSG6T.js} +1 -1
- package/dist/chunk-WIHXXF3X.js +221 -0
- package/dist/{chunk-7KEUL3FI.js → chunk-XF2QMKRG.js} +9 -1
- package/dist/{chunk-HFC3MKXA.js → chunk-Y4HPN4BC.js} +1 -0
- package/dist/{chunk-D43J23QX.js → chunk-YFSBFCXO.js} +1018 -42
- package/dist/{chunk-KKEY5MIW.js → chunk-ZS3A3QUM.js} +16 -16
- package/dist/{chunk-LQUWKBST.js → chunk-ZVG446DJ.js} +139 -10
- package/dist/component-runtime/browserOptions.js +14 -3
- package/dist/component-runtime/contracts.js +35 -3
- package/dist/component-runtime/identity/browser.js +1 -1
- package/dist/component-runtime/identity.js +2 -2
- package/dist/component-runtime/importPolicy.js +2 -2
- package/dist/component-runtime/mediaResolution.d.ts +1 -0
- package/dist/component-runtime/mediaResolution.js +11 -0
- package/dist/component-runtime/render.js +38 -5
- package/dist/component-runtime.js +118 -14
- package/dist/compose.js +192 -33
- package/dist/composition/fonts.js +64 -67
- package/dist/composition/graphics-plan.js +3 -2
- package/dist/composition/ops.js +4 -3
- package/dist/composition/primitive-catalog.js +3 -1
- package/dist/composition/projection.js +10 -3
- package/dist/composition/scene/budget-policy.d.ts +1 -0
- package/dist/composition/scene/budget-policy.js +17 -0
- package/dist/composition/scene/schema.json +2757 -0
- package/dist/composition/scene.d.ts +1 -0
- package/dist/composition/scene.js +275 -0
- package/dist/composition/validators.js +3 -2
- package/dist/composition-ops.js +103 -13
- package/dist/composition.js +12 -5
- package/dist/{context-4GSDBFT3.js → context-IUPQ54V4.js} +5 -4
- package/dist/core/render.js +54 -3
- package/dist/core/select.js +2 -2
- package/dist/core.js +6 -3
- package/dist/director/ai-sdk.js +3 -3
- package/dist/director/domain.js +2 -2
- package/dist/director.js +3 -3
- package/dist/errors.js +1 -1
- package/dist/mcp/adapter.js +4 -4
- package/dist/mcp/core.js +1 -1
- package/dist/mcp/curation.js +1 -1
- package/dist/mcp/server.js +4 -4
- package/dist/mcp.js +4 -4
- package/dist/media-model/media-kind.js +2 -0
- package/dist/media-model/testing.js +16 -11
- package/dist/media-model.js +1 -1
- package/dist/nle-export.js +1 -27
- package/dist/primitives/backgrounds.js +2 -2
- package/dist/primitives/captions.js +21 -11
- package/dist/primitives/effects.js +14 -4
- package/dist/primitives/graphics.json +3 -0
- package/dist/primitives/hero-text.js +4 -3
- package/dist/primitives/layouts.js +9 -2
- package/dist/primitives/lib/frameScale.d.ts +1 -0
- package/dist/primitives/lib/frameScale.js +11 -0
- package/dist/primitives/lib/index.js +18 -10
- package/dist/primitives/lib/palette.js +1 -1
- package/dist/primitives/lib/text/contrast.js +2 -1
- package/dist/primitives/lib/text/typeface.js +1 -1
- package/dist/primitives/lib.js +18 -10
- package/dist/primitives/params-required.json +3 -0
- package/dist/primitives/scenes.js +12 -3
- package/dist/primitives/text.js +5 -5
- package/dist/primitives/transitions.js +2 -2
- package/dist/primitives/ui-blocks.js +7 -6
- package/dist/primitives/version-map.json +5 -2
- package/dist/primitives.js +23 -16
- package/dist/render-harness/cardAssetAdmission.js +2 -2
- package/dist/render-harness/renderInputAssets.js +2 -2
- package/dist/render-harness.js +874 -124
- package/package.json +48 -14
- package/dist/_members/animate/three/drei.d.ts +0 -6
- package/dist/_members/component-runtime/fixtures/webgpuTiledRefraction.d.ts +0 -9
- package/dist/_members/component-runtime/fixtures/webgpuTiledRefraction.d.ts.map +0 -1
- package/dist/chunk-5OTQ7M43.js +0 -718
- package/dist/chunk-7REW2MW3.js +0 -202
- package/dist/chunk-CGHTMZNC.js +0 -6
- package/dist/chunk-KVMVYRXX.js +0 -9527
- package/dist/chunk-WYQX4QIK.js +0 -544
- /package/dist/{chunk-H5LMJKZU.js → chunk-JVDUSOYG.js} +0 -0
|
@@ -0,0 +1,1462 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PHOTOGRAPHIC_STUDIO_EDGE_INTENSITY,
|
|
3
|
+
PHOTOGRAPHIC_STUDIO_EDGE_LIGHTS,
|
|
4
|
+
PHOTOGRAPHIC_STUDIO_GPU_BYTES,
|
|
5
|
+
PHOTOGRAPHIC_STUDIO_HDRI_BYTES,
|
|
6
|
+
PHOTOGRAPHIC_STUDIO_HDRI_PATH,
|
|
7
|
+
PHOTOGRAPHIC_STUDIO_HDRI_SHA256,
|
|
8
|
+
PHOTOGRAPHIC_STUDIO_RIG_FACTS,
|
|
9
|
+
PHOTOGRAPHIC_STUDIO_RIG_ID,
|
|
10
|
+
SCENE_PRESET_TRIANGLES,
|
|
11
|
+
SCENE_SLAB_BODY_TRIANGLES,
|
|
12
|
+
SCENE_SLAB_CONTENT_FACE_TRIANGLES,
|
|
13
|
+
STUDIO_SHADOW_MAP_BUDGET,
|
|
14
|
+
sceneDeviceDimensionsV1,
|
|
15
|
+
sceneFocusPreparationAllocationsV1,
|
|
16
|
+
sceneLaptopLayoutV1,
|
|
17
|
+
sceneLaptopScreenQuadV1,
|
|
18
|
+
sceneW5GeneratedRigAllocationsV1,
|
|
19
|
+
sceneW5PresetAllocationsV1,
|
|
20
|
+
sceneW5WorldTextAllocationsV1
|
|
21
|
+
} from "./chunk-MH3UPKWR.js";
|
|
22
|
+
|
|
23
|
+
// ../execution/animate/src/three/toneMapping.ts
|
|
24
|
+
import {
|
|
25
|
+
ACESFilmicToneMapping,
|
|
26
|
+
AgXToneMapping,
|
|
27
|
+
CineonToneMapping,
|
|
28
|
+
LinearToneMapping,
|
|
29
|
+
NeutralToneMapping,
|
|
30
|
+
NoToneMapping,
|
|
31
|
+
ReinhardToneMapping,
|
|
32
|
+
ShaderChunk
|
|
33
|
+
} from "three";
|
|
34
|
+
var TONE_MAPPING_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
35
|
+
[LinearToneMapping, "Linear"],
|
|
36
|
+
[ReinhardToneMapping, "Reinhard"],
|
|
37
|
+
[CineonToneMapping, "Cineon"],
|
|
38
|
+
[ACESFilmicToneMapping, "ACESFilmic"],
|
|
39
|
+
[AgXToneMapping, "AgX"],
|
|
40
|
+
[NeutralToneMapping, "Neutral"]
|
|
41
|
+
]);
|
|
42
|
+
function toneMappingPreamble(toneMapping) {
|
|
43
|
+
if (toneMapping === NoToneMapping) return "";
|
|
44
|
+
const name = TONE_MAPPING_FUNCTIONS.get(toneMapping);
|
|
45
|
+
if (name === void 0) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`this renderer's tone mapping (${toneMapping}) has no function in three's own table, so a lit material cannot apply it itself; scene shots render into a target, where three applies none`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return [
|
|
51
|
+
"#define TONE_MAPPING",
|
|
52
|
+
ShaderChunk.tonemapping_pars_fragment,
|
|
53
|
+
`vec3 toneMapping( vec3 color ) { return ${name}ToneMapping( color ); }`,
|
|
54
|
+
""
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
function toneMapInTheMaterial(shader, renderer) {
|
|
58
|
+
shader.fragmentShader = toneMappingPreamble(renderer.toneMapping) + shader.fragmentShader;
|
|
59
|
+
}
|
|
60
|
+
var SELF_TONE_MAPPED = { toneMapped: false, onBeforeCompile: toneMapInTheMaterial };
|
|
61
|
+
var UNLIT_COLOUR_MANAGED = { toneMapped: false };
|
|
62
|
+
|
|
63
|
+
// ../execution/animate/src/scene/v2/runtimeAllocations.ts
|
|
64
|
+
import { createContext, createElement, useCallback, useContext, useLayoutEffect, useState } from "react";
|
|
65
|
+
var state = {
|
|
66
|
+
createdPlans: 0,
|
|
67
|
+
disposedPlans: 0,
|
|
68
|
+
livePlans: 0,
|
|
69
|
+
liveContextGlBytes: 0,
|
|
70
|
+
liveCpuBytes: 0,
|
|
71
|
+
peakGlBytesIncludingPreparation: 0,
|
|
72
|
+
peakDeclaredLiveBytes: 0,
|
|
73
|
+
actualCreatedResources: 0,
|
|
74
|
+
actualDisposedResources: 0,
|
|
75
|
+
actualLiveGlBytes: 0,
|
|
76
|
+
actualLiveCpuBytes: 0,
|
|
77
|
+
actualPeakLiveBytes: 0,
|
|
78
|
+
actualLiveRows: []
|
|
79
|
+
};
|
|
80
|
+
var liveObjects = /* @__PURE__ */ new WeakSet();
|
|
81
|
+
var nextResourceId = 1;
|
|
82
|
+
var nextMountId = 1;
|
|
83
|
+
var resources = /* @__PURE__ */ new Map();
|
|
84
|
+
var mounts = /* @__PURE__ */ new Map();
|
|
85
|
+
var SceneRuntimeMountContextV1 = createContext(null);
|
|
86
|
+
var RECEIPT_PREFIX = "__cueframe_scene_resource_v1__:";
|
|
87
|
+
var runtimeInstanceId = globalThis.crypto?.randomUUID?.() ?? `runtime-${Date.now()}-${Math.random()}`;
|
|
88
|
+
function emitReceipt(event) {
|
|
89
|
+
console.info(`${RECEIPT_PREFIX}${JSON.stringify({ runtimeInstanceId, ...event })}`);
|
|
90
|
+
}
|
|
91
|
+
function canonicalRowsForMount(mountId, rows) {
|
|
92
|
+
const mount = mounts.get(mountId);
|
|
93
|
+
if (!mount) throw new Error("scene_runtime_mount_missing");
|
|
94
|
+
return rows.map((row) => {
|
|
95
|
+
const owners = new Set(mount.plan.ledger.allocations.filter((candidate) => candidate.owner === row.owner || candidate.owner.endsWith(`:${row.owner}`)).map((candidate) => candidate.owner));
|
|
96
|
+
if (owners.size !== 1) throw new Error(`scene_runtime_resource_owner_unresolved: ${row.owner}`);
|
|
97
|
+
return { ...row, owner: [...owners][0] };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function sceneActualResourceRegistrarForMountV1(mountId) {
|
|
101
|
+
return (object, rows) => registerActualSceneResourcesV1(object, canonicalRowsForMount(mountId, rows), mountId);
|
|
102
|
+
}
|
|
103
|
+
function tokenRegistrar(token) {
|
|
104
|
+
return (object, rows) => {
|
|
105
|
+
const pending = { object, rows, cancelled: false };
|
|
106
|
+
token.pending.add(pending);
|
|
107
|
+
if (token.mountId !== void 0) pending.actualRelease = sceneActualResourceRegistrarForMountV1(token.mountId)(object, rows);
|
|
108
|
+
return () => {
|
|
109
|
+
if (pending.cancelled) return;
|
|
110
|
+
pending.cancelled = true;
|
|
111
|
+
pending.actualRelease?.();
|
|
112
|
+
token.pending.delete(pending);
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function useSceneActualResourceRegistrarV1() {
|
|
117
|
+
const token = useContext(SceneRuntimeMountContextV1);
|
|
118
|
+
return useCallback(token === null ? registerActualSceneResourcesV1 : tokenRegistrar(token), [token]);
|
|
119
|
+
}
|
|
120
|
+
function CommittedSceneRuntimeBoundaryV1({ plan, children }) {
|
|
121
|
+
const [token] = useState(() => ({ plan, pending: /* @__PURE__ */ new Set() }));
|
|
122
|
+
useLayoutEffect(() => {
|
|
123
|
+
const lease = reserveSceneRuntimeAllocationV1(plan);
|
|
124
|
+
token.mountId = lease.mountId;
|
|
125
|
+
token.releaseMount = lease.release;
|
|
126
|
+
for (const pending of token.pending) if (!pending.cancelled && !pending.actualRelease) {
|
|
127
|
+
pending.actualRelease = sceneActualResourceRegistrarForMountV1(lease.mountId)(pending.object, pending.rows);
|
|
128
|
+
}
|
|
129
|
+
return () => {
|
|
130
|
+
token.releaseMount?.();
|
|
131
|
+
token.releaseMount = void 0;
|
|
132
|
+
token.mountId = void 0;
|
|
133
|
+
};
|
|
134
|
+
}, [plan, token]);
|
|
135
|
+
return createElement(SceneRuntimeMountContextV1.Provider, { value: token }, children);
|
|
136
|
+
}
|
|
137
|
+
function SceneRuntimeAllocationBoundaryV1({ plan, children }) {
|
|
138
|
+
return createElement(CommittedSceneRuntimeBoundaryV1, { key: plan.sealSha256, plan }, children);
|
|
139
|
+
}
|
|
140
|
+
function sceneRuntimeAllocationSnapshotV1() {
|
|
141
|
+
return Object.freeze({
|
|
142
|
+
...state,
|
|
143
|
+
actualLiveRows: Object.freeze(state.actualLiveRows.map((row) => Object.freeze({ ...row })))
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function resetSceneRuntimeAllocationCountersV1() {
|
|
147
|
+
if (state.livePlans !== 0 || state.actualCreatedResources !== state.actualDisposedResources) throw new Error("scene_runtime_allocation_reset_while_live");
|
|
148
|
+
Object.assign(state, {
|
|
149
|
+
createdPlans: 0,
|
|
150
|
+
disposedPlans: 0,
|
|
151
|
+
livePlans: 0,
|
|
152
|
+
liveContextGlBytes: 0,
|
|
153
|
+
liveCpuBytes: 0,
|
|
154
|
+
peakGlBytesIncludingPreparation: 0,
|
|
155
|
+
peakDeclaredLiveBytes: 0,
|
|
156
|
+
actualCreatedResources: 0,
|
|
157
|
+
actualDisposedResources: 0,
|
|
158
|
+
actualLiveGlBytes: 0,
|
|
159
|
+
actualLiveCpuBytes: 0,
|
|
160
|
+
actualPeakLiveBytes: 0,
|
|
161
|
+
actualLiveRows: []
|
|
162
|
+
});
|
|
163
|
+
nextResourceId = 1;
|
|
164
|
+
nextMountId = 1;
|
|
165
|
+
resources.clear();
|
|
166
|
+
mounts.clear();
|
|
167
|
+
}
|
|
168
|
+
function registerActualSceneResourcesV1(object, rows, mountId) {
|
|
169
|
+
if (liveObjects.has(object)) throw new Error("scene_runtime_resource_already_registered");
|
|
170
|
+
let gl = 0;
|
|
171
|
+
let cpu = 0;
|
|
172
|
+
for (const row of rows) {
|
|
173
|
+
if (!row.owner || !row.name || !Number.isSafeInteger(row.bytes) || row.bytes < 0) {
|
|
174
|
+
throw new Error("scene_runtime_resource_measurement_invalid");
|
|
175
|
+
}
|
|
176
|
+
for (const value of [row.width, row.height, row.samples, row.byteLength]) {
|
|
177
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) {
|
|
178
|
+
throw new Error("scene_runtime_resource_measurement_invalid");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (row.domain === "gl") gl += row.bytes;
|
|
182
|
+
else if (row.domain === "cpu") cpu += row.bytes;
|
|
183
|
+
else throw new Error("scene_runtime_resource_domain_invalid");
|
|
184
|
+
}
|
|
185
|
+
const resourceId = nextResourceId++;
|
|
186
|
+
liveObjects.add(object);
|
|
187
|
+
state.actualCreatedResources += 1;
|
|
188
|
+
state.actualLiveGlBytes += gl;
|
|
189
|
+
state.actualLiveCpuBytes += cpu;
|
|
190
|
+
state.actualPeakLiveBytes = Math.max(state.actualPeakLiveBytes, state.actualLiveGlBytes + state.actualLiveCpuBytes);
|
|
191
|
+
state.actualLiveRows = [...state.actualLiveRows, ...rows.map((row) => ({ ...row, resourceId }))];
|
|
192
|
+
resources.set(resourceId, { rows, assignedMountId: mountId });
|
|
193
|
+
emitReceipt({ type: "resource-created", resourceId, rows, snapshot: sceneRuntimeAllocationSnapshotV1() });
|
|
194
|
+
if (mountId !== void 0) emitReceipt({ type: "resource-assigned", resourceId, mountId });
|
|
195
|
+
let disposed = false;
|
|
196
|
+
return () => {
|
|
197
|
+
if (disposed) return;
|
|
198
|
+
disposed = true;
|
|
199
|
+
liveObjects.delete(object);
|
|
200
|
+
state.actualDisposedResources += 1;
|
|
201
|
+
state.actualLiveGlBytes -= gl;
|
|
202
|
+
state.actualLiveCpuBytes -= cpu;
|
|
203
|
+
state.actualLiveRows = state.actualLiveRows.filter((row) => row.resourceId !== resourceId);
|
|
204
|
+
emitReceipt({
|
|
205
|
+
type: "resource-disposed",
|
|
206
|
+
resourceId,
|
|
207
|
+
mountId: resources.get(resourceId)?.assignedMountId,
|
|
208
|
+
snapshot: sceneRuntimeAllocationSnapshotV1()
|
|
209
|
+
});
|
|
210
|
+
resources.delete(resourceId);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function reserveSceneRuntimeAllocationV1(plan) {
|
|
214
|
+
const { contextGlBytes, preparationPeakGlBytes, cpuBytes } = plan.ledger;
|
|
215
|
+
for (const [field, value] of Object.entries({ contextGlBytes, preparationPeakGlBytes, cpuBytes })) {
|
|
216
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new Error(`scene_runtime_allocation_invalid: ${field}`);
|
|
217
|
+
}
|
|
218
|
+
state.createdPlans += 1;
|
|
219
|
+
state.livePlans += 1;
|
|
220
|
+
state.liveContextGlBytes += contextGlBytes;
|
|
221
|
+
state.liveCpuBytes += cpuBytes;
|
|
222
|
+
const glIncludingPreparation = state.liveContextGlBytes - contextGlBytes + preparationPeakGlBytes;
|
|
223
|
+
state.peakGlBytesIncludingPreparation = Math.max(state.peakGlBytesIncludingPreparation, glIncludingPreparation);
|
|
224
|
+
state.peakDeclaredLiveBytes = Math.max(state.peakDeclaredLiveBytes, glIncludingPreparation + state.liveCpuBytes);
|
|
225
|
+
const mountId = nextMountId++;
|
|
226
|
+
mounts.set(mountId, { plan });
|
|
227
|
+
emitReceipt({ type: "plan-mounted", mountId, sealSha256: plan.sealSha256, ledger: plan.ledger, snapshot: sceneRuntimeAllocationSnapshotV1() });
|
|
228
|
+
let released = false;
|
|
229
|
+
return { mountId, release: () => {
|
|
230
|
+
if (released) return;
|
|
231
|
+
released = true;
|
|
232
|
+
state.disposedPlans += 1;
|
|
233
|
+
state.livePlans -= 1;
|
|
234
|
+
state.liveContextGlBytes -= contextGlBytes;
|
|
235
|
+
state.liveCpuBytes -= cpuBytes;
|
|
236
|
+
emitReceipt({ type: "plan-unmounted", mountId, sealSha256: plan.sealSha256, snapshot: sceneRuntimeAllocationSnapshotV1() });
|
|
237
|
+
mounts.delete(mountId);
|
|
238
|
+
} };
|
|
239
|
+
}
|
|
240
|
+
function acquireSceneRuntimeAllocationV1(plan) {
|
|
241
|
+
return reserveSceneRuntimeAllocationV1(plan).release;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ../execution/animate/src/three/StudioRig.tsx
|
|
245
|
+
import { useLayoutEffect as useLayoutEffect2, useRef } from "react";
|
|
246
|
+
import { useThree } from "@react-three/fiber";
|
|
247
|
+
import { PMREMGenerator, Vector3 } from "three";
|
|
248
|
+
import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js";
|
|
249
|
+
|
|
250
|
+
// ../execution/animate/src/scene/v2/renderTargetObserver.ts
|
|
251
|
+
var states = /* @__PURE__ */ new WeakMap();
|
|
252
|
+
function subscribeSceneRenderTargetsV1(renderer, subscriber) {
|
|
253
|
+
let state2 = states.get(renderer);
|
|
254
|
+
if (!state2) {
|
|
255
|
+
const original = renderer.setRenderTarget;
|
|
256
|
+
state2 = { subscribers: /* @__PURE__ */ new Set(), original };
|
|
257
|
+
states.set(renderer, state2);
|
|
258
|
+
renderer.setRenderTarget = function observedSetRenderTarget(target, ...rest) {
|
|
259
|
+
const current = states.get(renderer);
|
|
260
|
+
if (current) for (const listener of [...current.subscribers]) listener(target);
|
|
261
|
+
return original.call(this, target, ...rest);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
state2.subscribers.add(subscriber);
|
|
265
|
+
let closed = false;
|
|
266
|
+
return () => {
|
|
267
|
+
if (closed) return;
|
|
268
|
+
closed = true;
|
|
269
|
+
const current = states.get(renderer);
|
|
270
|
+
if (!current) return;
|
|
271
|
+
current.subscribers.delete(subscriber);
|
|
272
|
+
if (current.subscribers.size === 0) {
|
|
273
|
+
renderer.setRenderTarget = current.original;
|
|
274
|
+
states.delete(renderer);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ../execution/animate/src/scene/v2/observePmremTargets.ts
|
|
280
|
+
import { HalfFloatType } from "three";
|
|
281
|
+
function withObservedPmremTargetsV1(renderer, owner, build, registerActual = registerActualSceneResourcesV1) {
|
|
282
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
283
|
+
const unsubscribe = subscribeSceneRenderTargetsV1(renderer, (target) => {
|
|
284
|
+
if (target && !seen.has(target)) {
|
|
285
|
+
seen.add(target);
|
|
286
|
+
const texture = Array.isArray(target.texture) ? target.texture[0] : target.texture;
|
|
287
|
+
const colorBytes = target.width * target.height * (texture?.type === HalfFloatType ? 8 : 4) * Math.max(1, target.samples || 1);
|
|
288
|
+
const rows = [{
|
|
289
|
+
owner,
|
|
290
|
+
name: "pmrem-observed-color",
|
|
291
|
+
domain: "gl",
|
|
292
|
+
bytes: colorBytes,
|
|
293
|
+
width: target.width,
|
|
294
|
+
height: target.height,
|
|
295
|
+
samples: Math.max(1, target.samples || 1),
|
|
296
|
+
evidenceOnly: true
|
|
297
|
+
}];
|
|
298
|
+
if (target.depthBuffer) rows.push({
|
|
299
|
+
owner,
|
|
300
|
+
name: "pmrem-observed-depth",
|
|
301
|
+
domain: "gl",
|
|
302
|
+
bytes: target.width * target.height * 4 * Math.max(1, target.samples || 1),
|
|
303
|
+
width: target.width,
|
|
304
|
+
height: target.height,
|
|
305
|
+
samples: Math.max(1, target.samples || 1),
|
|
306
|
+
evidenceOnly: true
|
|
307
|
+
});
|
|
308
|
+
const release = registerActual(target, rows);
|
|
309
|
+
target.addEventListener("dispose", release);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
try {
|
|
313
|
+
return build();
|
|
314
|
+
} finally {
|
|
315
|
+
unsubscribe();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ../execution/animate/src/three/StudioRig.tsx
|
|
320
|
+
var DEFAULT_LIGHTING_PROFILE = "studio";
|
|
321
|
+
var LIGHTING_PROFILES = ["studio", "studio-edge"];
|
|
322
|
+
var STUDIO_LIGHTS = [
|
|
323
|
+
{ role: "key", position: [700, 1100, 1300], castShadow: false },
|
|
324
|
+
{ role: "fill", position: [-1100, 400, 900], castShadow: false },
|
|
325
|
+
{ role: "rim", position: [0, 1300, -1900], castShadow: true }
|
|
326
|
+
];
|
|
327
|
+
var STUDIO_EDGE_LIGHTS = [
|
|
328
|
+
[2e3, 350, -700],
|
|
329
|
+
[-2e3, 350, -700]
|
|
330
|
+
];
|
|
331
|
+
var STUDIO_EDGE_INTENSITY = 20;
|
|
332
|
+
function studioEdgeLightCount(profile) {
|
|
333
|
+
return profile === "studio-edge" ? STUDIO_EDGE_LIGHTS.length : 0;
|
|
334
|
+
}
|
|
335
|
+
var STUDIO_SHADOW_FRUSTUM = { extent: 1600, near: 100, far: 6e3, mapSize: 2048 };
|
|
336
|
+
var STUDIO_SHADOW_REACH_PAD = 1.25;
|
|
337
|
+
var STUDIO_FLOOR_EXTENT = 12e3;
|
|
338
|
+
function studioCasterBasis(worldScale) {
|
|
339
|
+
const caster = STUDIO_LIGHTS.find((l) => l.castShadow);
|
|
340
|
+
const eye = new Vector3(...studioLightPosition(caster, worldScale));
|
|
341
|
+
const back = eye.clone().normalize();
|
|
342
|
+
const right = new Vector3(0, 1, 0).cross(back).normalize();
|
|
343
|
+
const up = back.clone().cross(right);
|
|
344
|
+
return { eye, right, up, forward: back.clone().negate() };
|
|
345
|
+
}
|
|
346
|
+
function studioShadowFrustum(worldScale, bounds, floorY) {
|
|
347
|
+
const f = STUDIO_SHADOW_FRUSTUM;
|
|
348
|
+
const base = { extent: f.extent * worldScale, near: f.near * worldScale, far: f.far * worldScale, mapSize: f.mapSize };
|
|
349
|
+
if (!bounds) return base;
|
|
350
|
+
const { eye, right, up, forward } = studioCasterBasis(worldScale);
|
|
351
|
+
let reach = 0;
|
|
352
|
+
let nearest = Number.POSITIVE_INFINITY;
|
|
353
|
+
let farthest = Number.NEGATIVE_INFINITY;
|
|
354
|
+
const corner = new Vector3();
|
|
355
|
+
const offset = new Vector3();
|
|
356
|
+
for (const x of [bounds.minX, bounds.maxX]) for (const y of [bounds.minY, bounds.maxY]) for (const z of [bounds.minZ, bounds.maxZ]) {
|
|
357
|
+
corner.set(x, y, z);
|
|
358
|
+
reach = Math.max(reach, Math.abs(corner.dot(right)), Math.abs(corner.dot(up)));
|
|
359
|
+
const depth = offset.copy(corner).sub(eye).dot(forward);
|
|
360
|
+
nearest = Math.min(nearest, depth);
|
|
361
|
+
farthest = Math.max(farthest, depth);
|
|
362
|
+
if (floorY !== void 0 && forward.y < 0 && corner.y > floorY) {
|
|
363
|
+
farthest = Math.max(farthest, depth + (corner.y - floorY) / -forward.y);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const extent = Math.max(base.extent, reach * STUDIO_SHADOW_REACH_PAD);
|
|
367
|
+
let mapSize = base.mapSize;
|
|
368
|
+
while (mapSize < STUDIO_SHADOW_MAP_BUDGET && mapSize * base.extent < base.mapSize * extent) mapSize *= 2;
|
|
369
|
+
return {
|
|
370
|
+
extent,
|
|
371
|
+
near: Math.max(1, Math.min(base.near, nearest / STUDIO_SHADOW_REACH_PAD)),
|
|
372
|
+
far: Math.max(base.far, farthest * STUDIO_SHADOW_REACH_PAD),
|
|
373
|
+
mapSize
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function studioLightPosition(light, worldScale) {
|
|
377
|
+
const [x, y, z] = light.position;
|
|
378
|
+
return [x * worldScale, y * worldScale, z * worldScale];
|
|
379
|
+
}
|
|
380
|
+
var STUDIO_PRESETS = {
|
|
381
|
+
soft: { hemi: 0.7, key: 1.6, fill: 0.9, rim: 1 },
|
|
382
|
+
key: { hemi: 0.4, key: 2.6, fill: 0.5, rim: 0.8 },
|
|
383
|
+
rim: { hemi: 0.35, key: 1.2, fill: 0.4, rim: 2.4 }
|
|
384
|
+
};
|
|
385
|
+
function MeasuredRimLight({ position, intensity, frustum }) {
|
|
386
|
+
const registerActual = useSceneActualResourceRegistrarV1();
|
|
387
|
+
const light = useRef(null);
|
|
388
|
+
const gl = useThree((state2) => state2.gl);
|
|
389
|
+
useLayoutEffect2(() => {
|
|
390
|
+
const current = light.current;
|
|
391
|
+
if (!current) return;
|
|
392
|
+
let observed = null;
|
|
393
|
+
const unsubscribe = subscribeSceneRenderTargetsV1(gl, (target) => {
|
|
394
|
+
if (target && target === current.shadow.map && observed !== target) {
|
|
395
|
+
observed = target;
|
|
396
|
+
const bytes = target.width * target.height * 4;
|
|
397
|
+
const release = registerActual(target, [
|
|
398
|
+
{
|
|
399
|
+
owner: "studio:rim",
|
|
400
|
+
name: "shadow-color",
|
|
401
|
+
domain: "gl",
|
|
402
|
+
bytes,
|
|
403
|
+
width: target.width,
|
|
404
|
+
height: target.height
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
owner: "studio:rim",
|
|
408
|
+
name: "shadow-depth",
|
|
409
|
+
domain: "gl",
|
|
410
|
+
bytes,
|
|
411
|
+
width: target.width,
|
|
412
|
+
height: target.height
|
|
413
|
+
}
|
|
414
|
+
]);
|
|
415
|
+
target.addEventListener("dispose", release);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
return () => {
|
|
419
|
+
unsubscribe();
|
|
420
|
+
current.shadow.dispose();
|
|
421
|
+
};
|
|
422
|
+
}, [frustum.mapSize, gl, registerActual]);
|
|
423
|
+
return /* @__PURE__ */ React.createElement(
|
|
424
|
+
"directionalLight",
|
|
425
|
+
{
|
|
426
|
+
ref: light,
|
|
427
|
+
position,
|
|
428
|
+
intensity,
|
|
429
|
+
castShadow: true,
|
|
430
|
+
"shadow-mapSize": [frustum.mapSize, frustum.mapSize],
|
|
431
|
+
"shadow-bias": -4e-4,
|
|
432
|
+
"shadow-camera-left": -frustum.extent,
|
|
433
|
+
"shadow-camera-right": frustum.extent,
|
|
434
|
+
"shadow-camera-top": frustum.extent,
|
|
435
|
+
"shadow-camera-bottom": -frustum.extent,
|
|
436
|
+
"shadow-camera-near": frustum.near,
|
|
437
|
+
"shadow-camera-far": frustum.far
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
function Environment() {
|
|
442
|
+
const registerActual = useSceneActualResourceRegistrarV1();
|
|
443
|
+
const gl = useThree((s) => s.gl);
|
|
444
|
+
const scene = useThree((s) => s.scene);
|
|
445
|
+
useLayoutEffect2(() => {
|
|
446
|
+
const pmrem = new PMREMGenerator(gl);
|
|
447
|
+
let target;
|
|
448
|
+
try {
|
|
449
|
+
target = withObservedPmremTargetsV1(gl, "studio:environment", () => pmrem.fromScene(new RoomEnvironment(), 0.04), registerActual);
|
|
450
|
+
} finally {
|
|
451
|
+
pmrem.dispose();
|
|
452
|
+
}
|
|
453
|
+
scene.environment = target.texture;
|
|
454
|
+
return () => {
|
|
455
|
+
scene.environment = null;
|
|
456
|
+
target.dispose();
|
|
457
|
+
};
|
|
458
|
+
}, [gl, scene, registerActual]);
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
function StudioRig({ lightingProfile = DEFAULT_LIGHTING_PROFILE, preset = "soft", intensity = 1, floorY = -420, shadowOpacity = 0.5, environment = true, worldScale = 1, shadowBounds }) {
|
|
462
|
+
const p = STUDIO_PRESETS[preset];
|
|
463
|
+
const frustum = studioShadowFrustum(worldScale, shadowBounds, floorY);
|
|
464
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, environment ? /* @__PURE__ */ React.createElement(Environment, null) : null, /* @__PURE__ */ React.createElement("hemisphereLight", { args: ["#ffffff", "#202024", p.hemi * intensity] }), STUDIO_LIGHTS.map((light) => light.castShadow ? /* @__PURE__ */ React.createElement(MeasuredRimLight, { key: light.role, position: studioLightPosition(light, worldScale), intensity: p[light.role] * intensity, frustum }) : /* @__PURE__ */ React.createElement("directionalLight", { key: light.role, position: studioLightPosition(light, worldScale), intensity: p[light.role] * intensity })), STUDIO_EDGE_LIGHTS.slice(0, studioEdgeLightCount(lightingProfile)).map(([x, y, z], i) => /* @__PURE__ */ React.createElement(
|
|
465
|
+
"directionalLight",
|
|
466
|
+
{
|
|
467
|
+
key: `edge-${i}`,
|
|
468
|
+
position: [x * worldScale, y * worldScale, z * worldScale],
|
|
469
|
+
intensity: STUDIO_EDGE_INTENSITY,
|
|
470
|
+
castShadow: false
|
|
471
|
+
}
|
|
472
|
+
)), /* @__PURE__ */ React.createElement("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, floorY, 0], receiveShadow: true }, /* @__PURE__ */ React.createElement("planeGeometry", { args: [STUDIO_FLOOR_EXTENT * worldScale, STUDIO_FLOOR_EXTENT * worldScale] }), /* @__PURE__ */ React.createElement("shadowMaterial", { transparent: true, opacity: shadowOpacity, ...SELF_TONE_MAPPED })));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// ../execution/animate/src/three/DeviceMesh.tsx
|
|
476
|
+
import { useLayoutEffect as useLayoutEffect4, useMemo } from "react";
|
|
477
|
+
import { RoundedBoxGeometry } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
|
|
478
|
+
import { ExtrudeGeometry, Shape } from "three";
|
|
479
|
+
|
|
480
|
+
// ../execution/animate/src/scene/v2/MeasuredPlaneGeometry.tsx
|
|
481
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef2 } from "react";
|
|
482
|
+
function bufferBytes(geometry) {
|
|
483
|
+
let bytes = geometry.index?.array.byteLength ?? 0;
|
|
484
|
+
for (const attribute of Object.values(geometry.attributes)) bytes += attribute.array.byteLength;
|
|
485
|
+
return bytes;
|
|
486
|
+
}
|
|
487
|
+
function MeasuredPlaneGeometry({ width, height, owner, name }) {
|
|
488
|
+
const registerActual = useSceneActualResourceRegistrarV1();
|
|
489
|
+
const geometry = useRef2(null);
|
|
490
|
+
const observed = useRef2(null);
|
|
491
|
+
useLayoutEffect3(() => {
|
|
492
|
+
const current = geometry.current;
|
|
493
|
+
if (!current || observed.current === current) return;
|
|
494
|
+
observed.current = current;
|
|
495
|
+
const bytes = bufferBytes(current);
|
|
496
|
+
const release = registerActual(current, [
|
|
497
|
+
{ owner, name, domain: "gl", bytes, byteLength: bytes },
|
|
498
|
+
{ owner, name: `${name}-arrays`, domain: "cpu", bytes, byteLength: bytes }
|
|
499
|
+
]);
|
|
500
|
+
current.addEventListener("dispose", release);
|
|
501
|
+
}, [name, owner, registerActual]);
|
|
502
|
+
return /* @__PURE__ */ React.createElement("planeGeometry", { ref: geometry, args: [width, height] });
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// ../execution/animate/src/three/DeviceMesh.tsx
|
|
506
|
+
function deviceDimensions(kind, width) {
|
|
507
|
+
return sceneDeviceDimensionsV1(kind, width);
|
|
508
|
+
}
|
|
509
|
+
function laptopLayout(dim) {
|
|
510
|
+
return sceneLaptopLayoutV1(dim);
|
|
511
|
+
}
|
|
512
|
+
var DEVICE_GLASS_OPACITY_ENCODED = 0.1;
|
|
513
|
+
var DEVICE_GLASS_OPACITY_LINEAR = ((DEVICE_GLASS_OPACITY_ENCODED + 0.055) / 1.055) ** 2.4;
|
|
514
|
+
var DEVICE_LIT_MATERIALS = {
|
|
515
|
+
/** The phone's shell: `meshPhysicalMaterial`, the caller's finish. */
|
|
516
|
+
phoneShell: { ...SELF_TONE_MAPPED, metalness: 0.85, roughness: 0.32, clearcoat: 0.5, clearcoatRoughness: 0.2 },
|
|
517
|
+
/** The laptop's base and its lid, which take the same finish and the same material. */
|
|
518
|
+
laptopShell: { ...SELF_TONE_MAPPED, metalness: 0.85, roughness: 0.35, clearcoat: 0.4 },
|
|
519
|
+
/** The keyboard well on the laptop's base: `meshStandardMaterial`. */
|
|
520
|
+
keyboard: { ...SELF_TONE_MAPPED, color: "#111114", roughness: 0.9, metalness: 0.1 },
|
|
521
|
+
/** The trackpad in front of it: `meshStandardMaterial`. */
|
|
522
|
+
trackpad: { ...SELF_TONE_MAPPED, color: "#1a1a1f", roughness: 0.6, metalness: 0.3 },
|
|
523
|
+
/** The dark bezel behind the lid's screen: `meshStandardMaterial`. */
|
|
524
|
+
bezel: { ...SELF_TONE_MAPPED, color: "#050507", roughness: 0.5 },
|
|
525
|
+
/**
|
|
526
|
+
* The screen's glass sheen: `meshPhysicalMaterial`, default albedo, per-pipeline opacity.
|
|
527
|
+
*
|
|
528
|
+
* `envMapIntensity` is the one number in this table that does not reach a frame on its own —
|
|
529
|
+
* it needs `takeSceneEnvironment` on the mesh that draws it. See that function.
|
|
530
|
+
*/
|
|
531
|
+
glass: { ...SELF_TONE_MAPPED, transparent: true, roughness: 0.06, metalness: 0, envMapIntensity: 1.2 }
|
|
532
|
+
};
|
|
533
|
+
function takeSceneEnvironment(_renderer, scene, _camera, _geometry, material) {
|
|
534
|
+
const lit = material;
|
|
535
|
+
if (lit.envMap !== scene.environment) lit.envMap = scene.environment;
|
|
536
|
+
}
|
|
537
|
+
function lidRotationX(openAngle) {
|
|
538
|
+
return (90 - openAngle) * Math.PI / 180;
|
|
539
|
+
}
|
|
540
|
+
function roundedRectShape(w, h, radius) {
|
|
541
|
+
const r = Math.min(radius, w / 2, h / 2);
|
|
542
|
+
const x = w / 2;
|
|
543
|
+
const y = h / 2;
|
|
544
|
+
const shape = new Shape();
|
|
545
|
+
shape.moveTo(-x + r, -y);
|
|
546
|
+
shape.lineTo(x - r, -y);
|
|
547
|
+
shape.absarc(x - r, -y + r, r, -Math.PI / 2, 0, false);
|
|
548
|
+
shape.lineTo(x, y - r);
|
|
549
|
+
shape.absarc(x - r, y - r, r, 0, Math.PI / 2, false);
|
|
550
|
+
shape.lineTo(-x + r, y);
|
|
551
|
+
shape.absarc(-x + r, y - r, r, Math.PI / 2, Math.PI, false);
|
|
552
|
+
shape.lineTo(-x, -y + r);
|
|
553
|
+
shape.absarc(-x + r, -y + r, r, Math.PI, Math.PI * 1.5, false);
|
|
554
|
+
return shape;
|
|
555
|
+
}
|
|
556
|
+
function phoneShellGeometry(w, h, t, radius) {
|
|
557
|
+
const bevel = Math.min(t * 0.14, radius / 2, w / 4, h / 4);
|
|
558
|
+
const depth = t - bevel * 2;
|
|
559
|
+
const geometry = new ExtrudeGeometry(roundedRectShape(w - bevel * 2, h - bevel * 2, radius - bevel), {
|
|
560
|
+
depth,
|
|
561
|
+
bevelEnabled: true,
|
|
562
|
+
bevelThickness: bevel,
|
|
563
|
+
bevelSize: bevel,
|
|
564
|
+
bevelOffset: 0,
|
|
565
|
+
bevelSegments: 3,
|
|
566
|
+
curveSegments: 24
|
|
567
|
+
});
|
|
568
|
+
geometry.translate(0, 0, -depth / 2);
|
|
569
|
+
return geometry;
|
|
570
|
+
}
|
|
571
|
+
var DEVICE_PLANE_OFFSETS = {
|
|
572
|
+
/** The lid's dark bezel, behind the screenshot. */
|
|
573
|
+
bezel: 0.3,
|
|
574
|
+
/** The screenshot itself. */
|
|
575
|
+
screen: 0.6,
|
|
576
|
+
/** The glass sheen over it. */
|
|
577
|
+
glass: 1.2
|
|
578
|
+
};
|
|
579
|
+
function geometryBytes(geometry) {
|
|
580
|
+
let bytes = geometry.index?.array.byteLength ?? 0;
|
|
581
|
+
for (const attribute of Object.values(geometry.attributes)) bytes += attribute.array.byteLength;
|
|
582
|
+
return bytes;
|
|
583
|
+
}
|
|
584
|
+
function ownDeviceGeometryV1(geometry, owner, name, registerActual = registerActualSceneResourcesV1) {
|
|
585
|
+
const bytes = geometryBytes(geometry);
|
|
586
|
+
const release = registerActual(geometry, [
|
|
587
|
+
{ owner, name, domain: "gl", bytes, byteLength: bytes },
|
|
588
|
+
{ owner, name: `${name}-arrays`, domain: "cpu", bytes, byteLength: bytes }
|
|
589
|
+
]);
|
|
590
|
+
return () => {
|
|
591
|
+
geometry.dispose();
|
|
592
|
+
release();
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function useOwnedGeometry(geometry, owner, name, registerActual) {
|
|
596
|
+
useLayoutEffect4(() => {
|
|
597
|
+
if (!geometry) return;
|
|
598
|
+
return ownDeviceGeometryV1(geometry, owner, name, registerActual);
|
|
599
|
+
}, [geometry, owner, name, registerActual]);
|
|
600
|
+
}
|
|
601
|
+
function useShell(kind, w, h, t, r) {
|
|
602
|
+
return useMemo(
|
|
603
|
+
() => kind === "phone" ? phoneShellGeometry(w, h, t, r) : new RoundedBoxGeometry(w, h, t, 4, r),
|
|
604
|
+
[kind, w, h, t, r]
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
function materialProps(override) {
|
|
608
|
+
if (!override) return {};
|
|
609
|
+
const { role: _role, type: _type, ...props } = override;
|
|
610
|
+
return props;
|
|
611
|
+
}
|
|
612
|
+
function DeviceMesh({ kind, screen, screenColor, materialOverrides = {}, finish = "#2a2a30", glassOpacity = DEVICE_GLASS_OPACITY_ENCODED, openAngle = 100, width, position = [0, 0, 0], rotation = [0, 0, 0], resourceOwner = `device:${kind}:unscoped` }) {
|
|
613
|
+
const registerActual = useSceneActualResourceRegistrarV1();
|
|
614
|
+
const dim = deviceDimensions(kind, width ?? (kind === "phone" ? 380 : 1100));
|
|
615
|
+
const shell = useShell(kind, dim.w, dim.h, dim.t, dim.radius);
|
|
616
|
+
const base = useMemo(
|
|
617
|
+
() => kind === "laptop" ? new RoundedBoxGeometry(dim.w, dim.t, dim.d, 4, dim.radius) : null,
|
|
618
|
+
[kind, dim.w, dim.t, dim.d, dim.radius]
|
|
619
|
+
);
|
|
620
|
+
useOwnedGeometry(shell, resourceOwner, "shell-geometry", registerActual);
|
|
621
|
+
useOwnedGeometry(base, resourceOwner, "base-geometry", registerActual);
|
|
622
|
+
const screenW = dim.w - dim.screenInset * 2;
|
|
623
|
+
const screenH = dim.h - dim.screenInset * 2;
|
|
624
|
+
const screenPlane = /* @__PURE__ */ React.createElement("mesh", { position: [0, 0, dim.t / 2 + DEVICE_PLANE_OFFSETS.screen] }, /* @__PURE__ */ React.createElement(MeasuredPlaneGeometry, { width: screenW, height: screenH, owner: resourceOwner, name: "screen-geometry" }), screen ? /* @__PURE__ */ React.createElement("meshBasicMaterial", { map: screen, ...UNLIT_COLOUR_MANAGED, ...materialProps(materialOverrides.screen) }) : /* @__PURE__ */ React.createElement("meshBasicMaterial", { color: screenColor ?? "#000000", ...UNLIT_COLOUR_MANAGED, ...materialProps(materialOverrides.screen) }));
|
|
625
|
+
const glass = /* @__PURE__ */ React.createElement("mesh", { position: [0, 0, dim.t / 2 + DEVICE_PLANE_OFFSETS.glass], onBeforeRender: takeSceneEnvironment }, /* @__PURE__ */ React.createElement(MeasuredPlaneGeometry, { width: screenW, height: screenH, owner: resourceOwner, name: "glass-geometry" }), /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { ...DEVICE_LIT_MATERIALS.glass, opacity: glassOpacity, ...materialProps(materialOverrides.glass) }));
|
|
626
|
+
if (kind === "phone") {
|
|
627
|
+
return /* @__PURE__ */ React.createElement("group", { position, rotation }, /* @__PURE__ */ React.createElement("mesh", { geometry: shell, castShadow: true, receiveShadow: true }, /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { color: finish, ...DEVICE_LIT_MATERIALS.phoneShell, ...materialProps(materialOverrides.shell) })), screenPlane, glass);
|
|
628
|
+
}
|
|
629
|
+
const layout = laptopLayout(dim);
|
|
630
|
+
return /* @__PURE__ */ React.createElement("group", { position, rotation }, /* @__PURE__ */ React.createElement("group", { position: [0, layout.baseY, 0] }, /* @__PURE__ */ React.createElement("mesh", { geometry: base, position: [0, 0, 0], castShadow: true, receiveShadow: true }, /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { color: finish, ...DEVICE_LIT_MATERIALS.laptopShell, ...materialProps(materialOverrides.shell) })), /* @__PURE__ */ React.createElement("mesh", { position: [0, dim.t / 2 + 0.4, dim.d * 0.05], rotation: [-Math.PI / 2, 0, 0] }, /* @__PURE__ */ React.createElement(MeasuredPlaneGeometry, { width: dim.w * 0.86, height: dim.d * 0.42, owner: resourceOwner, name: "keyboard-geometry" }), /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { ...DEVICE_LIT_MATERIALS.keyboard, ...materialProps(materialOverrides.keyboard) })), /* @__PURE__ */ React.createElement("mesh", { position: [0, dim.t / 2 + 0.4, dim.d * 0.36], rotation: [-Math.PI / 2, 0, 0] }, /* @__PURE__ */ React.createElement(MeasuredPlaneGeometry, { width: dim.w * 0.3, height: dim.d * 0.18, owner: resourceOwner, name: "trackpad-geometry" }), /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { ...DEVICE_LIT_MATERIALS.trackpad, ...materialProps(materialOverrides.trackpad) })), /* @__PURE__ */ React.createElement("group", { position: [0, layout.hingeFromBaseY, layout.hingeZ], rotation: [lidRotationX(openAngle), 0, 0] }, /* @__PURE__ */ React.createElement("group", { position: [0, layout.lidCentreY, 0] }, /* @__PURE__ */ React.createElement("mesh", { geometry: shell, castShadow: true }, /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { color: finish, ...DEVICE_LIT_MATERIALS.laptopShell, ...materialProps(materialOverrides.shell) })), /* @__PURE__ */ React.createElement("mesh", { position: [0, 0, dim.t / 2 + DEVICE_PLANE_OFFSETS.bezel] }, /* @__PURE__ */ React.createElement(MeasuredPlaneGeometry, { width: dim.w - dim.screenInset * 0.6, height: dim.h - dim.screenInset * 0.6, owner: resourceOwner, name: "bezel-geometry" }), /* @__PURE__ */ React.createElement("meshPhysicalMaterial", { ...DEVICE_LIT_MATERIALS.bezel, ...materialProps(materialOverrides.bezel) })), screenPlane, glass))));
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// ../execution/animate/src/scene/v2/PhotographicStudioRig.tsx
|
|
634
|
+
import { useEffect, useRef as useRef3, useState as useState2 } from "react";
|
|
635
|
+
import { useThree as useThree2 } from "@react-three/fiber";
|
|
636
|
+
import { cancelRender, continueRender, delayRender, staticFile } from "remotion";
|
|
637
|
+
import {
|
|
638
|
+
EquirectangularReflectionMapping,
|
|
639
|
+
DataTexture,
|
|
640
|
+
HalfFloatType as HalfFloatType2,
|
|
641
|
+
LinearFilter,
|
|
642
|
+
LinearSRGBColorSpace,
|
|
643
|
+
PMREMGenerator as PMREMGenerator2,
|
|
644
|
+
RGBAFormat
|
|
645
|
+
} from "three";
|
|
646
|
+
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader.js";
|
|
647
|
+
var PhotographicStudioEnvironmentError = class extends Error {
|
|
648
|
+
code;
|
|
649
|
+
constructor(code, message) {
|
|
650
|
+
super(message);
|
|
651
|
+
this.name = "PhotographicStudioEnvironmentError";
|
|
652
|
+
this.code = code;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
var hex = (bytes) => Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
656
|
+
async function verifyPhotographicStudioHdr(bytes) {
|
|
657
|
+
const actual = hex(await globalThis.crypto.subtle.digest("SHA-256", Uint8Array.from(bytes)));
|
|
658
|
+
if (bytes.byteLength !== PHOTOGRAPHIC_STUDIO_HDRI_BYTES || actual !== PHOTOGRAPHIC_STUDIO_HDRI_SHA256) {
|
|
659
|
+
throw new PhotographicStudioEnvironmentError(
|
|
660
|
+
"scene_photographic_environment_digest_mismatch",
|
|
661
|
+
`photographic-studio-v1 HDRI identity mismatch: expected ${PHOTOGRAPHIC_STUDIO_HDRI_BYTES} bytes sha256 ${PHOTOGRAPHIC_STUDIO_HDRI_SHA256}, got ${bytes.byteLength} bytes sha256 ${actual}.`
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function FixedEnvironment() {
|
|
666
|
+
const registerActual = useSceneActualResourceRegistrarV1();
|
|
667
|
+
const gl = useThree2((state2) => state2.gl);
|
|
668
|
+
const scene = useThree2((state2) => state2.scene);
|
|
669
|
+
const advance = useThree2((state2) => state2.advance);
|
|
670
|
+
const [handle] = useState2(() => delayRender("scene: photographic-studio-v1 environment"));
|
|
671
|
+
const lifecycle = useRef3({ generation: 0, settled: false });
|
|
672
|
+
useEffect(() => {
|
|
673
|
+
const generation = ++lifecycle.current.generation;
|
|
674
|
+
const abort = new AbortController();
|
|
675
|
+
const previousEnvironment = scene.environment;
|
|
676
|
+
const previousIntensity = scene.environmentIntensity;
|
|
677
|
+
let active = true;
|
|
678
|
+
let target = null;
|
|
679
|
+
const settle = (error) => {
|
|
680
|
+
if (lifecycle.current.settled) return;
|
|
681
|
+
lifecycle.current.settled = true;
|
|
682
|
+
if (error) cancelRender(error);
|
|
683
|
+
else continueRender(handle);
|
|
684
|
+
};
|
|
685
|
+
void (async () => {
|
|
686
|
+
let hdr = null;
|
|
687
|
+
let pmrem = null;
|
|
688
|
+
try {
|
|
689
|
+
let response;
|
|
690
|
+
let bytes;
|
|
691
|
+
try {
|
|
692
|
+
response = await fetch(staticFile(PHOTOGRAPHIC_STUDIO_HDRI_PATH), { signal: abort.signal });
|
|
693
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
694
|
+
bytes = new Uint8Array(await response.arrayBuffer());
|
|
695
|
+
} catch (error) {
|
|
696
|
+
if (!active || abort.signal.aborted) return;
|
|
697
|
+
throw new PhotographicStudioEnvironmentError(
|
|
698
|
+
"scene_photographic_environment_fetch_failed",
|
|
699
|
+
`photographic-studio-v1 HDRI fetch failed: ${error instanceof Error ? error.message : String(error)}.`
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
await verifyPhotographicStudioHdr(bytes);
|
|
703
|
+
if (!active) return;
|
|
704
|
+
try {
|
|
705
|
+
const parsed = new RGBELoader().parse(Uint8Array.from(bytes).buffer);
|
|
706
|
+
hdr = new DataTexture(parsed.data, parsed.width, parsed.height, RGBAFormat, parsed.type);
|
|
707
|
+
hdr.colorSpace = LinearSRGBColorSpace;
|
|
708
|
+
hdr.minFilter = LinearFilter;
|
|
709
|
+
hdr.magFilter = LinearFilter;
|
|
710
|
+
hdr.generateMipmaps = false;
|
|
711
|
+
hdr.flipY = true;
|
|
712
|
+
hdr.mapping = EquirectangularReflectionMapping;
|
|
713
|
+
hdr.needsUpdate = true;
|
|
714
|
+
const releaseHdrMeasurement = registerActual(hdr, [
|
|
715
|
+
{
|
|
716
|
+
owner: "rig:photographic-studio-v1",
|
|
717
|
+
name: "decoded-hdri",
|
|
718
|
+
domain: "cpu",
|
|
719
|
+
bytes: parsed.data.byteLength,
|
|
720
|
+
width: parsed.width,
|
|
721
|
+
height: parsed.height,
|
|
722
|
+
byteLength: parsed.data.byteLength
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
owner: "rig:photographic-studio-v1",
|
|
726
|
+
name: "rgbe-source",
|
|
727
|
+
domain: "gl",
|
|
728
|
+
bytes: parsed.data.byteLength,
|
|
729
|
+
width: parsed.width,
|
|
730
|
+
height: parsed.height
|
|
731
|
+
}
|
|
732
|
+
]);
|
|
733
|
+
hdr.addEventListener("dispose", releaseHdrMeasurement);
|
|
734
|
+
pmrem = new PMREMGenerator2(gl);
|
|
735
|
+
target = withObservedPmremTargetsV1(gl, "rig:photographic-studio-v1", () => pmrem.fromEquirectangular(hdr), registerActual);
|
|
736
|
+
if (parsed.width !== 1024 || parsed.height !== 512 || parsed.type !== HalfFloatType2 || target.width !== 768 || target.height !== 1024 || target.texture.type !== HalfFloatType2 || target.texture.format !== RGBAFormat) {
|
|
737
|
+
throw new Error(`unexpected HDRI/PMREM allocation ${parsed.width}x${parsed.height}/${parsed.type} -> ${target.width}x${target.height}/${target.texture.type}/${target.texture.format}`);
|
|
738
|
+
}
|
|
739
|
+
} catch (error) {
|
|
740
|
+
throw new PhotographicStudioEnvironmentError(
|
|
741
|
+
"scene_photographic_environment_decode_failed",
|
|
742
|
+
`photographic-studio-v1 HDRI decode/PMREM failed: ${error instanceof Error ? error.message : String(error)}.`
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
if (!active) {
|
|
746
|
+
target.dispose();
|
|
747
|
+
target = null;
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
scene.environment = target.texture;
|
|
751
|
+
scene.environmentIntensity = PHOTOGRAPHIC_STUDIO_RIG_FACTS.environmentIntensity;
|
|
752
|
+
advance(performance.now());
|
|
753
|
+
settle();
|
|
754
|
+
} catch (error) {
|
|
755
|
+
if (!active || abort.signal.aborted) return;
|
|
756
|
+
else settle(error instanceof Error ? error : new Error(String(error)));
|
|
757
|
+
} finally {
|
|
758
|
+
hdr?.dispose();
|
|
759
|
+
pmrem?.dispose();
|
|
760
|
+
}
|
|
761
|
+
})();
|
|
762
|
+
return () => {
|
|
763
|
+
active = false;
|
|
764
|
+
abort.abort();
|
|
765
|
+
if (target) {
|
|
766
|
+
if (scene.environment === target.texture) {
|
|
767
|
+
scene.environment = previousEnvironment;
|
|
768
|
+
scene.environmentIntensity = previousIntensity;
|
|
769
|
+
}
|
|
770
|
+
target.dispose();
|
|
771
|
+
target = null;
|
|
772
|
+
}
|
|
773
|
+
queueMicrotask(() => {
|
|
774
|
+
if (lifecycle.current.generation === generation) settle();
|
|
775
|
+
});
|
|
776
|
+
};
|
|
777
|
+
}, [advance, gl, handle, scene, registerActual]);
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
function PhotographicStudioRig({ worldScale = 1 }) {
|
|
781
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FixedEnvironment, null), /* @__PURE__ */ React.createElement("hemisphereLight", { args: [
|
|
782
|
+
PHOTOGRAPHIC_STUDIO_RIG_FACTS.hemisphere.skyColor,
|
|
783
|
+
PHOTOGRAPHIC_STUDIO_RIG_FACTS.hemisphere.groundColor,
|
|
784
|
+
PHOTOGRAPHIC_STUDIO_RIG_FACTS.hemisphere.intensity
|
|
785
|
+
] }), PHOTOGRAPHIC_STUDIO_RIG_FACTS.studioLights.map((light) => /* @__PURE__ */ React.createElement(
|
|
786
|
+
"directionalLight",
|
|
787
|
+
{
|
|
788
|
+
key: light.role,
|
|
789
|
+
position: studioLightPosition({ role: light.role, position: [...light.position], castShadow: false }, worldScale),
|
|
790
|
+
intensity: light.intensity,
|
|
791
|
+
castShadow: false
|
|
792
|
+
}
|
|
793
|
+
)), PHOTOGRAPHIC_STUDIO_EDGE_LIGHTS.map(([x, y, z], index) => /* @__PURE__ */ React.createElement(
|
|
794
|
+
"directionalLight",
|
|
795
|
+
{
|
|
796
|
+
key: `photographic-edge-${index}`,
|
|
797
|
+
position: [x * worldScale, y * worldScale, z * worldScale],
|
|
798
|
+
intensity: PHOTOGRAPHIC_STUDIO_EDGE_INTENSITY,
|
|
799
|
+
castShadow: false
|
|
800
|
+
}
|
|
801
|
+
)));
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// ../execution/animate/src/scene/v2/finishes.ts
|
|
805
|
+
import {
|
|
806
|
+
DataTexture as DataTexture2,
|
|
807
|
+
FrontSide,
|
|
808
|
+
LinearMipmapLinearFilter,
|
|
809
|
+
MeshPhysicalMaterial,
|
|
810
|
+
NoColorSpace,
|
|
811
|
+
RGBAFormat as RGBAFormat2,
|
|
812
|
+
RepeatWrapping,
|
|
813
|
+
UnsignedByteType
|
|
814
|
+
} from "three";
|
|
815
|
+
var SLAB_FINISHES = ["satin", "brushed"];
|
|
816
|
+
function mulberry32(seed) {
|
|
817
|
+
let a = seed >>> 0;
|
|
818
|
+
return () => {
|
|
819
|
+
a = a + 1831565813 >>> 0;
|
|
820
|
+
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
821
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
822
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
var fade = (t) => t * t * (3 - 2 * t);
|
|
826
|
+
function lattice(w, h, rand) {
|
|
827
|
+
const a = new Float32Array(w * h);
|
|
828
|
+
for (let i = 0; i < a.length; i += 1) a[i] = rand() * 2 - 1;
|
|
829
|
+
return a;
|
|
830
|
+
}
|
|
831
|
+
function sampleLattice(a, w, h, u, v) {
|
|
832
|
+
const x = u * w;
|
|
833
|
+
const y = v * h;
|
|
834
|
+
const x0 = Math.floor(x);
|
|
835
|
+
const y0 = Math.floor(y);
|
|
836
|
+
const fx = fade(x - x0);
|
|
837
|
+
const fy = fade(y - y0);
|
|
838
|
+
const xa = (x0 % w + w) % w;
|
|
839
|
+
const xb = (xa + 1) % w;
|
|
840
|
+
const ya = (y0 % h + h) % h;
|
|
841
|
+
const yb = (ya + 1) % h;
|
|
842
|
+
const p00 = a[ya * w + xa];
|
|
843
|
+
const p10 = a[ya * w + xb];
|
|
844
|
+
const p01 = a[yb * w + xa];
|
|
845
|
+
const p11 = a[yb * w + xb];
|
|
846
|
+
return (p00 * (1 - fx) + p10 * fx) * (1 - fy) + (p01 * (1 - fx) + p11 * fx) * fy;
|
|
847
|
+
}
|
|
848
|
+
function fbm(octaves, seed) {
|
|
849
|
+
const rand = mulberry32(seed);
|
|
850
|
+
const layers = octaves.map((o) => ({ ...o, data: lattice(o.w, o.h, rand) }));
|
|
851
|
+
const norm = layers.reduce((s, l) => s + l.amp, 0);
|
|
852
|
+
return (u, v) => {
|
|
853
|
+
let s = 0;
|
|
854
|
+
for (const l of layers) s += l.amp * sampleLattice(l.data, l.w, l.h, u, v);
|
|
855
|
+
return s / norm;
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
function asFinishMap(tex, tilePx) {
|
|
859
|
+
tex.wrapS = RepeatWrapping;
|
|
860
|
+
tex.wrapT = RepeatWrapping;
|
|
861
|
+
tex.repeat.set(1 / tilePx, 1 / tilePx);
|
|
862
|
+
tex.generateMipmaps = true;
|
|
863
|
+
tex.minFilter = LinearMipmapLinearFilter;
|
|
864
|
+
tex.colorSpace = NoColorSpace;
|
|
865
|
+
tex.needsUpdate = true;
|
|
866
|
+
return tex;
|
|
867
|
+
}
|
|
868
|
+
function satinRoughnessMap(size, tilePx, amp, seed) {
|
|
869
|
+
const n = fbm([{ w: 8, h: 8, amp: 1 }, { w: 16, h: 16, amp: 0.5 }, { w: 32, h: 32, amp: 0.25 }], seed);
|
|
870
|
+
const data = new Uint8Array(size * size * 4);
|
|
871
|
+
for (let y = 0; y < size; y += 1) {
|
|
872
|
+
for (let x = 0; x < size; x += 1) {
|
|
873
|
+
const v = (1 + amp * n(x / size, y / size)) / (1 + amp);
|
|
874
|
+
const b = Math.max(0, Math.min(255, Math.round(v * 255)));
|
|
875
|
+
const i = (y * size + x) * 4;
|
|
876
|
+
data[i] = b;
|
|
877
|
+
data[i + 1] = b;
|
|
878
|
+
data[i + 2] = b;
|
|
879
|
+
data[i + 3] = 255;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return asFinishMap(new DataTexture2(data, size, size, RGBAFormat2, UnsignedByteType), tilePx);
|
|
883
|
+
}
|
|
884
|
+
var satinRoughnessScalar = (base, amp) => base * (1 + amp);
|
|
885
|
+
function normalFromHeight(size, tilePx, octaves, strength, seed) {
|
|
886
|
+
const n = fbm(octaves, seed);
|
|
887
|
+
const h = new Float32Array(size * size);
|
|
888
|
+
for (let y = 0; y < size; y += 1) for (let x = 0; x < size; x += 1) h[y * size + x] = n(x / size, y / size);
|
|
889
|
+
const at = (x, y) => h[(y % size + size) % size * size + (x % size + size) % size];
|
|
890
|
+
const data = new Uint8Array(size * size * 4);
|
|
891
|
+
for (let y = 0; y < size; y += 1) {
|
|
892
|
+
for (let x = 0; x < size; x += 1) {
|
|
893
|
+
const dx = (at(x + 1, y) - at(x - 1, y)) * 0.5 * strength;
|
|
894
|
+
const dy = (at(x, y + 1) - at(x, y - 1)) * 0.5 * strength;
|
|
895
|
+
const len = Math.hypot(-dx, -dy, 1);
|
|
896
|
+
const i = (y * size + x) * 4;
|
|
897
|
+
data[i] = Math.round((-dx / len * 0.5 + 0.5) * 255);
|
|
898
|
+
data[i + 1] = Math.round((-dy / len * 0.5 + 0.5) * 255);
|
|
899
|
+
data[i + 2] = Math.round((1 / len * 0.5 + 0.5) * 255);
|
|
900
|
+
data[i + 3] = 255;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return asFinishMap(new DataTexture2(data, size, size, RGBAFormat2, UnsignedByteType), tilePx);
|
|
904
|
+
}
|
|
905
|
+
var anodisedGrainNormal = (size, tilePx, seed) => normalFromHeight(size, tilePx, [{ w: 256, h: 256, amp: 1 }, { w: 512, h: 512, amp: 0.5 }], 1.2, seed);
|
|
906
|
+
var brushedNormal = (size, tilePx, seed) => normalFromHeight(size, tilePx, [{ w: 512, h: 6, amp: 1 }, { w: 1024, h: 12, amp: 0.4 }], 2.5, seed);
|
|
907
|
+
var SLAB_FINISH_SPEC = {
|
|
908
|
+
/** The W2 brushed defaults; satin overrides the original recipe's material fields below. */
|
|
909
|
+
common: {
|
|
910
|
+
clearcoat: 0.6,
|
|
911
|
+
clearcoatRoughness: 0.22,
|
|
912
|
+
/** Rule 2: declared here beside every map, so no map is silently multiplied by a stale scalar. */
|
|
913
|
+
metalness: 0,
|
|
914
|
+
mapSize: 2048
|
|
915
|
+
},
|
|
916
|
+
satin: {
|
|
917
|
+
/** The *base* roughness. The scalar three receives is `satinRoughnessScalar(base, amp)`. */
|
|
918
|
+
roughnessBase: 0.32,
|
|
919
|
+
roughnessAmp: 0.03,
|
|
920
|
+
roughnessTilePx: 1024,
|
|
921
|
+
roughnessSeed: 6221057,
|
|
922
|
+
roughnessMapSize: 512,
|
|
923
|
+
normalTilePx: 512,
|
|
924
|
+
normalSeed: 6221058,
|
|
925
|
+
normalMapSize: 512,
|
|
926
|
+
normalScale: 0.12,
|
|
927
|
+
metalness: 0.22,
|
|
928
|
+
clearcoat: 1,
|
|
929
|
+
clearcoatRoughness: 0.12,
|
|
930
|
+
envMapIntensity: 0.14
|
|
931
|
+
},
|
|
932
|
+
brushed: {
|
|
933
|
+
roughness: 0.28,
|
|
934
|
+
normalTilePx: 3,
|
|
935
|
+
normalSeed: 7,
|
|
936
|
+
/** Three's tangent/local-x is the slab's short axis, so rotate the BRDF onto long local-y. */
|
|
937
|
+
anisotropy: 0.65,
|
|
938
|
+
anisotropyRotation: Math.PI / 2,
|
|
939
|
+
clearcoatNormalTilePx: 9,
|
|
940
|
+
clearcoatNormalSeed: 13
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
function slabFinishMaterial(finish, baseColor, override, owner = "slab:unscoped", registerActual = registerActualSceneResourcesV1) {
|
|
944
|
+
const { common } = SLAB_FINISH_SPEC;
|
|
945
|
+
const material = new MeshPhysicalMaterial({
|
|
946
|
+
color: baseColor,
|
|
947
|
+
metalness: common.metalness,
|
|
948
|
+
clearcoat: common.clearcoat,
|
|
949
|
+
clearcoatRoughness: common.clearcoatRoughness,
|
|
950
|
+
side: FrontSide,
|
|
951
|
+
// The body is LIT and is drawn into the focus pass's half-float target, where three tone-maps
|
|
952
|
+
// nothing; this injection is what keeps its roll-off the same as on the canvas.
|
|
953
|
+
...SELF_TONE_MAPPED
|
|
954
|
+
});
|
|
955
|
+
if (finish === "satin") {
|
|
956
|
+
const s = SLAB_FINISH_SPEC.satin;
|
|
957
|
+
material.roughness = satinRoughnessScalar(s.roughnessBase, s.roughnessAmp);
|
|
958
|
+
material.roughnessMap = satinRoughnessMap(s.roughnessMapSize, s.roughnessTilePx, s.roughnessAmp, s.roughnessSeed);
|
|
959
|
+
material.normalMap = anodisedGrainNormal(s.normalMapSize, s.normalTilePx, s.normalSeed);
|
|
960
|
+
material.normalScale.setScalar(s.normalScale);
|
|
961
|
+
material.metalness = s.metalness;
|
|
962
|
+
material.clearcoat = s.clearcoat;
|
|
963
|
+
material.clearcoatRoughness = s.clearcoatRoughness;
|
|
964
|
+
material.envMapIntensity = s.envMapIntensity;
|
|
965
|
+
} else {
|
|
966
|
+
const b = SLAB_FINISH_SPEC.brushed;
|
|
967
|
+
material.roughness = b.roughness;
|
|
968
|
+
material.normalMap = brushedNormal(common.mapSize, b.normalTilePx, b.normalSeed);
|
|
969
|
+
material.anisotropy = b.anisotropy;
|
|
970
|
+
material.anisotropyRotation = b.anisotropyRotation;
|
|
971
|
+
material.clearcoatNormalMap = anodisedGrainNormal(common.mapSize, b.clearcoatNormalTilePx, b.clearcoatNormalSeed);
|
|
972
|
+
}
|
|
973
|
+
if (override) {
|
|
974
|
+
if (override.type !== "physical") throw new Error(`scene_material_type_mismatch: slab body requires physical material.`);
|
|
975
|
+
if (override.color !== void 0) material.color.set(override.color);
|
|
976
|
+
for (const key of ["roughness", "metalness", "clearcoat", "clearcoatRoughness", "anisotropy", "anisotropyRotation", "ior", "reflectivity"]) {
|
|
977
|
+
const value = override[key];
|
|
978
|
+
if (value !== void 0) material[key] = value;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
material.needsUpdate = true;
|
|
982
|
+
const maps = [material.roughnessMap, material.normalMap, material.clearcoatNormalMap].filter((map) => map instanceof DataTexture2);
|
|
983
|
+
const releaseMeasurement = registerActual(material, [
|
|
984
|
+
{ owner, name: `${finish}-finish-source-arrays`, domain: "cpu", bytes: maps.reduce((sum, map) => sum + (map.image.data?.byteLength ?? 0), 0) },
|
|
985
|
+
{ owner, name: `${finish}-finish-mip-chain`, domain: "gl", bytes: slabFinishDeclaredBytes(finish) }
|
|
986
|
+
]);
|
|
987
|
+
return {
|
|
988
|
+
material,
|
|
989
|
+
dispose() {
|
|
990
|
+
material.roughnessMap?.dispose();
|
|
991
|
+
material.normalMap?.dispose();
|
|
992
|
+
material.clearcoatNormalMap?.dispose();
|
|
993
|
+
material.dispose();
|
|
994
|
+
releaseMeasurement();
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
function slabFinishDeclaredBytes(finish) {
|
|
999
|
+
const sizes = finish === "satin" ? [SLAB_FINISH_SPEC.satin.roughnessMapSize, SLAB_FINISH_SPEC.satin.normalMapSize] : [SLAB_FINISH_SPEC.common.mapSize, SLAB_FINISH_SPEC.common.mapSize];
|
|
1000
|
+
let bytes = 0;
|
|
1001
|
+
for (const size of sizes) {
|
|
1002
|
+
let perMap = 0;
|
|
1003
|
+
for (let edge = size; edge >= 1; edge = Math.floor(edge / 2)) {
|
|
1004
|
+
perMap += edge * edge * 4;
|
|
1005
|
+
if (edge === 1) break;
|
|
1006
|
+
}
|
|
1007
|
+
bytes += perMap;
|
|
1008
|
+
}
|
|
1009
|
+
return bytes;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// ../execution/animate/src/scene/v2/slabGeometry.ts
|
|
1013
|
+
import { BufferAttribute, ExtrudeGeometry as ExtrudeGeometry2 } from "three";
|
|
1014
|
+
var SLAB_TESSELLATION_VERSION = 1;
|
|
1015
|
+
var SLAB_TESSELLATION = { curveSegments: 24, bevelSegments: 6 };
|
|
1016
|
+
var SLAB_BODY_TRIANGLES = SCENE_SLAB_BODY_TRIANGLES;
|
|
1017
|
+
var SLAB_CONTENT_FACE_TRIANGLES = SCENE_SLAB_CONTENT_FACE_TRIANGLES;
|
|
1018
|
+
var SLAB_TRIANGLES = SLAB_BODY_TRIANGLES + SLAB_CONTENT_FACE_TRIANGLES;
|
|
1019
|
+
var SCENE_MAX_TRIANGLES = 25e4;
|
|
1020
|
+
var SCENE_MAX_LAYERS = 32;
|
|
1021
|
+
var SLAB_DEFAULTS = {
|
|
1022
|
+
thickness: 32,
|
|
1023
|
+
cornerRadius: 32,
|
|
1024
|
+
edgeRadius: 15,
|
|
1025
|
+
finish: "satin",
|
|
1026
|
+
/** The flat dark base the two finishes are painted over; the specular is the whole performance. */
|
|
1027
|
+
baseColor: "#16161c"
|
|
1028
|
+
};
|
|
1029
|
+
function slabBodyGeometry(width, height, thickness, cornerRadius, edgeRadius) {
|
|
1030
|
+
const e = Math.min(edgeRadius, thickness / 2, cornerRadius, width / 4, height / 4);
|
|
1031
|
+
const depth = thickness - e * 2;
|
|
1032
|
+
const geometry = new ExtrudeGeometry2(roundedRectShape(width - e * 2, height - e * 2, cornerRadius - e), {
|
|
1033
|
+
depth,
|
|
1034
|
+
bevelEnabled: true,
|
|
1035
|
+
bevelThickness: e,
|
|
1036
|
+
bevelSize: e,
|
|
1037
|
+
bevelOffset: 0,
|
|
1038
|
+
bevelSegments: SLAB_TESSELLATION.bevelSegments,
|
|
1039
|
+
curveSegments: SLAB_TESSELLATION.curveSegments
|
|
1040
|
+
});
|
|
1041
|
+
geometry.translate(0, 0, -depth / 2);
|
|
1042
|
+
withNormalisedFaceUv(geometry, width, height);
|
|
1043
|
+
return geometry;
|
|
1044
|
+
}
|
|
1045
|
+
function slabTriangleCount(geometry) {
|
|
1046
|
+
const index = geometry.getIndex();
|
|
1047
|
+
const count = index ? index.count : geometry.getAttribute("position").count;
|
|
1048
|
+
return count / 3;
|
|
1049
|
+
}
|
|
1050
|
+
function slabTrianglesFor(slabCount) {
|
|
1051
|
+
return slabCount * SLAB_TRIANGLES;
|
|
1052
|
+
}
|
|
1053
|
+
function withNormalisedFaceUv(geometry, width, height) {
|
|
1054
|
+
const position = geometry.getAttribute("position");
|
|
1055
|
+
const normal = geometry.getAttribute("normal");
|
|
1056
|
+
geometry.computeBoundingBox();
|
|
1057
|
+
const box = geometry.boundingBox;
|
|
1058
|
+
const depth = box.max.z - box.min.z;
|
|
1059
|
+
const uv1 = new Float32Array(position.count * 2);
|
|
1060
|
+
for (let i = 0; i < position.count; i += 1) {
|
|
1061
|
+
const ax = Math.abs(normal.getX(i));
|
|
1062
|
+
const ay = Math.abs(normal.getY(i));
|
|
1063
|
+
const az = Math.abs(normal.getZ(i));
|
|
1064
|
+
if (az >= ax && az >= ay) {
|
|
1065
|
+
uv1[i * 2] = position.getX(i) / width + 0.5;
|
|
1066
|
+
uv1[i * 2 + 1] = 0.5 - position.getY(i) / height;
|
|
1067
|
+
} else if (ax >= ay) {
|
|
1068
|
+
uv1[i * 2] = (position.getZ(i) - box.min.z) / depth;
|
|
1069
|
+
uv1[i * 2 + 1] = 0.5 - position.getY(i) / height;
|
|
1070
|
+
} else {
|
|
1071
|
+
uv1[i * 2] = position.getX(i) / width + 0.5;
|
|
1072
|
+
uv1[i * 2 + 1] = (position.getZ(i) - box.min.z) / depth;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
geometry.setAttribute("uv1", new BufferAttribute(uv1, 2));
|
|
1076
|
+
return geometry;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// ../execution/animate/src/scene/v2/lighting.ts
|
|
1080
|
+
function admitSceneRigKind(value, path = "environment.kind") {
|
|
1081
|
+
if (value === void 0 || value === "studio") return "studio";
|
|
1082
|
+
if (value === PHOTOGRAPHIC_STUDIO_RIG_ID) return value;
|
|
1083
|
+
throw new SceneLightingRefusal(
|
|
1084
|
+
"scene_rig_unsupported",
|
|
1085
|
+
`${JSON.stringify(value)} is not a scene rig. Supported rigs are "studio" and "${PHOTOGRAPHIC_STUDIO_RIG_ID}".`,
|
|
1086
|
+
path,
|
|
1087
|
+
{ value, supported: ["studio", PHOTOGRAPHIC_STUDIO_RIG_ID] }
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
function admitSceneRigV2(rig, path = "environment") {
|
|
1091
|
+
if (typeof rig !== "object" || rig === null || Array.isArray(rig)) {
|
|
1092
|
+
throw new SceneLightingRefusal(
|
|
1093
|
+
"scene_rig_unsupported",
|
|
1094
|
+
"The scene environment must be a rig object.",
|
|
1095
|
+
path,
|
|
1096
|
+
{ value: rig, supported: ["studio", PHOTOGRAPHIC_STUDIO_RIG_ID] }
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
const record = rig;
|
|
1100
|
+
const kind = admitSceneRigKind(record.kind, `${path}.kind`);
|
|
1101
|
+
if (kind === PHOTOGRAPHIC_STUDIO_RIG_ID) {
|
|
1102
|
+
const unsupported = Object.keys(record).filter((key) => key !== "kind").sort();
|
|
1103
|
+
if (unsupported.length > 0) {
|
|
1104
|
+
const field = unsupported[0];
|
|
1105
|
+
throw new SceneLightingRefusal(
|
|
1106
|
+
"scene_photographic_rig_field_unsupported",
|
|
1107
|
+
`"${PHOTOGRAPHIC_STUDIO_RIG_ID}" is fixed and does not accept environment.${field}. Its HDRI, lights, intensity, PMREM and absent floor are versioned production facts.`,
|
|
1108
|
+
`${path}.${field}`,
|
|
1109
|
+
{ rigId: PHOTOGRAPHIC_STUDIO_RIG_ID, field, supported: ["kind"], unsupported }
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return kind;
|
|
1114
|
+
}
|
|
1115
|
+
var SceneLightingRefusal = class extends Error {
|
|
1116
|
+
code;
|
|
1117
|
+
path;
|
|
1118
|
+
detail;
|
|
1119
|
+
constructor(code, message, path, detail) {
|
|
1120
|
+
super(message);
|
|
1121
|
+
this.name = "SceneLightingRefusal";
|
|
1122
|
+
this.code = code;
|
|
1123
|
+
this.path = path;
|
|
1124
|
+
this.detail = detail;
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
function admitLightingProfile(value, path = "environment.lightingProfile") {
|
|
1128
|
+
if (value === void 0) return DEFAULT_LIGHTING_PROFILE;
|
|
1129
|
+
if (typeof value === "string" && LIGHTING_PROFILES.includes(value)) {
|
|
1130
|
+
return value;
|
|
1131
|
+
}
|
|
1132
|
+
throw new SceneLightingRefusal(
|
|
1133
|
+
"scene_lighting_profile_unsupported",
|
|
1134
|
+
`${JSON.stringify(value)} is not a lighting profile. The shot's rig offers exactly two: ${LIGHTING_PROFILES.map((p) => `"${p}"`).join(" and ")}. Arbitrary light authoring is outside first delivery.`,
|
|
1135
|
+
path,
|
|
1136
|
+
{ value, supported: [...LIGHTING_PROFILES] }
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
var SCENE_OBJECT_LIGHT_FIELDS = [
|
|
1140
|
+
"light",
|
|
1141
|
+
"lights",
|
|
1142
|
+
"lighting",
|
|
1143
|
+
"lightingProfile",
|
|
1144
|
+
"intensity",
|
|
1145
|
+
"lightIntensity",
|
|
1146
|
+
"lightPosition",
|
|
1147
|
+
"lightColor",
|
|
1148
|
+
"lightColour",
|
|
1149
|
+
"slabEdgeLighting",
|
|
1150
|
+
"slabEdgeBoost",
|
|
1151
|
+
"slabSideLighting",
|
|
1152
|
+
"slabSideIntensity",
|
|
1153
|
+
"edgeLight",
|
|
1154
|
+
"edgeLighting",
|
|
1155
|
+
"rimLight",
|
|
1156
|
+
"castShadow",
|
|
1157
|
+
"shadowOpacity"
|
|
1158
|
+
];
|
|
1159
|
+
function assertNoObjectLightField(node, layerPath) {
|
|
1160
|
+
for (const field of SCENE_OBJECT_LIGHT_FIELDS) {
|
|
1161
|
+
if (!Object.prototype.hasOwnProperty.call(node, field)) continue;
|
|
1162
|
+
throw new SceneLightingRefusal(
|
|
1163
|
+
"scene_object_light_field_unsupported",
|
|
1164
|
+
`"${field}" is a light on an object, and no object carries a light. Lighting is a property of the SHOT: set environment.lightingProfile to ${LIGHTING_PROFILES.map((p) => `"${p}"`).join(" or ")}. Adding or removing objects never changes the shot's light count.`,
|
|
1165
|
+
`${layerPath}.${field}`,
|
|
1166
|
+
{ field, supported: [...LIGHTING_PROFILES] }
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
var SCENE_ENVIRONMENT_VERSION = 1;
|
|
1171
|
+
function sceneRigIdentityV2(rig, worldScale, shadowBounds) {
|
|
1172
|
+
const kind = admitSceneRigV2(rig);
|
|
1173
|
+
if (kind === PHOTOGRAPHIC_STUDIO_RIG_ID) {
|
|
1174
|
+
return {
|
|
1175
|
+
rigId: PHOTOGRAPHIC_STUDIO_RIG_ID,
|
|
1176
|
+
hdriSha256: PHOTOGRAPHIC_STUDIO_RIG_FACTS.hdri.sha256,
|
|
1177
|
+
pmremVersion: PHOTOGRAPHIC_STUDIO_RIG_FACTS.pmremVersion,
|
|
1178
|
+
lightingVersion: PHOTOGRAPHIC_STUDIO_RIG_FACTS.lightingVersion,
|
|
1179
|
+
worldScale,
|
|
1180
|
+
lightLayout: PHOTOGRAPHIC_STUDIO_RIG_FACTS.studioLights,
|
|
1181
|
+
edgeLightLayout: PHOTOGRAPHIC_STUDIO_RIG_FACTS.edgeLights,
|
|
1182
|
+
environmentIntensity: PHOTOGRAPHIC_STUDIO_RIG_FACTS.environmentIntensity,
|
|
1183
|
+
floor: "none",
|
|
1184
|
+
shadows: "none",
|
|
1185
|
+
retainedGpuBytes: PHOTOGRAPHIC_STUDIO_GPU_BYTES.retained,
|
|
1186
|
+
preparationPeakGpuBytes: PHOTOGRAPHIC_STUDIO_GPU_BYTES.preparationPeak
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
const studio = rig;
|
|
1190
|
+
return {
|
|
1191
|
+
lightingProfile: studio.lightingProfile ?? DEFAULT_LIGHTING_PROFILE,
|
|
1192
|
+
preset: studio.preset,
|
|
1193
|
+
intensity: studio.intensity,
|
|
1194
|
+
floorY: studio.floorY,
|
|
1195
|
+
shadowOpacity: studio.shadowOpacity,
|
|
1196
|
+
shadowMapEdge: studioShadowFrustum(worldScale, shadowBounds, studio.floorY).mapSize,
|
|
1197
|
+
environmentVersion: SCENE_ENVIRONMENT_VERSION
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function lightingProfileDeclaredBytes(_profile) {
|
|
1201
|
+
return 0;
|
|
1202
|
+
}
|
|
1203
|
+
function sceneLightCount(profile, objectCount) {
|
|
1204
|
+
void objectCount;
|
|
1205
|
+
return 3 + studioEdgeLightCount(profile);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// ../execution/animate/src/scene/v2/preparationFacts.ts
|
|
1209
|
+
import { PlaneGeometry } from "three";
|
|
1210
|
+
import { RoundedBoxGeometry as RoundedBoxGeometry2 } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
|
|
1211
|
+
function sceneSlabPreparationFactsV1(slab) {
|
|
1212
|
+
const geometry = slabBodyGeometry(
|
|
1213
|
+
slab.width,
|
|
1214
|
+
slab.height,
|
|
1215
|
+
slab.thickness,
|
|
1216
|
+
slab.cornerRadius,
|
|
1217
|
+
slab.edgeRadius
|
|
1218
|
+
);
|
|
1219
|
+
try {
|
|
1220
|
+
const geometryBytes2 = Object.values(geometry.attributes).reduce((sum, attribute) => sum + attribute.array.byteLength, 0) + (geometry.index?.array.byteLength ?? 0);
|
|
1221
|
+
let frontBytes = 0;
|
|
1222
|
+
if (slab.surfaces?.front) {
|
|
1223
|
+
const front = new PlaneGeometry(slab.width, slab.height);
|
|
1224
|
+
try {
|
|
1225
|
+
frontBytes = Object.values(front.attributes).reduce((sum, attribute) => sum + attribute.array.byteLength, 0) + (front.index?.array.byteLength ?? 0);
|
|
1226
|
+
} finally {
|
|
1227
|
+
front.dispose();
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
const mapSize = slab.finish === "satin" ? SLAB_FINISH_SPEC.satin.roughnessMapSize : SLAB_FINISH_SPEC.common.mapSize;
|
|
1231
|
+
const finishCpuBytes = 2 * mapSize * mapSize * 4;
|
|
1232
|
+
return {
|
|
1233
|
+
bodyTriangles: slabTriangleCount(geometry),
|
|
1234
|
+
allocations: [
|
|
1235
|
+
{
|
|
1236
|
+
owner: `slab:${slab.id}`,
|
|
1237
|
+
name: "body-geometry",
|
|
1238
|
+
domain: "gl",
|
|
1239
|
+
resource: "geometry",
|
|
1240
|
+
format: "three-buffer-attributes-and-index",
|
|
1241
|
+
bytes: geometryBytes2,
|
|
1242
|
+
lifetime: "context"
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
owner: `slab:${slab.id}`,
|
|
1246
|
+
name: "body-geometry-arrays",
|
|
1247
|
+
domain: "cpu",
|
|
1248
|
+
resource: "geometry",
|
|
1249
|
+
format: "three-typed-arrays",
|
|
1250
|
+
bytes: geometryBytes2,
|
|
1251
|
+
lifetime: "context"
|
|
1252
|
+
},
|
|
1253
|
+
...frontBytes > 0 ? [
|
|
1254
|
+
{
|
|
1255
|
+
owner: `slab:${slab.id}`,
|
|
1256
|
+
name: "front-geometry",
|
|
1257
|
+
domain: "gl",
|
|
1258
|
+
resource: "geometry",
|
|
1259
|
+
format: "three-buffer-attributes-and-index",
|
|
1260
|
+
bytes: frontBytes,
|
|
1261
|
+
lifetime: "context"
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
owner: `slab:${slab.id}`,
|
|
1265
|
+
name: "front-geometry-arrays",
|
|
1266
|
+
domain: "cpu",
|
|
1267
|
+
resource: "geometry",
|
|
1268
|
+
format: "three-typed-arrays",
|
|
1269
|
+
bytes: frontBytes,
|
|
1270
|
+
lifetime: "context"
|
|
1271
|
+
}
|
|
1272
|
+
] : [],
|
|
1273
|
+
{
|
|
1274
|
+
owner: `slab:${slab.id}`,
|
|
1275
|
+
name: `${slab.finish}-finish-source-arrays`,
|
|
1276
|
+
domain: "cpu",
|
|
1277
|
+
resource: "decoded-image",
|
|
1278
|
+
format: "rgba8",
|
|
1279
|
+
bytes: finishCpuBytes,
|
|
1280
|
+
lifetime: "context"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
owner: `slab:${slab.id}`,
|
|
1284
|
+
name: `${slab.finish}-finish-mip-chain`,
|
|
1285
|
+
domain: "gl",
|
|
1286
|
+
resource: "texture",
|
|
1287
|
+
format: "rgba8-mip-chain",
|
|
1288
|
+
bytes: slabFinishDeclaredBytes(slab.finish),
|
|
1289
|
+
lifetime: "context"
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
};
|
|
1293
|
+
} finally {
|
|
1294
|
+
geometry.dispose();
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
function sceneGrainPreparationAllocationV1() {
|
|
1298
|
+
return sceneFocusPreparationAllocationsV1(1, 1, 4)[3];
|
|
1299
|
+
}
|
|
1300
|
+
function sceneGrainPreparationCpuAllocationV1() {
|
|
1301
|
+
return sceneFocusPreparationAllocationsV1(1, 1, 4)[4];
|
|
1302
|
+
}
|
|
1303
|
+
function generatedStudioPreparationFactsV1(rig, worldScale, bounds, width, height) {
|
|
1304
|
+
const edge = studioShadowFrustum(worldScale, bounds, rig.floorY * worldScale).mapSize;
|
|
1305
|
+
return { identity: sceneRigIdentityV2(rig, worldScale, bounds), allocations: sceneW5GeneratedRigAllocationsV1(edge, width, height) };
|
|
1306
|
+
}
|
|
1307
|
+
function assertCanonicalAllocations(actual, expected, kind) {
|
|
1308
|
+
if (JSON.stringify(actual) !== JSON.stringify(expected)) throw new Error(`scene_builder_allocation_measurement_mismatch: ${kind}`);
|
|
1309
|
+
}
|
|
1310
|
+
function geometryFacts(owner, name, geometry) {
|
|
1311
|
+
const bytes = Object.values(geometry.attributes).reduce((sum, attribute) => sum + attribute.array.byteLength, 0) + (geometry.index?.array.byteLength ?? 0);
|
|
1312
|
+
const triangles = geometry.index ? geometry.index.count / 3 : geometry.attributes.position.count / 3;
|
|
1313
|
+
return { triangles, allocations: [
|
|
1314
|
+
{ owner, name, domain: "gl", resource: "geometry", format: "three-buffer-attributes-and-index", bytes, lifetime: "context" },
|
|
1315
|
+
{ owner, name: `${name}-arrays`, domain: "cpu", resource: "geometry", format: "three-typed-arrays", bytes, lifetime: "context" }
|
|
1316
|
+
] };
|
|
1317
|
+
}
|
|
1318
|
+
function planeFacts(owner, name) {
|
|
1319
|
+
const geometry = new PlaneGeometry(1, 1);
|
|
1320
|
+
try {
|
|
1321
|
+
return geometryFacts(owner, name, geometry);
|
|
1322
|
+
} finally {
|
|
1323
|
+
geometry.dispose();
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
function scenePresetBuilderDescriptorV1(object, context) {
|
|
1327
|
+
if (object.kind === "text") {
|
|
1328
|
+
if (!context) throw new Error(`scene_builder_descriptor_context_missing: ${object.id}`);
|
|
1329
|
+
const width = object.maxWidth ?? context.referenceSize.width;
|
|
1330
|
+
const height = object.lines.length * object.fontSize * object.lineHeight;
|
|
1331
|
+
const scale = context.output.width / context.referenceSize.width;
|
|
1332
|
+
const rasterWidth = Math.max(1, Math.ceil(width * scale));
|
|
1333
|
+
const rasterHeight = Math.max(1, Math.ceil(height * scale));
|
|
1334
|
+
const cpu = rasterWidth * rasterHeight * 4;
|
|
1335
|
+
let gl = 0;
|
|
1336
|
+
for (let w = rasterWidth, h = rasterHeight; ; w = Math.max(1, Math.floor(w / 2)), h = Math.max(1, Math.floor(h / 2))) {
|
|
1337
|
+
gl += w * h * 4;
|
|
1338
|
+
if (w === 1 && h === 1) break;
|
|
1339
|
+
}
|
|
1340
|
+
const plane = planeFacts(`text:${object.id}`, "plane-geometry");
|
|
1341
|
+
const allocations = [...plane.allocations, { owner: `text:${object.id}`, name: "raster-canvas", domain: "cpu", resource: "decoded-image", format: "rgba8", bytes: cpu, lifetime: "context" }, { owner: `text:${object.id}`, name: "raster-mip-chain", domain: "gl", resource: "texture", format: "rgba8-mip-chain", bytes: gl, lifetime: "context" }];
|
|
1342
|
+
assertCanonicalAllocations(allocations, sceneW5WorldTextAllocationsV1(object, context.referenceSize.width, context.output.width), "text");
|
|
1343
|
+
return { kind: "text", builderVersion: 1, tessellationVersion: 1, budgetTriangles: 2, parts: [{ partId: "quad", materialRole: "glyphs", triangles: 2, mounted: true }], surfaceSlots: [], materialRoles: ["glyphs"], localBounds: { center: [0, 0, 0], halfExtents: [width / 2, height / 2, 0] }, allocations };
|
|
1344
|
+
}
|
|
1345
|
+
if (object.kind === "slab") {
|
|
1346
|
+
const facts = sceneSlabPreparationFactsV1(object);
|
|
1347
|
+
const z = object.thickness / 2 + 0.6;
|
|
1348
|
+
return {
|
|
1349
|
+
kind: "slab",
|
|
1350
|
+
builderVersion: 1,
|
|
1351
|
+
tessellationVersion: 1,
|
|
1352
|
+
budgetTriangles: SCENE_PRESET_TRIANGLES.slab,
|
|
1353
|
+
parts: [{ partId: "body", materialRole: "body", triangles: facts.bodyTriangles, mounted: true }, { partId: "front", materialRole: "face", triangles: 2, mounted: !!object.surfaces?.front }],
|
|
1354
|
+
surfaceSlots: [{ slot: "front", attachment: { partId: "front", materialRole: "face" }, dimensions: { width: object.width, height: object.height }, projectionQuad: [[-object.width / 2, object.height / 2, z], [object.width / 2, object.height / 2, z], [object.width / 2, -object.height / 2, z], [-object.width / 2, -object.height / 2, z]], uvOrigin: "top-left", fit: "contain", alpha: "straight", depth: "test-only", required: false, bakeScales: [2, 3] }],
|
|
1355
|
+
materialRoles: ["body", "face"],
|
|
1356
|
+
localBounds: { center: [0, 0, 0], halfExtents: [object.width / 2, object.height / 2, object.thickness / 2] },
|
|
1357
|
+
allocations: facts.allocations
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
if (object.kind === "page") {
|
|
1361
|
+
const face = planeFacts(`page:${object.id}`, "content-geometry");
|
|
1362
|
+
return {
|
|
1363
|
+
kind: "page",
|
|
1364
|
+
builderVersion: 1,
|
|
1365
|
+
tessellationVersion: 1,
|
|
1366
|
+
budgetTriangles: SCENE_PRESET_TRIANGLES.page,
|
|
1367
|
+
parts: [{ partId: "base", materialRole: "base", triangles: face.triangles, mounted: true }],
|
|
1368
|
+
surfaceSlots: [{ slot: "content", attachment: { partId: "base", materialRole: "base" }, dimensions: { width: object.width, height: object.height }, projectionQuad: [[-object.width / 2, object.height / 2, 0], [object.width / 2, object.height / 2, 0], [object.width / 2, -object.height / 2, 0], [-object.width / 2, -object.height / 2, 0]], uvOrigin: "top-left", fit: object.fit, alpha: object.transparency, depth: object.depthWrite ? "write" : "test-only", required: true, bakeScales: [2, 3] }],
|
|
1369
|
+
materialRoles: ["base"],
|
|
1370
|
+
localBounds: { center: [0, 0, 0], halfExtents: [object.width / 2, object.height / 2, 0] },
|
|
1371
|
+
allocations: face.allocations
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
const kind = object.kind;
|
|
1375
|
+
const dim = deviceDimensions(kind, object.width);
|
|
1376
|
+
const owner = `${kind}:${object.id}`;
|
|
1377
|
+
const shellGeometry = kind === "phone" ? phoneShellGeometry(dim.w, dim.h, dim.t, dim.radius) : new RoundedBoxGeometry2(dim.w, dim.h, dim.t, 4, dim.radius);
|
|
1378
|
+
const baseGeometry = new RoundedBoxGeometry2(dim.w, dim.t, dim.d, 4, dim.radius);
|
|
1379
|
+
try {
|
|
1380
|
+
const shell = geometryFacts(owner, "shell-geometry", shellGeometry);
|
|
1381
|
+
const base = kind === "laptop" ? geometryFacts(owner, "base-geometry", baseGeometry) : null;
|
|
1382
|
+
const planes = (kind === "phone" ? ["screen", "glass"] : ["keyboard", "trackpad", "bezel", "screen", "glass"]).flatMap((name) => planeFacts(owner, `${name}-geometry`).allocations);
|
|
1383
|
+
if (kind === "phone") {
|
|
1384
|
+
const allocations2 = [...shell.allocations, ...planes];
|
|
1385
|
+
assertCanonicalAllocations(allocations2, sceneW5PresetAllocationsV1(object), "phone");
|
|
1386
|
+
return { kind, builderVersion: 1, tessellationVersion: 1, budgetTriangles: SCENE_PRESET_TRIANGLES.phone, parts: [{ partId: "shell", materialRole: "shell", triangles: shell.triangles, mounted: true }, { partId: "screen", materialRole: "screen", triangles: 2, mounted: true }, { partId: "glass", materialRole: "glass", triangles: 2, mounted: true }], surfaceSlots: [{ slot: "screen", attachment: { partId: "screen", materialRole: "screen" }, dimensions: { width: dim.w - 2 * dim.screenInset, height: dim.h - 2 * dim.screenInset }, projectionQuad: [[-(dim.w - 2 * dim.screenInset) / 2, (dim.h - 2 * dim.screenInset) / 2, dim.t / 2 + DEVICE_PLANE_OFFSETS.screen], [(dim.w - 2 * dim.screenInset) / 2, (dim.h - 2 * dim.screenInset) / 2, dim.t / 2 + DEVICE_PLANE_OFFSETS.screen], [(dim.w - 2 * dim.screenInset) / 2, -(dim.h - 2 * dim.screenInset) / 2, dim.t / 2 + DEVICE_PLANE_OFFSETS.screen], [-(dim.w - 2 * dim.screenInset) / 2, -(dim.h - 2 * dim.screenInset) / 2, dim.t / 2 + DEVICE_PLANE_OFFSETS.screen]], uvOrigin: "top-left", fit: "contain", alpha: "straight", depth: "test-only", required: false, bakeScales: [2, 3] }], materialRoles: ["shell", "screen", "glass"], localBounds: { center: [0, 0, 0], halfExtents: [dim.w / 2, dim.h / 2, dim.t / 2 + DEVICE_PLANE_OFFSETS.glass] }, allocations: allocations2 };
|
|
1387
|
+
}
|
|
1388
|
+
const quad = sceneLaptopScreenQuadV1(object);
|
|
1389
|
+
const layout = laptopLayout(dim);
|
|
1390
|
+
const ys = [layout.bottomY, ...quad.map((p) => p[1])], zs = [-dim.d / 2, dim.d / 2, ...quad.map((p) => p[2])];
|
|
1391
|
+
const allocations = [...shell.allocations, ...base.allocations, ...planes];
|
|
1392
|
+
assertCanonicalAllocations(allocations, sceneW5PresetAllocationsV1(object), "laptop");
|
|
1393
|
+
return { kind, builderVersion: 1, tessellationVersion: 1, budgetTriangles: SCENE_PRESET_TRIANGLES.laptop, parts: [{ partId: "base", materialRole: "shell", triangles: base.triangles, mounted: true }, { partId: "lid", materialRole: "shell", triangles: shell.triangles, mounted: true }, { partId: "keyboard", materialRole: "keyboard", triangles: 2, mounted: true }, { partId: "trackpad", materialRole: "trackpad", triangles: 2, mounted: true }, { partId: "bezel", materialRole: "bezel", triangles: 2, mounted: true }, { partId: "screen", materialRole: "screen", triangles: 2, mounted: true }, { partId: "glass", materialRole: "glass", triangles: 2, mounted: true }], surfaceSlots: [{ slot: "screen", attachment: { partId: "screen", materialRole: "screen" }, dimensions: { width: dim.w * 0.86, height: dim.h * 0.86 }, projectionQuad: quad, uvOrigin: "top-left", fit: "contain", alpha: "straight", depth: "test-only", required: false, bakeScales: [2, 3] }], materialRoles: ["shell", "keyboard", "trackpad", "bezel", "screen", "glass"], localBounds: { center: [0, (Math.max(...ys) + Math.min(...ys)) / 2, (Math.max(...zs) + Math.min(...zs)) / 2], halfExtents: [dim.w / 2, (Math.max(...ys) - Math.min(...ys)) / 2, (Math.max(...zs) - Math.min(...zs)) / 2] }, allocations };
|
|
1394
|
+
} finally {
|
|
1395
|
+
shellGeometry.dispose();
|
|
1396
|
+
baseGeometry.dispose();
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
export {
|
|
1401
|
+
SELF_TONE_MAPPED,
|
|
1402
|
+
UNLIT_COLOUR_MANAGED,
|
|
1403
|
+
useSceneActualResourceRegistrarV1,
|
|
1404
|
+
SceneRuntimeAllocationBoundaryV1,
|
|
1405
|
+
sceneRuntimeAllocationSnapshotV1,
|
|
1406
|
+
resetSceneRuntimeAllocationCountersV1,
|
|
1407
|
+
registerActualSceneResourcesV1,
|
|
1408
|
+
acquireSceneRuntimeAllocationV1,
|
|
1409
|
+
DEFAULT_LIGHTING_PROFILE,
|
|
1410
|
+
LIGHTING_PROFILES,
|
|
1411
|
+
STUDIO_EDGE_LIGHTS,
|
|
1412
|
+
STUDIO_EDGE_INTENSITY,
|
|
1413
|
+
studioEdgeLightCount,
|
|
1414
|
+
studioShadowFrustum,
|
|
1415
|
+
StudioRig,
|
|
1416
|
+
MeasuredPlaneGeometry,
|
|
1417
|
+
deviceDimensions,
|
|
1418
|
+
laptopLayout,
|
|
1419
|
+
DEVICE_GLASS_OPACITY_ENCODED,
|
|
1420
|
+
DEVICE_GLASS_OPACITY_LINEAR,
|
|
1421
|
+
DEVICE_LIT_MATERIALS,
|
|
1422
|
+
takeSceneEnvironment,
|
|
1423
|
+
lidRotationX,
|
|
1424
|
+
DEVICE_PLANE_OFFSETS,
|
|
1425
|
+
DeviceMesh,
|
|
1426
|
+
PhotographicStudioEnvironmentError,
|
|
1427
|
+
verifyPhotographicStudioHdr,
|
|
1428
|
+
PhotographicStudioRig,
|
|
1429
|
+
SLAB_FINISHES,
|
|
1430
|
+
satinRoughnessMap,
|
|
1431
|
+
satinRoughnessScalar,
|
|
1432
|
+
anodisedGrainNormal,
|
|
1433
|
+
brushedNormal,
|
|
1434
|
+
SLAB_FINISH_SPEC,
|
|
1435
|
+
slabFinishMaterial,
|
|
1436
|
+
slabFinishDeclaredBytes,
|
|
1437
|
+
SLAB_TESSELLATION_VERSION,
|
|
1438
|
+
SLAB_TESSELLATION,
|
|
1439
|
+
SLAB_TRIANGLES,
|
|
1440
|
+
SCENE_MAX_TRIANGLES,
|
|
1441
|
+
SCENE_MAX_LAYERS,
|
|
1442
|
+
SLAB_DEFAULTS,
|
|
1443
|
+
slabBodyGeometry,
|
|
1444
|
+
slabTriangleCount,
|
|
1445
|
+
slabTrianglesFor,
|
|
1446
|
+
withNormalisedFaceUv,
|
|
1447
|
+
admitSceneRigKind,
|
|
1448
|
+
admitSceneRigV2,
|
|
1449
|
+
SceneLightingRefusal,
|
|
1450
|
+
admitLightingProfile,
|
|
1451
|
+
SCENE_OBJECT_LIGHT_FIELDS,
|
|
1452
|
+
assertNoObjectLightField,
|
|
1453
|
+
SCENE_ENVIRONMENT_VERSION,
|
|
1454
|
+
sceneRigIdentityV2,
|
|
1455
|
+
lightingProfileDeclaredBytes,
|
|
1456
|
+
sceneLightCount,
|
|
1457
|
+
sceneSlabPreparationFactsV1,
|
|
1458
|
+
sceneGrainPreparationAllocationV1,
|
|
1459
|
+
sceneGrainPreparationCpuAllocationV1,
|
|
1460
|
+
generatedStudioPreparationFactsV1,
|
|
1461
|
+
scenePresetBuilderDescriptorV1
|
|
1462
|
+
};
|