@react-three/fiber 10.0.0-canary.4f316e6 → 10.0.0-canary.4f9f64c
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 +35 -40
- package/dist/index.d.cts +155 -164
- package/dist/index.d.mts +155 -164
- package/dist/index.d.ts +155 -192
- package/dist/index.mjs +35 -40
- package/dist/legacy.cjs +37 -42
- package/dist/legacy.d.cts +159 -168
- package/dist/legacy.d.mts +159 -168
- package/dist/legacy.d.ts +159 -194
- package/dist/legacy.mjs +37 -42
- package/dist/webgpu/index.cjs +91 -97
- package/dist/webgpu/index.d.cts +214 -214
- package/dist/webgpu/index.d.mts +214 -214
- package/dist/webgpu/index.d.ts +214 -242
- package/dist/webgpu/index.mjs +91 -97
- 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;
|
|
@@ -602,12 +605,7 @@ function diffProps(instance, newProps) {
|
|
|
602
605
|
const changedProps = {};
|
|
603
606
|
for (const prop in newProps) {
|
|
604
607
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
605
|
-
if (is.equ(newProps[prop], instance.props[prop]))
|
|
606
|
-
const value = newProps[prop];
|
|
607
|
-
if (!isCopyable(value)) continue;
|
|
608
|
-
const { target } = resolve(instance.object, prop);
|
|
609
|
-
if (!isCopyable(target) || target.constructor !== value.constructor) continue;
|
|
610
|
-
}
|
|
608
|
+
if (is.equ(newProps[prop], instance.props[prop])) continue;
|
|
611
609
|
changedProps[prop] = newProps[prop];
|
|
612
610
|
for (const other in newProps) {
|
|
613
611
|
if (other.startsWith(`${prop}-`)) changedProps[other] = newProps[other];
|
|
@@ -616,11 +614,9 @@ function diffProps(instance, newProps) {
|
|
|
616
614
|
for (const prop in instance.props) {
|
|
617
615
|
if (RESERVED_PROPS.includes(prop) || newProps.hasOwnProperty(prop)) continue;
|
|
618
616
|
const { root, key } = resolve(instance.object, prop);
|
|
619
|
-
if (
|
|
617
|
+
if (typeof root?.constructor === "function") {
|
|
620
618
|
const ctor = getMemoizedPrototype(root);
|
|
621
619
|
if (!is.und(ctor)) changedProps[prop] = ctor[key];
|
|
622
|
-
} else {
|
|
623
|
-
changedProps[prop] = 0;
|
|
624
620
|
}
|
|
625
621
|
}
|
|
626
622
|
return changedProps;
|
|
@@ -1343,12 +1339,24 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1343
1339
|
TextureLoader,
|
|
1344
1340
|
IsObject(stableInput) ? Object.values(stableInput) : stableInput
|
|
1345
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]);
|
|
1346
1354
|
useLayoutEffect(() => {
|
|
1347
1355
|
if (cachedResult) return;
|
|
1348
1356
|
if (onLoadCalledForRef.current === inputKey) return;
|
|
1349
1357
|
onLoadCalledForRef.current = inputKey;
|
|
1350
|
-
onLoadRef.current?.(
|
|
1351
|
-
}, [cachedResult,
|
|
1358
|
+
onLoadRef.current?.(mappedTextures);
|
|
1359
|
+
}, [cachedResult, mappedTextures, inputKey]);
|
|
1352
1360
|
useEffect(() => {
|
|
1353
1361
|
if (cachedResult) return;
|
|
1354
1362
|
if ("initTexture" in renderer) {
|
|
@@ -1367,18 +1375,6 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1367
1375
|
});
|
|
1368
1376
|
}
|
|
1369
1377
|
}, [renderer, loadedTextures, cachedResult]);
|
|
1370
|
-
const mappedTextures = useMemo(() => {
|
|
1371
|
-
if (cachedResult) return cachedResult;
|
|
1372
|
-
if (IsObject(stableInput)) {
|
|
1373
|
-
const keyed = {};
|
|
1374
|
-
const textureArray = loadedTextures;
|
|
1375
|
-
let i = 0;
|
|
1376
|
-
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1377
|
-
return keyed;
|
|
1378
|
-
} else {
|
|
1379
|
-
return loadedTextures;
|
|
1380
|
-
}
|
|
1381
|
-
}, [stableInput, loadedTextures, cachedResult]);
|
|
1382
1378
|
useEffect(() => {
|
|
1383
1379
|
if (!cache) return;
|
|
1384
1380
|
const urlTextureMap = [];
|
|
@@ -1582,7 +1578,7 @@ function useEnvironment({
|
|
|
1582
1578
|
texture = texture.renderTarget?.texture;
|
|
1583
1579
|
}
|
|
1584
1580
|
texture.mapping = isCubemap ? CubeReflectionMapping : EquirectangularReflectionMapping;
|
|
1585
|
-
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
1581
|
+
texture.colorSpace = colorSpace ?? (isCubemap && extension !== "hdr-cube" ? "srgb" : "srgb-linear");
|
|
1586
1582
|
return texture;
|
|
1587
1583
|
}
|
|
1588
1584
|
const preloadDefaultOptions = {
|
|
@@ -1635,11 +1631,12 @@ function getExtension(files) {
|
|
|
1635
1631
|
const isCubemap = isArray(files) && files.length === 6;
|
|
1636
1632
|
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
1637
1633
|
const firstEntry = isArray(files) ? files[0] : files;
|
|
1638
|
-
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;
|
|
1639
1636
|
return { extension, isCubemap, isGainmap };
|
|
1640
1637
|
}
|
|
1641
1638
|
function getLoader(extension) {
|
|
1642
|
-
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;
|
|
1643
1640
|
return loader;
|
|
1644
1641
|
}
|
|
1645
1642
|
|
|
@@ -1702,7 +1699,7 @@ function advance(timestamp, runGlobalEffects, state) {
|
|
|
1702
1699
|
else scheduler.step(timestamp);
|
|
1703
1700
|
}
|
|
1704
1701
|
|
|
1705
|
-
const version = "10.0.0-alpha.
|
|
1702
|
+
const version = "10.0.0-alpha.5";
|
|
1706
1703
|
const packageData = {
|
|
1707
1704
|
version: version};
|
|
1708
1705
|
|
|
@@ -13561,7 +13558,10 @@ function extend(objects) {
|
|
|
13561
13558
|
catalogue[Component] = objects;
|
|
13562
13559
|
return Component;
|
|
13563
13560
|
} else {
|
|
13564
|
-
|
|
13561
|
+
for (const name in objects) {
|
|
13562
|
+
const object = objects[name];
|
|
13563
|
+
if (isConstructor(object)) catalogue[name] = object;
|
|
13564
|
+
}
|
|
13565
13565
|
}
|
|
13566
13566
|
}
|
|
13567
13567
|
function validateInstance(type, props) {
|
|
@@ -13909,7 +13909,7 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13909
13909
|
getRootHostContext: () => NO_CONTEXT,
|
|
13910
13910
|
getChildHostContext: () => NO_CONTEXT,
|
|
13911
13911
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
13912
|
-
validateInstance(type, newProps);
|
|
13912
|
+
validateInstance(instance.type, newProps);
|
|
13913
13913
|
let reconstruct = false;
|
|
13914
13914
|
if (instance.type === "primitive" && oldProps.object !== newProps.object) reconstruct = true;
|
|
13915
13915
|
else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
|
|
@@ -13936,8 +13936,8 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13936
13936
|
for (const prop in instance.props) {
|
|
13937
13937
|
const value = instance.props[prop];
|
|
13938
13938
|
if (isFromRef(value)) {
|
|
13939
|
-
const ref = value
|
|
13940
|
-
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;
|
|
13941
13941
|
}
|
|
13942
13942
|
}
|
|
13943
13943
|
if (Object.keys(resolved).length) applyProps(instance.object, resolved);
|
|
@@ -14767,16 +14767,11 @@ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {})
|
|
|
14767
14767
|
const oldbg = target.background;
|
|
14768
14768
|
const oldenv = target.environment;
|
|
14769
14769
|
const oldSceneProps = {
|
|
14770
|
-
// @ts-ignore
|
|
14771
14770
|
backgroundBlurriness: target.backgroundBlurriness,
|
|
14772
|
-
// @ts-ignore
|
|
14773
14771
|
backgroundIntensity: target.backgroundIntensity,
|
|
14774
|
-
|
|
14775
|
-
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
14776
|
-
// @ts-ignore
|
|
14772
|
+
backgroundRotation: target.backgroundRotation.clone(),
|
|
14777
14773
|
environmentIntensity: target.environmentIntensity,
|
|
14778
|
-
|
|
14779
|
-
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
14774
|
+
environmentRotation: target.environmentRotation.clone()
|
|
14780
14775
|
};
|
|
14781
14776
|
if (background !== "only") target.environment = texture;
|
|
14782
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;
|
|
@@ -626,12 +629,7 @@ function diffProps(instance, newProps) {
|
|
|
626
629
|
const changedProps = {};
|
|
627
630
|
for (const prop in newProps) {
|
|
628
631
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
629
|
-
if (is.equ(newProps[prop], instance.props[prop]))
|
|
630
|
-
const value = newProps[prop];
|
|
631
|
-
if (!isCopyable(value)) continue;
|
|
632
|
-
const { target } = resolve(instance.object, prop);
|
|
633
|
-
if (!isCopyable(target) || target.constructor !== value.constructor) continue;
|
|
634
|
-
}
|
|
632
|
+
if (is.equ(newProps[prop], instance.props[prop])) continue;
|
|
635
633
|
changedProps[prop] = newProps[prop];
|
|
636
634
|
for (const other in newProps) {
|
|
637
635
|
if (other.startsWith(`${prop}-`)) changedProps[other] = newProps[other];
|
|
@@ -640,11 +638,9 @@ function diffProps(instance, newProps) {
|
|
|
640
638
|
for (const prop in instance.props) {
|
|
641
639
|
if (RESERVED_PROPS.includes(prop) || newProps.hasOwnProperty(prop)) continue;
|
|
642
640
|
const { root, key } = resolve(instance.object, prop);
|
|
643
|
-
if (
|
|
641
|
+
if (typeof root?.constructor === "function") {
|
|
644
642
|
const ctor = getMemoizedPrototype(root);
|
|
645
643
|
if (!is.und(ctor)) changedProps[prop] = ctor[key];
|
|
646
|
-
} else {
|
|
647
|
-
changedProps[prop] = 0;
|
|
648
644
|
}
|
|
649
645
|
}
|
|
650
646
|
return changedProps;
|
|
@@ -1367,12 +1363,24 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1367
1363
|
three.TextureLoader,
|
|
1368
1364
|
IsObject(stableInput) ? Object.values(stableInput) : stableInput
|
|
1369
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]);
|
|
1370
1378
|
React.useLayoutEffect(() => {
|
|
1371
1379
|
if (cachedResult) return;
|
|
1372
1380
|
if (onLoadCalledForRef.current === inputKey) return;
|
|
1373
1381
|
onLoadCalledForRef.current = inputKey;
|
|
1374
|
-
onLoadRef.current?.(
|
|
1375
|
-
}, [cachedResult,
|
|
1382
|
+
onLoadRef.current?.(mappedTextures);
|
|
1383
|
+
}, [cachedResult, mappedTextures, inputKey]);
|
|
1376
1384
|
React.useEffect(() => {
|
|
1377
1385
|
if (cachedResult) return;
|
|
1378
1386
|
if ("initTexture" in renderer) {
|
|
@@ -1391,18 +1399,6 @@ function useTexture(input, optionsOrOnLoad) {
|
|
|
1391
1399
|
});
|
|
1392
1400
|
}
|
|
1393
1401
|
}, [renderer, loadedTextures, cachedResult]);
|
|
1394
|
-
const mappedTextures = React.useMemo(() => {
|
|
1395
|
-
if (cachedResult) return cachedResult;
|
|
1396
|
-
if (IsObject(stableInput)) {
|
|
1397
|
-
const keyed = {};
|
|
1398
|
-
const textureArray = loadedTextures;
|
|
1399
|
-
let i = 0;
|
|
1400
|
-
for (const key in stableInput) keyed[key] = textureArray[i++];
|
|
1401
|
-
return keyed;
|
|
1402
|
-
} else {
|
|
1403
|
-
return loadedTextures;
|
|
1404
|
-
}
|
|
1405
|
-
}, [stableInput, loadedTextures, cachedResult]);
|
|
1406
1402
|
React.useEffect(() => {
|
|
1407
1403
|
if (!cache) return;
|
|
1408
1404
|
const urlTextureMap = [];
|
|
@@ -1604,7 +1600,7 @@ function useEnvironment({
|
|
|
1604
1600
|
texture = texture.renderTarget?.texture;
|
|
1605
1601
|
}
|
|
1606
1602
|
texture.mapping = isCubemap ? three.CubeReflectionMapping : three.EquirectangularReflectionMapping;
|
|
1607
|
-
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
1603
|
+
texture.colorSpace = colorSpace ?? (isCubemap && extension !== "hdr-cube" ? "srgb" : "srgb-linear");
|
|
1608
1604
|
return texture;
|
|
1609
1605
|
}
|
|
1610
1606
|
const preloadDefaultOptions = {
|
|
@@ -1657,11 +1653,12 @@ function getExtension(files) {
|
|
|
1657
1653
|
const isCubemap = isArray(files) && files.length === 6;
|
|
1658
1654
|
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
1659
1655
|
const firstEntry = isArray(files) ? files[0] : files;
|
|
1660
|
-
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;
|
|
1661
1658
|
return { extension, isCubemap, isGainmap };
|
|
1662
1659
|
}
|
|
1663
1660
|
function getLoader(extension) {
|
|
1664
|
-
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;
|
|
1665
1662
|
return loader;
|
|
1666
1663
|
}
|
|
1667
1664
|
|
|
@@ -1724,7 +1721,7 @@ function advance(timestamp, runGlobalEffects, state) {
|
|
|
1724
1721
|
else scheduler$1.step(timestamp);
|
|
1725
1722
|
}
|
|
1726
1723
|
|
|
1727
|
-
const version = "10.0.0-alpha.
|
|
1724
|
+
const version = "10.0.0-alpha.5";
|
|
1728
1725
|
const packageData = {
|
|
1729
1726
|
version: version};
|
|
1730
1727
|
|
|
@@ -13583,7 +13580,10 @@ function extend(objects) {
|
|
|
13583
13580
|
catalogue[Component] = objects;
|
|
13584
13581
|
return Component;
|
|
13585
13582
|
} else {
|
|
13586
|
-
|
|
13583
|
+
for (const name in objects) {
|
|
13584
|
+
const object = objects[name];
|
|
13585
|
+
if (isConstructor(object)) catalogue[name] = object;
|
|
13586
|
+
}
|
|
13587
13587
|
}
|
|
13588
13588
|
}
|
|
13589
13589
|
function validateInstance(type, props) {
|
|
@@ -13931,7 +13931,7 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13931
13931
|
getRootHostContext: () => NO_CONTEXT,
|
|
13932
13932
|
getChildHostContext: () => NO_CONTEXT,
|
|
13933
13933
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
13934
|
-
validateInstance(type, newProps);
|
|
13934
|
+
validateInstance(instance.type, newProps);
|
|
13935
13935
|
let reconstruct = false;
|
|
13936
13936
|
if (instance.type === "primitive" && oldProps.object !== newProps.object) reconstruct = true;
|
|
13937
13937
|
else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
|
|
@@ -13958,8 +13958,8 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13958
13958
|
for (const prop in instance.props) {
|
|
13959
13959
|
const value = instance.props[prop];
|
|
13960
13960
|
if (isFromRef(value)) {
|
|
13961
|
-
const ref = value
|
|
13962
|
-
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;
|
|
13963
13963
|
}
|
|
13964
13964
|
}
|
|
13965
13965
|
if (Object.keys(resolved).length) applyProps(instance.object, resolved);
|
|
@@ -14743,16 +14743,11 @@ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {})
|
|
|
14743
14743
|
const oldbg = target.background;
|
|
14744
14744
|
const oldenv = target.environment;
|
|
14745
14745
|
const oldSceneProps = {
|
|
14746
|
-
// @ts-ignore
|
|
14747
14746
|
backgroundBlurriness: target.backgroundBlurriness,
|
|
14748
|
-
// @ts-ignore
|
|
14749
14747
|
backgroundIntensity: target.backgroundIntensity,
|
|
14750
|
-
|
|
14751
|
-
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
14752
|
-
// @ts-ignore
|
|
14748
|
+
backgroundRotation: target.backgroundRotation.clone(),
|
|
14753
14749
|
environmentIntensity: target.environmentIntensity,
|
|
14754
|
-
|
|
14755
|
-
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
14750
|
+
environmentRotation: target.environmentRotation.clone()
|
|
14756
14751
|
};
|
|
14757
14752
|
if (background !== "only") target.environment = texture;
|
|
14758
14753
|
if (background) target.background = texture;
|