@react-three/fiber 8.14.6 → 8.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +835 -823
- package/dist/declarations/src/core/index.d.ts +2 -2
- package/dist/declarations/src/native/polyfills.d.ts +1 -1
- package/dist/{index-886811f8.cjs.dev.js → index-34a45f4c.cjs.dev.js} +77 -74
- package/dist/{index-563322db.esm.js → index-5918012a.esm.js} +77 -75
- package/dist/{index-0ed4bbca.cjs.prod.js → index-f4d4539a.cjs.prod.js} +77 -74
- package/dist/react-three-fiber.cjs.dev.js +5 -4
- package/dist/react-three-fiber.cjs.prod.js +5 -4
- package/dist/react-three-fiber.esm.js +5 -5
- package/native/dist/react-three-fiber-native.cjs.dev.js +140 -64
- package/native/dist/react-three-fiber-native.cjs.prod.js +140 -64
- package/native/dist/react-three-fiber-native.esm.js +140 -66
- package/native/package.json +5 -5
- package/package.json +2 -1
- package/readme.md +253 -253
- package/yarn-error.log +10628 -0
|
@@ -7,7 +7,7 @@ import { Renderer, context, RootState, Size, Dpr, Performance, PrivateKeys } fro
|
|
|
7
7
|
import { extend, Root } from './renderer';
|
|
8
8
|
import { addEffect, addAfterEffect, addTail, flushGlobalEffects } from './loop';
|
|
9
9
|
import { EventManager, ComputeFunction } from './events';
|
|
10
|
-
import { dispose, getRootState, Camera } from './utils';
|
|
10
|
+
import { dispose, getRootState, Camera, buildGraph } from './utils';
|
|
11
11
|
import type { Properties } from '../three-types';
|
|
12
12
|
declare type Canvas = HTMLCanvasElement | OffscreenCanvas;
|
|
13
13
|
declare const roots: Map<Canvas, Root>;
|
|
@@ -54,4 +54,4 @@ export declare type InjectState = Partial<Omit<RootState, PrivateKeys> & {
|
|
|
54
54
|
declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): JSX.Element;
|
|
55
55
|
declare const act: any;
|
|
56
56
|
export * from './hooks';
|
|
57
|
-
export { context, render, createRoot, unmountComponentAtNode, createPortal, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, flushGlobalEffects, getRootState, act, roots as _roots, };
|
|
57
|
+
export { context, render, createRoot, unmountComponentAtNode, createPortal, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, flushGlobalEffects, getRootState, act, buildGraph, roots as _roots, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function polyfills(): void;
|
|
@@ -374,12 +374,12 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
var _window$document, _window$navigator;
|
|
377
|
-
/**
|
|
378
|
-
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
377
|
+
/**
|
|
378
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
379
379
|
*/
|
|
380
380
|
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
381
|
-
/**
|
|
382
|
-
* The current THREE.ColorManagement instance, if present.
|
|
381
|
+
/**
|
|
382
|
+
* The current THREE.ColorManagement instance, if present.
|
|
383
383
|
*/
|
|
384
384
|
const getColorManagement = () => {
|
|
385
385
|
var _ColorManagement;
|
|
@@ -388,14 +388,14 @@ const getColorManagement = () => {
|
|
|
388
388
|
const isOrthographicCamera = def => def && def.isOrthographicCamera;
|
|
389
389
|
const isRef = obj => obj && obj.hasOwnProperty('current');
|
|
390
390
|
|
|
391
|
-
/**
|
|
392
|
-
* An SSR-friendly useLayoutEffect.
|
|
393
|
-
*
|
|
394
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
395
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
396
|
-
* useLayoutEffect elsewhere.
|
|
397
|
-
*
|
|
398
|
-
* @see https://github.com/facebook/react/issues/14927
|
|
391
|
+
/**
|
|
392
|
+
* An SSR-friendly useLayoutEffect.
|
|
393
|
+
*
|
|
394
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
395
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
396
|
+
* useLayoutEffect elsewhere.
|
|
397
|
+
*
|
|
398
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
399
399
|
*/
|
|
400
400
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
401
401
|
function useMutableCallback(fn) {
|
|
@@ -440,8 +440,8 @@ function calculateDpr(dpr) {
|
|
|
440
440
|
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
/**
|
|
444
|
-
* Returns instance root state
|
|
443
|
+
/**
|
|
444
|
+
* Returns instance root state
|
|
445
445
|
*/
|
|
446
446
|
const getRootState = obj => {
|
|
447
447
|
var _r3f;
|
|
@@ -497,7 +497,9 @@ const is = {
|
|
|
497
497
|
}
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
/**
|
|
501
|
+
* Collects nodes and materials from a THREE.Object3D.
|
|
502
|
+
*/
|
|
501
503
|
function buildGraph(object) {
|
|
502
504
|
const data = {
|
|
503
505
|
nodes: {},
|
|
@@ -836,9 +838,9 @@ function getEventPriority() {
|
|
|
836
838
|
}
|
|
837
839
|
}
|
|
838
840
|
|
|
839
|
-
/**
|
|
840
|
-
* Release pointer captures.
|
|
841
|
-
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
841
|
+
/**
|
|
842
|
+
* Release pointer captures.
|
|
843
|
+
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
842
844
|
*/
|
|
843
845
|
function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
844
846
|
const captureData = captures.get(obj);
|
|
@@ -1173,19 +1175,19 @@ function createEvents(store) {
|
|
|
1173
1175
|
// Check presence of handlers
|
|
1174
1176
|
if (!(instance != null && instance.eventCount)) return;
|
|
1175
1177
|
|
|
1176
|
-
/*
|
|
1177
|
-
MAYBE TODO, DELETE IF NOT:
|
|
1178
|
-
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1179
|
-
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1180
|
-
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1181
|
-
|
|
1182
|
-
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1183
|
-
if (pointerId !== undefined) {
|
|
1184
|
-
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1185
|
-
if (capturedMeshSet) {
|
|
1186
|
-
const captured = capturedMeshSet.get(eventObject)
|
|
1187
|
-
if (captured && captured.localState.stopped) return
|
|
1188
|
-
}
|
|
1178
|
+
/*
|
|
1179
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1180
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1181
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1182
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1183
|
+
|
|
1184
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1185
|
+
if (pointerId !== undefined) {
|
|
1186
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1187
|
+
if (capturedMeshSet) {
|
|
1188
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1189
|
+
if (captured && captured.localState.stopped) return
|
|
1190
|
+
}
|
|
1189
1191
|
}*/
|
|
1190
1192
|
|
|
1191
1193
|
if (isPointerMove) {
|
|
@@ -1491,21 +1493,21 @@ let globalEffects = new Set();
|
|
|
1491
1493
|
let globalAfterEffects = new Set();
|
|
1492
1494
|
let globalTailEffects = new Set();
|
|
1493
1495
|
|
|
1494
|
-
/**
|
|
1495
|
-
* Adds a global render callback which is called each frame.
|
|
1496
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1496
|
+
/**
|
|
1497
|
+
* Adds a global render callback which is called each frame.
|
|
1498
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1497
1499
|
*/
|
|
1498
1500
|
const addEffect = callback => createSubs(callback, globalEffects);
|
|
1499
1501
|
|
|
1500
|
-
/**
|
|
1501
|
-
* Adds a global after-render callback which is called each frame.
|
|
1502
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1502
|
+
/**
|
|
1503
|
+
* Adds a global after-render callback which is called each frame.
|
|
1504
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1503
1505
|
*/
|
|
1504
1506
|
const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
|
|
1505
1507
|
|
|
1506
|
-
/**
|
|
1507
|
-
* Adds a global callback which is called when rendering stops.
|
|
1508
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1508
|
+
/**
|
|
1509
|
+
* Adds a global callback which is called when rendering stops.
|
|
1510
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1509
1511
|
*/
|
|
1510
1512
|
const addTail = callback => createSubs(callback, globalTailEffects);
|
|
1511
1513
|
function run(effects, timestamp) {
|
|
@@ -1604,24 +1606,24 @@ function createLoop(roots) {
|
|
|
1604
1606
|
}
|
|
1605
1607
|
return {
|
|
1606
1608
|
loop,
|
|
1607
|
-
/**
|
|
1608
|
-
* Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
|
|
1609
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
|
|
1609
|
+
/**
|
|
1610
|
+
* Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
|
|
1611
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
|
|
1610
1612
|
*/
|
|
1611
1613
|
invalidate,
|
|
1612
|
-
/**
|
|
1613
|
-
* Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
|
|
1614
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
1614
|
+
/**
|
|
1615
|
+
* Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
|
|
1616
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
1615
1617
|
*/
|
|
1616
1618
|
advance
|
|
1617
1619
|
};
|
|
1618
1620
|
}
|
|
1619
1621
|
|
|
1620
|
-
/**
|
|
1621
|
-
* Exposes an object's {@link LocalState}.
|
|
1622
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1623
|
-
*
|
|
1624
|
-
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1622
|
+
/**
|
|
1623
|
+
* Exposes an object's {@link LocalState}.
|
|
1624
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1625
|
+
*
|
|
1626
|
+
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1625
1627
|
*/
|
|
1626
1628
|
function useInstanceHandle(ref) {
|
|
1627
1629
|
const instance = React__namespace.useRef(null);
|
|
@@ -1634,18 +1636,18 @@ function useStore() {
|
|
|
1634
1636
|
return store;
|
|
1635
1637
|
}
|
|
1636
1638
|
|
|
1637
|
-
/**
|
|
1638
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1639
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1639
|
+
/**
|
|
1640
|
+
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1641
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1640
1642
|
*/
|
|
1641
1643
|
function useThree(selector = state => state, equalityFn) {
|
|
1642
1644
|
return useStore()(selector, equalityFn);
|
|
1643
1645
|
}
|
|
1644
1646
|
|
|
1645
|
-
/**
|
|
1646
|
-
* Executes a callback before render in a shared frame loop.
|
|
1647
|
-
* Can order effects with render priority or manually render with a positive priority.
|
|
1648
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1647
|
+
/**
|
|
1648
|
+
* Executes a callback before render in a shared frame loop.
|
|
1649
|
+
* Can order effects with render priority or manually render with a positive priority.
|
|
1650
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1649
1651
|
*/
|
|
1650
1652
|
function useFrame(callback, renderPriority = 0) {
|
|
1651
1653
|
const store = useStore();
|
|
@@ -1657,9 +1659,9 @@ function useFrame(callback, renderPriority = 0) {
|
|
|
1657
1659
|
return null;
|
|
1658
1660
|
}
|
|
1659
1661
|
|
|
1660
|
-
/**
|
|
1661
|
-
* Returns a node graph of an object with named nodes & materials.
|
|
1662
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1662
|
+
/**
|
|
1663
|
+
* Returns a node graph of an object with named nodes & materials.
|
|
1664
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1663
1665
|
*/
|
|
1664
1666
|
function useGraph(object) {
|
|
1665
1667
|
return React__namespace.useMemo(() => buildGraph(object), [object]);
|
|
@@ -1682,11 +1684,11 @@ function loadingFn(extensions, onProgress) {
|
|
|
1682
1684
|
};
|
|
1683
1685
|
}
|
|
1684
1686
|
|
|
1685
|
-
/**
|
|
1686
|
-
* Synchronously loads and caches assets with a three loader.
|
|
1687
|
-
*
|
|
1688
|
-
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1689
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1687
|
+
/**
|
|
1688
|
+
* Synchronously loads and caches assets with a three loader.
|
|
1689
|
+
*
|
|
1690
|
+
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1691
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1690
1692
|
*/
|
|
1691
1693
|
function useLoader(Proto, input, extensions, onProgress) {
|
|
1692
1694
|
// Use suspense to load async assets
|
|
@@ -1698,16 +1700,16 @@ function useLoader(Proto, input, extensions, onProgress) {
|
|
|
1698
1700
|
return Array.isArray(input) ? results : results[0];
|
|
1699
1701
|
}
|
|
1700
1702
|
|
|
1701
|
-
/**
|
|
1702
|
-
* Preloads an asset into cache as a side-effect.
|
|
1703
|
+
/**
|
|
1704
|
+
* Preloads an asset into cache as a side-effect.
|
|
1703
1705
|
*/
|
|
1704
1706
|
useLoader.preload = function (Proto, input, extensions) {
|
|
1705
1707
|
const keys = Array.isArray(input) ? input : [input];
|
|
1706
1708
|
return suspendReact.preload(loadingFn(extensions), [Proto, ...keys]);
|
|
1707
1709
|
};
|
|
1708
1710
|
|
|
1709
|
-
/**
|
|
1710
|
-
* Removes a loaded asset from cache.
|
|
1711
|
+
/**
|
|
1712
|
+
* Removes a loaded asset from cache.
|
|
1711
1713
|
*/
|
|
1712
1714
|
useLoader.clear = function (Proto, input) {
|
|
1713
1715
|
const keys = Array.isArray(input) ? input : [input];
|
|
@@ -2082,10 +2084,10 @@ function Portal({
|
|
|
2082
2084
|
children,
|
|
2083
2085
|
container
|
|
2084
2086
|
}) {
|
|
2085
|
-
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2086
|
-
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2087
|
-
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2088
|
-
* <Canvas>
|
|
2087
|
+
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2088
|
+
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2089
|
+
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2090
|
+
* <Canvas>
|
|
2089
2091
|
* {createPortal(...)} */
|
|
2090
2092
|
const {
|
|
2091
2093
|
events,
|
|
@@ -2211,6 +2213,7 @@ exports.addEffect = addEffect;
|
|
|
2211
2213
|
exports.addTail = addTail;
|
|
2212
2214
|
exports.advance = advance;
|
|
2213
2215
|
exports.applyProps = applyProps;
|
|
2216
|
+
exports.buildGraph = buildGraph;
|
|
2214
2217
|
exports.context = context;
|
|
2215
2218
|
exports.createEvents = createEvents;
|
|
2216
2219
|
exports.createPortal = createPortal;
|
|
@@ -347,12 +347,12 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
var _window$document, _window$navigator;
|
|
350
|
-
/**
|
|
351
|
-
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
350
|
+
/**
|
|
351
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
352
352
|
*/
|
|
353
353
|
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
354
|
-
/**
|
|
355
|
-
* The current THREE.ColorManagement instance, if present.
|
|
354
|
+
/**
|
|
355
|
+
* The current THREE.ColorManagement instance, if present.
|
|
356
356
|
*/
|
|
357
357
|
const getColorManagement = () => {
|
|
358
358
|
var _ColorManagement;
|
|
@@ -361,14 +361,14 @@ const getColorManagement = () => {
|
|
|
361
361
|
const isOrthographicCamera = def => def && def.isOrthographicCamera;
|
|
362
362
|
const isRef = obj => obj && obj.hasOwnProperty('current');
|
|
363
363
|
|
|
364
|
-
/**
|
|
365
|
-
* An SSR-friendly useLayoutEffect.
|
|
366
|
-
*
|
|
367
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
368
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
369
|
-
* useLayoutEffect elsewhere.
|
|
370
|
-
*
|
|
371
|
-
* @see https://github.com/facebook/react/issues/14927
|
|
364
|
+
/**
|
|
365
|
+
* An SSR-friendly useLayoutEffect.
|
|
366
|
+
*
|
|
367
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
368
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
369
|
+
* useLayoutEffect elsewhere.
|
|
370
|
+
*
|
|
371
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
372
372
|
*/
|
|
373
373
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React.useLayoutEffect : React.useEffect;
|
|
374
374
|
function useMutableCallback(fn) {
|
|
@@ -413,8 +413,8 @@ function calculateDpr(dpr) {
|
|
|
413
413
|
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
/**
|
|
417
|
-
* Returns instance root state
|
|
416
|
+
/**
|
|
417
|
+
* Returns instance root state
|
|
418
418
|
*/
|
|
419
419
|
const getRootState = obj => {
|
|
420
420
|
var _r3f;
|
|
@@ -470,7 +470,9 @@ const is = {
|
|
|
470
470
|
}
|
|
471
471
|
};
|
|
472
472
|
|
|
473
|
-
|
|
473
|
+
/**
|
|
474
|
+
* Collects nodes and materials from a THREE.Object3D.
|
|
475
|
+
*/
|
|
474
476
|
function buildGraph(object) {
|
|
475
477
|
const data = {
|
|
476
478
|
nodes: {},
|
|
@@ -809,9 +811,9 @@ function getEventPriority() {
|
|
|
809
811
|
}
|
|
810
812
|
}
|
|
811
813
|
|
|
812
|
-
/**
|
|
813
|
-
* Release pointer captures.
|
|
814
|
-
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
814
|
+
/**
|
|
815
|
+
* Release pointer captures.
|
|
816
|
+
* This is called by releasePointerCapture in the API, and when an object is removed.
|
|
815
817
|
*/
|
|
816
818
|
function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
817
819
|
const captureData = captures.get(obj);
|
|
@@ -1146,19 +1148,19 @@ function createEvents(store) {
|
|
|
1146
1148
|
// Check presence of handlers
|
|
1147
1149
|
if (!(instance != null && instance.eventCount)) return;
|
|
1148
1150
|
|
|
1149
|
-
/*
|
|
1150
|
-
MAYBE TODO, DELETE IF NOT:
|
|
1151
|
-
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1152
|
-
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1153
|
-
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1154
|
-
|
|
1155
|
-
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1156
|
-
if (pointerId !== undefined) {
|
|
1157
|
-
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1158
|
-
if (capturedMeshSet) {
|
|
1159
|
-
const captured = capturedMeshSet.get(eventObject)
|
|
1160
|
-
if (captured && captured.localState.stopped) return
|
|
1161
|
-
}
|
|
1151
|
+
/*
|
|
1152
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1153
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1154
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1155
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1156
|
+
|
|
1157
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1158
|
+
if (pointerId !== undefined) {
|
|
1159
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1160
|
+
if (capturedMeshSet) {
|
|
1161
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1162
|
+
if (captured && captured.localState.stopped) return
|
|
1163
|
+
}
|
|
1162
1164
|
}*/
|
|
1163
1165
|
|
|
1164
1166
|
if (isPointerMove) {
|
|
@@ -1464,21 +1466,21 @@ let globalEffects = new Set();
|
|
|
1464
1466
|
let globalAfterEffects = new Set();
|
|
1465
1467
|
let globalTailEffects = new Set();
|
|
1466
1468
|
|
|
1467
|
-
/**
|
|
1468
|
-
* Adds a global render callback which is called each frame.
|
|
1469
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1469
|
+
/**
|
|
1470
|
+
* Adds a global render callback which is called each frame.
|
|
1471
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
|
|
1470
1472
|
*/
|
|
1471
1473
|
const addEffect = callback => createSubs(callback, globalEffects);
|
|
1472
1474
|
|
|
1473
|
-
/**
|
|
1474
|
-
* Adds a global after-render callback which is called each frame.
|
|
1475
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1475
|
+
/**
|
|
1476
|
+
* Adds a global after-render callback which is called each frame.
|
|
1477
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
|
|
1476
1478
|
*/
|
|
1477
1479
|
const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
|
|
1478
1480
|
|
|
1479
|
-
/**
|
|
1480
|
-
* Adds a global callback which is called when rendering stops.
|
|
1481
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1481
|
+
/**
|
|
1482
|
+
* Adds a global callback which is called when rendering stops.
|
|
1483
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
|
|
1482
1484
|
*/
|
|
1483
1485
|
const addTail = callback => createSubs(callback, globalTailEffects);
|
|
1484
1486
|
function run(effects, timestamp) {
|
|
@@ -1577,24 +1579,24 @@ function createLoop(roots) {
|
|
|
1577
1579
|
}
|
|
1578
1580
|
return {
|
|
1579
1581
|
loop,
|
|
1580
|
-
/**
|
|
1581
|
-
* Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
|
|
1582
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
|
|
1582
|
+
/**
|
|
1583
|
+
* Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
|
|
1584
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
|
|
1583
1585
|
*/
|
|
1584
1586
|
invalidate,
|
|
1585
|
-
/**
|
|
1586
|
-
* Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
|
|
1587
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
1587
|
+
/**
|
|
1588
|
+
* Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
|
|
1589
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
1588
1590
|
*/
|
|
1589
1591
|
advance
|
|
1590
1592
|
};
|
|
1591
1593
|
}
|
|
1592
1594
|
|
|
1593
|
-
/**
|
|
1594
|
-
* Exposes an object's {@link LocalState}.
|
|
1595
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1596
|
-
*
|
|
1597
|
-
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1595
|
+
/**
|
|
1596
|
+
* Exposes an object's {@link LocalState}.
|
|
1597
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
1598
|
+
*
|
|
1599
|
+
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
1598
1600
|
*/
|
|
1599
1601
|
function useInstanceHandle(ref) {
|
|
1600
1602
|
const instance = React.useRef(null);
|
|
@@ -1607,18 +1609,18 @@ function useStore() {
|
|
|
1607
1609
|
return store;
|
|
1608
1610
|
}
|
|
1609
1611
|
|
|
1610
|
-
/**
|
|
1611
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1612
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1612
|
+
/**
|
|
1613
|
+
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
1614
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
1613
1615
|
*/
|
|
1614
1616
|
function useThree(selector = state => state, equalityFn) {
|
|
1615
1617
|
return useStore()(selector, equalityFn);
|
|
1616
1618
|
}
|
|
1617
1619
|
|
|
1618
|
-
/**
|
|
1619
|
-
* Executes a callback before render in a shared frame loop.
|
|
1620
|
-
* Can order effects with render priority or manually render with a positive priority.
|
|
1621
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1620
|
+
/**
|
|
1621
|
+
* Executes a callback before render in a shared frame loop.
|
|
1622
|
+
* Can order effects with render priority or manually render with a positive priority.
|
|
1623
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1622
1624
|
*/
|
|
1623
1625
|
function useFrame(callback, renderPriority = 0) {
|
|
1624
1626
|
const store = useStore();
|
|
@@ -1630,9 +1632,9 @@ function useFrame(callback, renderPriority = 0) {
|
|
|
1630
1632
|
return null;
|
|
1631
1633
|
}
|
|
1632
1634
|
|
|
1633
|
-
/**
|
|
1634
|
-
* Returns a node graph of an object with named nodes & materials.
|
|
1635
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1635
|
+
/**
|
|
1636
|
+
* Returns a node graph of an object with named nodes & materials.
|
|
1637
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
1636
1638
|
*/
|
|
1637
1639
|
function useGraph(object) {
|
|
1638
1640
|
return React.useMemo(() => buildGraph(object), [object]);
|
|
@@ -1655,11 +1657,11 @@ function loadingFn(extensions, onProgress) {
|
|
|
1655
1657
|
};
|
|
1656
1658
|
}
|
|
1657
1659
|
|
|
1658
|
-
/**
|
|
1659
|
-
* Synchronously loads and caches assets with a three loader.
|
|
1660
|
-
*
|
|
1661
|
-
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1662
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1660
|
+
/**
|
|
1661
|
+
* Synchronously loads and caches assets with a three loader.
|
|
1662
|
+
*
|
|
1663
|
+
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1664
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1663
1665
|
*/
|
|
1664
1666
|
function useLoader(Proto, input, extensions, onProgress) {
|
|
1665
1667
|
// Use suspense to load async assets
|
|
@@ -1671,16 +1673,16 @@ function useLoader(Proto, input, extensions, onProgress) {
|
|
|
1671
1673
|
return Array.isArray(input) ? results : results[0];
|
|
1672
1674
|
}
|
|
1673
1675
|
|
|
1674
|
-
/**
|
|
1675
|
-
* Preloads an asset into cache as a side-effect.
|
|
1676
|
+
/**
|
|
1677
|
+
* Preloads an asset into cache as a side-effect.
|
|
1676
1678
|
*/
|
|
1677
1679
|
useLoader.preload = function (Proto, input, extensions) {
|
|
1678
1680
|
const keys = Array.isArray(input) ? input : [input];
|
|
1679
1681
|
return preload(loadingFn(extensions), [Proto, ...keys]);
|
|
1680
1682
|
};
|
|
1681
1683
|
|
|
1682
|
-
/**
|
|
1683
|
-
* Removes a loaded asset from cache.
|
|
1684
|
+
/**
|
|
1685
|
+
* Removes a loaded asset from cache.
|
|
1684
1686
|
*/
|
|
1685
1687
|
useLoader.clear = function (Proto, input) {
|
|
1686
1688
|
const keys = Array.isArray(input) ? input : [input];
|
|
@@ -2055,10 +2057,10 @@ function Portal({
|
|
|
2055
2057
|
children,
|
|
2056
2058
|
container
|
|
2057
2059
|
}) {
|
|
2058
|
-
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2059
|
-
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2060
|
-
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2061
|
-
* <Canvas>
|
|
2060
|
+
/** This has to be a component because it would not be able to call useThree/useStore otherwise since
|
|
2061
|
+
* if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
|
|
2062
|
+
* the "R3F hooks can only be used within the Canvas component!" warning:
|
|
2063
|
+
* <Canvas>
|
|
2062
2064
|
* {createPortal(...)} */
|
|
2063
2065
|
const {
|
|
2064
2066
|
events,
|
|
@@ -2176,4 +2178,4 @@ reconciler.injectIntoDevTools({
|
|
|
2176
2178
|
});
|
|
2177
2179
|
const act = React.unstable_act;
|
|
2178
2180
|
|
|
2179
|
-
export {
|
|
2181
|
+
export { useThree as A, Block as B, useFrame as C, useGraph as D, ErrorBoundary as E, useLoader as F, useIsomorphicLayoutEffect as a, createRoot as b, createEvents as c, unmountComponentAtNode as d, extend as e, context as f, createPortal as g, reconciler as h, isRef as i, applyProps as j, dispose as k, invalidate as l, advance as m, addEffect as n, addAfterEffect as o, addTail as p, flushGlobalEffects as q, render as r, getRootState as s, threeTypes as t, useMutableCallback as u, act as v, buildGraph as w, roots as x, useInstanceHandle as y, useStore as z };
|