@react-three/fiber 10.0.0-canary.ce4bd5f → 10.0.0-canary.d91831d
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/index.cjs +43 -42
- package/dist/index.d.cts +249 -138
- package/dist/index.d.mts +249 -138
- package/dist/index.d.ts +249 -166
- package/dist/index.mjs +43 -42
- package/dist/legacy.cjs +42 -40
- package/dist/legacy.d.cts +253 -142
- package/dist/legacy.d.mts +253 -142
- package/dist/legacy.d.ts +253 -168
- package/dist/legacy.mjs +42 -40
- package/dist/webgpu/index.cjs +113 -112
- package/dist/webgpu/index.d.cts +309 -201
- package/dist/webgpu/index.d.mts +309 -201
- package/dist/webgpu/index.d.ts +309 -229
- package/dist/webgpu/index.mjs +113 -112
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ export { Scheduler, getScheduler } from '@pmndrs/scheduler';
|
|
|
12
12
|
import Tb, { unstable_getCurrentPriorityLevel, unstable_IdlePriority, unstable_LowPriority, unstable_NormalPriority, unstable_UserBlockingPriority, unstable_ImmediatePriority, unstable_scheduleCallback } from 'scheduler';
|
|
13
13
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
14
14
|
import { HDRLoader } from 'three/examples/jsm/loaders/HDRLoader.js';
|
|
15
|
+
import { HDRCubeTextureLoader } from 'three/examples/jsm/loaders/HDRCubeTextureLoader.js';
|
|
15
16
|
import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader.js';
|
|
16
17
|
import { UltraHDRLoader } from 'three/examples/jsm/loaders/UltraHDRLoader.js';
|
|
17
18
|
import { GainMapLoader } from '@monogrid/gainmap-js';
|
|
@@ -509,8 +510,10 @@ function hasVisibilityHandlers(handlers) {
|
|
|
509
510
|
}
|
|
510
511
|
|
|
511
512
|
const FROM_REF = Symbol.for("@react-three/fiber.fromRef");
|
|
512
|
-
function fromRef(ref) {
|
|
513
|
-
|
|
513
|
+
function fromRef(ref, transform) {
|
|
514
|
+
const marker = { [FROM_REF]: ref };
|
|
515
|
+
if (transform) marker.transform = transform;
|
|
516
|
+
return marker;
|
|
514
517
|
}
|
|
515
518
|
function isFromRef(value) {
|
|
516
519
|
return value !== null && typeof value === "object" && FROM_REF in value;
|
|
@@ -611,11 +614,9 @@ function diffProps(instance, newProps) {
|
|
|
611
614
|
for (const prop in instance.props) {
|
|
612
615
|
if (RESERVED_PROPS.includes(prop) || newProps.hasOwnProperty(prop)) continue;
|
|
613
616
|
const { root, key } = resolve(instance.object, prop);
|
|
614
|
-
if (
|
|
617
|
+
if (typeof root?.constructor === "function") {
|
|
615
618
|
const ctor = getMemoizedPrototype(root);
|
|
616
619
|
if (!is.und(ctor)) changedProps[prop] = ctor[key];
|
|
617
|
-
} else {
|
|
618
|
-
changedProps[prop] = 0;
|
|
619
620
|
}
|
|
620
621
|
}
|
|
621
622
|
return changedProps;
|
|
@@ -1048,7 +1049,8 @@ const createStore = (invalidate, advance) => {
|
|
|
1048
1049
|
const resizeTarget = canvasTarget ?? actualRenderer;
|
|
1049
1050
|
if (viewport.dpr > 0) resizeTarget.setPixelRatio(viewport.dpr);
|
|
1050
1051
|
resizeTarget.setSize(size.width, size.height, false);
|
|
1051
|
-
|
|
1052
|
+
const activeTarget = actualRenderer.getCanvasTarget?.();
|
|
1053
|
+
if (!canvasTarget || activeTarget !== canvasTarget) internal.canvasTargetSizeDirty = true;
|
|
1052
1054
|
}
|
|
1053
1055
|
if (camera !== oldCamera) {
|
|
1054
1056
|
oldCamera = camera;
|
|
@@ -1337,12 +1339,24 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1337
1339
|
TextureLoader,
|
|
1338
1340
|
IsObject(stableInput) ? Object.values(stableInput) : stableInput
|
|
1339
1341
|
);
|
|
1342
|
+
const mappedTextures = useMemo(() => {
|
|
1343
|
+
if (cachedResult) return cachedResult;
|
|
1344
|
+
if (IsObject(stableInput)) {
|
|
1345
|
+
const keyed = {};
|
|
1346
|
+
const textureArray = loadedTextures;
|
|
1347
|
+
let i = 0;
|
|
1348
|
+
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1349
|
+
return keyed;
|
|
1350
|
+
} else {
|
|
1351
|
+
return loadedTextures;
|
|
1352
|
+
}
|
|
1353
|
+
}, [stableInput, loadedTextures, cachedResult]);
|
|
1340
1354
|
useLayoutEffect(() => {
|
|
1341
1355
|
if (cachedResult) return;
|
|
1342
1356
|
if (onLoadCalledForRef.current === inputKey) return;
|
|
1343
1357
|
onLoadCalledForRef.current = inputKey;
|
|
1344
|
-
onLoadRef.current?.(
|
|
1345
|
-
}, [cachedResult,
|
|
1358
|
+
onLoadRef.current?.(mappedTextures);
|
|
1359
|
+
}, [cachedResult, mappedTextures, inputKey]);
|
|
1346
1360
|
useEffect(() => {
|
|
1347
1361
|
if (cachedResult) return;
|
|
1348
1362
|
if ("initTexture" in renderer) {
|
|
@@ -1361,18 +1375,6 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1361
1375
|
});
|
|
1362
1376
|
}
|
|
1363
1377
|
}, [renderer, loadedTextures, cachedResult]);
|
|
1364
|
-
const mappedTextures = useMemo(() => {
|
|
1365
|
-
if (cachedResult) return cachedResult;
|
|
1366
|
-
if (IsObject(stableInput)) {
|
|
1367
|
-
const keyed = {};
|
|
1368
|
-
const textureArray = loadedTextures;
|
|
1369
|
-
let i = 0;
|
|
1370
|
-
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1371
|
-
return keyed;
|
|
1372
|
-
} else {
|
|
1373
|
-
return loadedTextures;
|
|
1374
|
-
}
|
|
1375
|
-
}, [stableInput, loadedTextures, cachedResult]);
|
|
1376
1378
|
useEffect(() => {
|
|
1377
1379
|
if (!cache) return;
|
|
1378
1380
|
const urlTextureMap = [];
|
|
@@ -1576,7 +1578,7 @@ function useEnvironment({
|
|
|
1576
1578
|
texture = texture.renderTarget?.texture;
|
|
1577
1579
|
}
|
|
1578
1580
|
texture.mapping = isCubemap ? CubeReflectionMapping : EquirectangularReflectionMapping;
|
|
1579
|
-
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
1581
|
+
texture.colorSpace = colorSpace ?? (isCubemap && extension !== "hdr-cube" ? "srgb" : "srgb-linear");
|
|
1580
1582
|
return texture;
|
|
1581
1583
|
}
|
|
1582
1584
|
const preloadDefaultOptions = {
|
|
@@ -1629,11 +1631,12 @@ function getExtension(files) {
|
|
|
1629
1631
|
const isCubemap = isArray(files) && files.length === 6;
|
|
1630
1632
|
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
1631
1633
|
const firstEntry = isArray(files) ? files[0] : files;
|
|
1632
|
-
const
|
|
1634
|
+
const firstExtension = firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
|
|
1635
|
+
const extension = isCubemap ? firstExtension === "hdr" ? "hdr-cube" : "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstExtension;
|
|
1633
1636
|
return { extension, isCubemap, isGainmap };
|
|
1634
1637
|
}
|
|
1635
1638
|
function getLoader(extension) {
|
|
1636
|
-
const loader = extension === "cube" ? CubeTextureLoader : extension === "hdr" ? HDRLoader : extension === "exr" ? EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader : extension === "webp" ? GainMapLoader : null;
|
|
1639
|
+
const loader = extension === "cube" ? CubeTextureLoader : extension === "hdr-cube" ? HDRCubeTextureLoader : extension === "hdr" ? HDRLoader : extension === "exr" ? EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader : extension === "webp" ? GainMapLoader : null;
|
|
1637
1640
|
return loader;
|
|
1638
1641
|
}
|
|
1639
1642
|
|
|
@@ -1696,7 +1699,7 @@ function advance(timestamp, runGlobalEffects, state) {
|
|
|
1696
1699
|
else scheduler.step(timestamp);
|
|
1697
1700
|
}
|
|
1698
1701
|
|
|
1699
|
-
const version = "10.0.0-alpha.
|
|
1702
|
+
const version = "10.0.0-alpha.5";
|
|
1700
1703
|
const packageData = {
|
|
1701
1704
|
version: version};
|
|
1702
1705
|
|
|
@@ -13555,7 +13558,10 @@ function extend(objects) {
|
|
|
13555
13558
|
catalogue[Component] = objects;
|
|
13556
13559
|
return Component;
|
|
13557
13560
|
} else {
|
|
13558
|
-
|
|
13561
|
+
for (const name in objects) {
|
|
13562
|
+
const object = objects[name];
|
|
13563
|
+
if (isConstructor(object)) catalogue[name] = object;
|
|
13564
|
+
}
|
|
13559
13565
|
}
|
|
13560
13566
|
}
|
|
13561
13567
|
function validateInstance(type, props) {
|
|
@@ -13903,7 +13909,7 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13903
13909
|
getRootHostContext: () => NO_CONTEXT,
|
|
13904
13910
|
getChildHostContext: () => NO_CONTEXT,
|
|
13905
13911
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
13906
|
-
validateInstance(type, newProps);
|
|
13912
|
+
validateInstance(instance.type, newProps);
|
|
13907
13913
|
let reconstruct = false;
|
|
13908
13914
|
if (instance.type === "primitive" && oldProps.object !== newProps.object) reconstruct = true;
|
|
13909
13915
|
else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
|
|
@@ -13930,8 +13936,8 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13930
13936
|
for (const prop in instance.props) {
|
|
13931
13937
|
const value = instance.props[prop];
|
|
13932
13938
|
if (isFromRef(value)) {
|
|
13933
|
-
const ref = value
|
|
13934
|
-
if (ref.current != null) resolved[prop] = ref.current;
|
|
13939
|
+
const { [FROM_REF]: ref, transform } = value;
|
|
13940
|
+
if (ref.current != null) resolved[prop] = transform ? transform(ref.current) : ref.current;
|
|
13935
13941
|
}
|
|
13936
13942
|
}
|
|
13937
13943
|
if (Object.keys(resolved).length) applyProps(instance.object, resolved);
|
|
@@ -14230,9 +14236,8 @@ function createRoot(canvas) {
|
|
|
14230
14236
|
if (!renderer.hasInitialized?.()) {
|
|
14231
14237
|
const size2 = computeInitialSize(canvas, propsSize);
|
|
14232
14238
|
if (size2.width > 0 && size2.height > 0) {
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
canvas.height = size2.height * pixelRatio;
|
|
14239
|
+
renderer.setPixelRatio(calculateDpr(dpr));
|
|
14240
|
+
renderer.setSize(size2.width, size2.height, false);
|
|
14236
14241
|
}
|
|
14237
14242
|
await renderer.init();
|
|
14238
14243
|
}
|
|
@@ -14241,7 +14246,7 @@ function createRoot(canvas) {
|
|
|
14241
14246
|
state.internal.actualRenderer = renderer;
|
|
14242
14247
|
state.set({ webGPUSupported: isWebGPUBackend, renderer, primaryStore: store });
|
|
14243
14248
|
if (canvasId && !state.internal.isSecondary) {
|
|
14244
|
-
const canvasTarget =
|
|
14249
|
+
const canvasTarget = renderer.getCanvasTarget?.();
|
|
14245
14250
|
const unregisterPrimary = registerPrimary(canvasId, renderer, store);
|
|
14246
14251
|
state.set((prev) => ({
|
|
14247
14252
|
internal: {
|
|
@@ -14454,9 +14459,10 @@ function createRoot(canvas) {
|
|
|
14454
14459
|
const unregisterCanvasTarget = scheduler.register(
|
|
14455
14460
|
() => {
|
|
14456
14461
|
const state2 = store.getState();
|
|
14457
|
-
|
|
14462
|
+
const canvasTarget = state2.internal.canvasTarget;
|
|
14463
|
+
if (canvasTarget) {
|
|
14458
14464
|
const renderer2 = state2.internal.actualRenderer;
|
|
14459
|
-
renderer2.setCanvasTarget(
|
|
14465
|
+
if (renderer2.getCanvasTarget() !== canvasTarget) renderer2.setCanvasTarget(canvasTarget);
|
|
14460
14466
|
if (state2.internal.canvasTargetSizeDirty) {
|
|
14461
14467
|
state2.internal.canvasTargetSizeDirty = false;
|
|
14462
14468
|
renderer2.backend?.updateSize?.();
|
|
@@ -14620,7 +14626,7 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
14620
14626
|
const unregisterPrimary = state.internal.unregisterPrimary;
|
|
14621
14627
|
if (unregisterPrimary) unregisterPrimary();
|
|
14622
14628
|
const canvasTarget = state.internal.canvasTarget;
|
|
14623
|
-
if (canvasTarget?.dispose) canvasTarget.dispose();
|
|
14629
|
+
if (state.internal.isSecondary && canvasTarget?.dispose) canvasTarget.dispose();
|
|
14624
14630
|
state.events.disconnect?.();
|
|
14625
14631
|
cleanupHelperGroup(root.store);
|
|
14626
14632
|
if (state.isLegacy && renderer) {
|
|
@@ -14761,16 +14767,11 @@ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {})
|
|
|
14761
14767
|
const oldbg = target.background;
|
|
14762
14768
|
const oldenv = target.environment;
|
|
14763
14769
|
const oldSceneProps = {
|
|
14764
|
-
// @ts-ignore
|
|
14765
14770
|
backgroundBlurriness: target.backgroundBlurriness,
|
|
14766
|
-
// @ts-ignore
|
|
14767
14771
|
backgroundIntensity: target.backgroundIntensity,
|
|
14768
|
-
|
|
14769
|
-
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
14770
|
-
// @ts-ignore
|
|
14772
|
+
backgroundRotation: target.backgroundRotation.clone(),
|
|
14771
14773
|
environmentIntensity: target.environmentIntensity,
|
|
14772
|
-
|
|
14773
|
-
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
14774
|
+
environmentRotation: target.environmentRotation.clone()
|
|
14774
14775
|
};
|
|
14775
14776
|
if (background !== "only") target.environment = texture;
|
|
14776
14777
|
if (background) target.background = texture;
|
package/dist/legacy.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const scheduler = require('@pmndrs/scheduler');
|
|
|
10
10
|
const Tb = require('scheduler');
|
|
11
11
|
const GroundedSkybox_js = require('three/examples/jsm/objects/GroundedSkybox.js');
|
|
12
12
|
const HDRLoader_js = require('three/examples/jsm/loaders/HDRLoader.js');
|
|
13
|
+
const HDRCubeTextureLoader_js = require('three/examples/jsm/loaders/HDRCubeTextureLoader.js');
|
|
13
14
|
const EXRLoader_js = require('three/examples/jsm/loaders/EXRLoader.js');
|
|
14
15
|
const UltraHDRLoader_js = require('three/examples/jsm/loaders/UltraHDRLoader.js');
|
|
15
16
|
const gainmapJs = require('@monogrid/gainmap-js');
|
|
@@ -53,11 +54,11 @@ const R3F_BUILD_WEBGPU = false;
|
|
|
53
54
|
async function loadInspector() {
|
|
54
55
|
throw new Error("Inspector is not available in legacy builds. Use @react-three/fiber/webgpu instead.");
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
class WebGPURenderer {
|
|
57
58
|
constructor() {
|
|
58
59
|
throw new Error("WebGPURenderer is not available in legacy builds. Use @react-three/fiber/webgpu instead.");
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
+
}
|
|
61
62
|
const RenderTarget = null;
|
|
62
63
|
const CubeRenderTarget = null;
|
|
63
64
|
|
|
@@ -533,8 +534,10 @@ function hasVisibilityHandlers(handlers) {
|
|
|
533
534
|
}
|
|
534
535
|
|
|
535
536
|
const FROM_REF = Symbol.for("@react-three/fiber.fromRef");
|
|
536
|
-
function fromRef(ref) {
|
|
537
|
-
|
|
537
|
+
function fromRef(ref, transform) {
|
|
538
|
+
const marker = { [FROM_REF]: ref };
|
|
539
|
+
if (transform) marker.transform = transform;
|
|
540
|
+
return marker;
|
|
538
541
|
}
|
|
539
542
|
function isFromRef(value) {
|
|
540
543
|
return value !== null && typeof value === "object" && FROM_REF in value;
|
|
@@ -635,11 +638,9 @@ function diffProps(instance, newProps) {
|
|
|
635
638
|
for (const prop in instance.props) {
|
|
636
639
|
if (RESERVED_PROPS.includes(prop) || newProps.hasOwnProperty(prop)) continue;
|
|
637
640
|
const { root, key } = resolve(instance.object, prop);
|
|
638
|
-
if (
|
|
641
|
+
if (typeof root?.constructor === "function") {
|
|
639
642
|
const ctor = getMemoizedPrototype(root);
|
|
640
643
|
if (!is.und(ctor)) changedProps[prop] = ctor[key];
|
|
641
|
-
} else {
|
|
642
|
-
changedProps[prop] = 0;
|
|
643
644
|
}
|
|
644
645
|
}
|
|
645
646
|
return changedProps;
|
|
@@ -1072,7 +1073,8 @@ const createStore = (invalidate, advance) => {
|
|
|
1072
1073
|
const resizeTarget = canvasTarget ?? actualRenderer;
|
|
1073
1074
|
if (viewport.dpr > 0) resizeTarget.setPixelRatio(viewport.dpr);
|
|
1074
1075
|
resizeTarget.setSize(size.width, size.height, false);
|
|
1075
|
-
|
|
1076
|
+
const activeTarget = actualRenderer.getCanvasTarget?.();
|
|
1077
|
+
if (!canvasTarget || activeTarget !== canvasTarget) internal.canvasTargetSizeDirty = true;
|
|
1076
1078
|
}
|
|
1077
1079
|
if (camera !== oldCamera) {
|
|
1078
1080
|
oldCamera = camera;
|
|
@@ -1361,12 +1363,24 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1361
1363
|
three.TextureLoader,
|
|
1362
1364
|
IsObject(stableInput) ? Object.values(stableInput) : stableInput
|
|
1363
1365
|
);
|
|
1366
|
+
const mappedTextures = React.useMemo(() => {
|
|
1367
|
+
if (cachedResult) return cachedResult;
|
|
1368
|
+
if (IsObject(stableInput)) {
|
|
1369
|
+
const keyed = {};
|
|
1370
|
+
const textureArray = loadedTextures;
|
|
1371
|
+
let i = 0;
|
|
1372
|
+
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1373
|
+
return keyed;
|
|
1374
|
+
} else {
|
|
1375
|
+
return loadedTextures;
|
|
1376
|
+
}
|
|
1377
|
+
}, [stableInput, loadedTextures, cachedResult]);
|
|
1364
1378
|
React.useLayoutEffect(() => {
|
|
1365
1379
|
if (cachedResult) return;
|
|
1366
1380
|
if (onLoadCalledForRef.current === inputKey) return;
|
|
1367
1381
|
onLoadCalledForRef.current = inputKey;
|
|
1368
|
-
onLoadRef.current?.(
|
|
1369
|
-
}, [cachedResult,
|
|
1382
|
+
onLoadRef.current?.(mappedTextures);
|
|
1383
|
+
}, [cachedResult, mappedTextures, inputKey]);
|
|
1370
1384
|
React.useEffect(() => {
|
|
1371
1385
|
if (cachedResult) return;
|
|
1372
1386
|
if ("initTexture" in renderer) {
|
|
@@ -1385,18 +1399,6 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1385
1399
|
});
|
|
1386
1400
|
}
|
|
1387
1401
|
}, [renderer, loadedTextures, cachedResult]);
|
|
1388
|
-
const mappedTextures = React.useMemo(() => {
|
|
1389
|
-
if (cachedResult) return cachedResult;
|
|
1390
|
-
if (IsObject(stableInput)) {
|
|
1391
|
-
const keyed = {};
|
|
1392
|
-
const textureArray = loadedTextures;
|
|
1393
|
-
let i = 0;
|
|
1394
|
-
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1395
|
-
return keyed;
|
|
1396
|
-
} else {
|
|
1397
|
-
return loadedTextures;
|
|
1398
|
-
}
|
|
1399
|
-
}, [stableInput, loadedTextures, cachedResult]);
|
|
1400
1402
|
React.useEffect(() => {
|
|
1401
1403
|
if (!cache) return;
|
|
1402
1404
|
const urlTextureMap = [];
|
|
@@ -1598,7 +1600,7 @@ function useEnvironment({
|
|
|
1598
1600
|
texture = texture.renderTarget?.texture;
|
|
1599
1601
|
}
|
|
1600
1602
|
texture.mapping = isCubemap ? three.CubeReflectionMapping : three.EquirectangularReflectionMapping;
|
|
1601
|
-
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
1603
|
+
texture.colorSpace = colorSpace ?? (isCubemap && extension !== "hdr-cube" ? "srgb" : "srgb-linear");
|
|
1602
1604
|
return texture;
|
|
1603
1605
|
}
|
|
1604
1606
|
const preloadDefaultOptions = {
|
|
@@ -1651,11 +1653,12 @@ function getExtension(files) {
|
|
|
1651
1653
|
const isCubemap = isArray(files) && files.length === 6;
|
|
1652
1654
|
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
1653
1655
|
const firstEntry = isArray(files) ? files[0] : files;
|
|
1654
|
-
const
|
|
1656
|
+
const firstExtension = firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
|
|
1657
|
+
const extension = isCubemap ? firstExtension === "hdr" ? "hdr-cube" : "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstExtension;
|
|
1655
1658
|
return { extension, isCubemap, isGainmap };
|
|
1656
1659
|
}
|
|
1657
1660
|
function getLoader(extension) {
|
|
1658
|
-
const loader = extension === "cube" ? three.CubeTextureLoader : extension === "hdr" ? HDRLoader_js.HDRLoader : extension === "exr" ? EXRLoader_js.EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader_js.UltraHDRLoader : extension === "webp" ? gainmapJs.GainMapLoader : null;
|
|
1661
|
+
const loader = extension === "cube" ? three.CubeTextureLoader : extension === "hdr-cube" ? HDRCubeTextureLoader_js.HDRCubeTextureLoader : extension === "hdr" ? HDRLoader_js.HDRLoader : extension === "exr" ? EXRLoader_js.EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader_js.UltraHDRLoader : extension === "webp" ? gainmapJs.GainMapLoader : null;
|
|
1659
1662
|
return loader;
|
|
1660
1663
|
}
|
|
1661
1664
|
|
|
@@ -1718,7 +1721,7 @@ function advance(timestamp, runGlobalEffects, state) {
|
|
|
1718
1721
|
else scheduler$1.step(timestamp);
|
|
1719
1722
|
}
|
|
1720
1723
|
|
|
1721
|
-
const version = "10.0.0-alpha.
|
|
1724
|
+
const version = "10.0.0-alpha.5";
|
|
1722
1725
|
const packageData = {
|
|
1723
1726
|
version: version};
|
|
1724
1727
|
|
|
@@ -13577,7 +13580,10 @@ function extend(objects) {
|
|
|
13577
13580
|
catalogue[Component] = objects;
|
|
13578
13581
|
return Component;
|
|
13579
13582
|
} else {
|
|
13580
|
-
|
|
13583
|
+
for (const name in objects) {
|
|
13584
|
+
const object = objects[name];
|
|
13585
|
+
if (isConstructor(object)) catalogue[name] = object;
|
|
13586
|
+
}
|
|
13581
13587
|
}
|
|
13582
13588
|
}
|
|
13583
13589
|
function validateInstance(type, props) {
|
|
@@ -13925,7 +13931,7 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13925
13931
|
getRootHostContext: () => NO_CONTEXT,
|
|
13926
13932
|
getChildHostContext: () => NO_CONTEXT,
|
|
13927
13933
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
13928
|
-
validateInstance(type, newProps);
|
|
13934
|
+
validateInstance(instance.type, newProps);
|
|
13929
13935
|
let reconstruct = false;
|
|
13930
13936
|
if (instance.type === "primitive" && oldProps.object !== newProps.object) reconstruct = true;
|
|
13931
13937
|
else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
|
|
@@ -13952,8 +13958,8 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13952
13958
|
for (const prop in instance.props) {
|
|
13953
13959
|
const value = instance.props[prop];
|
|
13954
13960
|
if (isFromRef(value)) {
|
|
13955
|
-
const ref = value
|
|
13956
|
-
if (ref.current != null) resolved[prop] = ref.current;
|
|
13961
|
+
const { [FROM_REF]: ref, transform } = value;
|
|
13962
|
+
if (ref.current != null) resolved[prop] = transform ? transform(ref.current) : ref.current;
|
|
13957
13963
|
}
|
|
13958
13964
|
}
|
|
13959
13965
|
if (Object.keys(resolved).length) applyProps(instance.object, resolved);
|
|
@@ -14429,9 +14435,10 @@ function createRoot(canvas) {
|
|
|
14429
14435
|
const unregisterCanvasTarget = scheduler$1.register(
|
|
14430
14436
|
() => {
|
|
14431
14437
|
const state2 = store.getState();
|
|
14432
|
-
|
|
14438
|
+
const canvasTarget = state2.internal.canvasTarget;
|
|
14439
|
+
if (canvasTarget) {
|
|
14433
14440
|
const renderer2 = state2.internal.actualRenderer;
|
|
14434
|
-
renderer2.setCanvasTarget(
|
|
14441
|
+
if (renderer2.getCanvasTarget() !== canvasTarget) renderer2.setCanvasTarget(canvasTarget);
|
|
14435
14442
|
if (state2.internal.canvasTargetSizeDirty) {
|
|
14436
14443
|
state2.internal.canvasTargetSizeDirty = false;
|
|
14437
14444
|
renderer2.backend?.updateSize?.();
|
|
@@ -14595,7 +14602,7 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
14595
14602
|
const unregisterPrimary = state.internal.unregisterPrimary;
|
|
14596
14603
|
if (unregisterPrimary) unregisterPrimary();
|
|
14597
14604
|
const canvasTarget = state.internal.canvasTarget;
|
|
14598
|
-
if (canvasTarget?.dispose) canvasTarget.dispose();
|
|
14605
|
+
if (state.internal.isSecondary && canvasTarget?.dispose) canvasTarget.dispose();
|
|
14599
14606
|
state.events.disconnect?.();
|
|
14600
14607
|
cleanupHelperGroup(root.store);
|
|
14601
14608
|
if (state.isLegacy && renderer) {
|
|
@@ -14736,16 +14743,11 @@ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {})
|
|
|
14736
14743
|
const oldbg = target.background;
|
|
14737
14744
|
const oldenv = target.environment;
|
|
14738
14745
|
const oldSceneProps = {
|
|
14739
|
-
// @ts-ignore
|
|
14740
14746
|
backgroundBlurriness: target.backgroundBlurriness,
|
|
14741
|
-
// @ts-ignore
|
|
14742
14747
|
backgroundIntensity: target.backgroundIntensity,
|
|
14743
|
-
|
|
14744
|
-
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
14745
|
-
// @ts-ignore
|
|
14748
|
+
backgroundRotation: target.backgroundRotation.clone(),
|
|
14746
14749
|
environmentIntensity: target.environmentIntensity,
|
|
14747
|
-
|
|
14748
|
-
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
14750
|
+
environmentRotation: target.environmentRotation.clone()
|
|
14749
14751
|
};
|
|
14750
14752
|
if (background !== "only") target.environment = texture;
|
|
14751
14753
|
if (background) target.background = texture;
|