@react-three/fiber 8.15.0 → 8.15.2
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 +12 -0
- package/dist/declarations/src/core/loop.d.ts +1 -2
- package/dist/declarations/src/core/store.d.ts +2 -2
- package/dist/declarations/src/core/utils.d.ts +6 -0
- package/dist/declarations/src/three-types.d.ts +1 -1
- package/dist/{index-5918012a.esm.js → index-594193f5.esm.js} +26 -5
- package/dist/{index-34a45f4c.cjs.dev.js → index-d26c5c57.cjs.dev.js} +26 -5
- package/dist/{index-f4d4539a.cjs.prod.js → index-e6d64601.cjs.prod.js} +26 -5
- package/dist/react-three-fiber.cjs.dev.js +1 -1
- package/dist/react-three-fiber.cjs.prod.js +1 -1
- package/dist/react-three-fiber.esm.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +9 -6
- package/native/dist/react-three-fiber-native.cjs.prod.js +9 -6
- package/native/dist/react-three-fiber-native.esm.js +10 -7
- package/package.json +2 -1
- package/yarn-error.log +0 -10628
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.15.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 086d3932: fix: size check and raycaster camera
|
|
8
|
+
|
|
9
|
+
## 8.15.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2d39676d: fix: ignore deprecated types, use correct XRFrame definition
|
|
14
|
+
|
|
3
15
|
## 8.15.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
1
|
import { Root } from './renderer';
|
|
3
2
|
import { RootState } from './store';
|
|
4
3
|
export declare type GlobalRenderCallback = (timeStamp: number) => void;
|
|
@@ -10,5 +9,5 @@ export declare function flushGlobalEffects(type: GlobalEffectType, timestamp: nu
|
|
|
10
9
|
export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
11
10
|
loop: (timestamp: number) => void;
|
|
12
11
|
invalidate: (state?: RootState | undefined, frames?: number) => void;
|
|
13
|
-
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?:
|
|
12
|
+
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: import("three").XRFrame | undefined) => void;
|
|
14
13
|
};
|
|
@@ -2,7 +2,7 @@ import * as THREE from 'three';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GetState, SetState, StoreApi, UseBoundStore } from 'zustand';
|
|
4
4
|
import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from './events';
|
|
5
|
-
import { Camera } from './utils';
|
|
5
|
+
import { _XRFrame, Camera } from './utils';
|
|
6
6
|
export declare const privateKeys: readonly ["set", "get", "setSize", "setFrameloop", "setDpr", "events", "invalidate", "advance", "size", "viewport"];
|
|
7
7
|
export declare type PrivateKeys = typeof privateKeys[number];
|
|
8
8
|
export interface Intersection extends THREE.Intersection {
|
|
@@ -28,7 +28,7 @@ export declare type Viewport = Size & {
|
|
|
28
28
|
distance: number;
|
|
29
29
|
aspect: number;
|
|
30
30
|
};
|
|
31
|
-
export declare type RenderCallback = (state: RootState, delta: number, frame?:
|
|
31
|
+
export declare type RenderCallback = (state: RootState, delta: number, frame?: _XRFrame) => void;
|
|
32
32
|
export declare type Performance = {
|
|
33
33
|
current: number;
|
|
34
34
|
min: number;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/// <reference types="webxr" />
|
|
1
2
|
import * as THREE from 'three';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { AttachType, Instance, InstanceProps, LocalState } from './renderer';
|
|
4
5
|
import { Dpr, Renderer, RootState, Size } from './store';
|
|
6
|
+
declare type _DeprecatedXRFrame = THREE.XRFrame;
|
|
7
|
+
export declare type _XRFrame = THREE.WebGLRenderTargetOptions extends {
|
|
8
|
+
samples?: number;
|
|
9
|
+
} ? XRFrame : _DeprecatedXRFrame;
|
|
5
10
|
export declare const hasColorSpace: <T extends object | Renderer | THREE.Texture, P = T extends Renderer ? {
|
|
6
11
|
outputColorSpace: string;
|
|
7
12
|
} : {
|
|
@@ -92,3 +97,4 @@ export declare function updateInstance(instance: Instance): void;
|
|
|
92
97
|
export declare function updateCamera(camera: Camera & {
|
|
93
98
|
manual?: boolean;
|
|
94
99
|
}, size: Size): void;
|
|
100
|
+
export {};
|
|
@@ -105,7 +105,7 @@ export declare type ConeGeometryProps = BufferGeometryNode<THREE.ConeGeometry, t
|
|
|
105
105
|
export declare type CylinderGeometryProps = BufferGeometryNode<THREE.CylinderGeometry, typeof THREE.CylinderGeometry>;
|
|
106
106
|
export declare type CircleGeometryProps = BufferGeometryNode<THREE.CircleGeometry, typeof THREE.CircleGeometry>;
|
|
107
107
|
export declare type BoxGeometryProps = BufferGeometryNode<THREE.BoxGeometry, typeof THREE.BoxGeometry>;
|
|
108
|
-
export declare type CapsuleGeometryProps = BufferGeometryNode<THREE.
|
|
108
|
+
export declare type CapsuleGeometryProps = BufferGeometryNode<THREE.CapsuleGeometry, typeof THREE.CapsuleGeometry>;
|
|
109
109
|
export declare type MaterialProps = MaterialNode<THREE.Material, [THREE.MaterialParameters]>;
|
|
110
110
|
export declare type ShadowMaterialProps = MaterialNode<THREE.ShadowMaterial, [THREE.ShaderMaterialParameters]>;
|
|
111
111
|
export declare type SpriteMaterialProps = MaterialNode<THREE.SpriteMaterial, [THREE.SpriteMaterialParameters]>;
|
|
@@ -1423,7 +1423,7 @@ const createStore = (invalidate, advance) => {
|
|
|
1423
1423
|
} = rootState.getState();
|
|
1424
1424
|
|
|
1425
1425
|
// Resize camera and renderer on changes to size and pixelratio
|
|
1426
|
-
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1426
|
+
if (size.width !== oldSize.width || size.height !== oldSize.height || viewport.dpr !== oldDpr) {
|
|
1427
1427
|
var _size$updateStyle;
|
|
1428
1428
|
oldSize = size;
|
|
1429
1429
|
oldDpr = viewport.dpr;
|
|
@@ -1713,8 +1713,23 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
};
|
|
1715
1715
|
function computeInitialSize(canvas, defaultSize) {
|
|
1716
|
-
|
|
1717
|
-
if (
|
|
1716
|
+
const defaultStyle = typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement;
|
|
1717
|
+
if (defaultSize) {
|
|
1718
|
+
const {
|
|
1719
|
+
width,
|
|
1720
|
+
height,
|
|
1721
|
+
top,
|
|
1722
|
+
left,
|
|
1723
|
+
updateStyle = defaultStyle
|
|
1724
|
+
} = defaultSize;
|
|
1725
|
+
return {
|
|
1726
|
+
width,
|
|
1727
|
+
height,
|
|
1728
|
+
top,
|
|
1729
|
+
left,
|
|
1730
|
+
updateStyle
|
|
1731
|
+
};
|
|
1732
|
+
} else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {
|
|
1718
1733
|
const {
|
|
1719
1734
|
width,
|
|
1720
1735
|
height,
|
|
@@ -1725,14 +1740,16 @@ function computeInitialSize(canvas, defaultSize) {
|
|
|
1725
1740
|
width,
|
|
1726
1741
|
height,
|
|
1727
1742
|
top,
|
|
1728
|
-
left
|
|
1743
|
+
left,
|
|
1744
|
+
updateStyle: defaultStyle
|
|
1729
1745
|
};
|
|
1730
1746
|
} else if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
1731
1747
|
return {
|
|
1732
1748
|
width: canvas.width,
|
|
1733
1749
|
height: canvas.height,
|
|
1734
1750
|
top: 0,
|
|
1735
|
-
left: 0
|
|
1751
|
+
left: 0,
|
|
1752
|
+
updateStyle: defaultStyle
|
|
1736
1753
|
};
|
|
1737
1754
|
}
|
|
1738
1755
|
return {
|
|
@@ -1835,6 +1852,10 @@ function createRoot(canvas) {
|
|
|
1835
1852
|
state.set({
|
|
1836
1853
|
camera
|
|
1837
1854
|
});
|
|
1855
|
+
|
|
1856
|
+
// Configure raycaster
|
|
1857
|
+
// https://github.com/pmndrs/react-xr/issues/300
|
|
1858
|
+
raycaster.camera = camera;
|
|
1838
1859
|
}
|
|
1839
1860
|
|
|
1840
1861
|
// Set up scene (one time only!)
|
|
@@ -1450,7 +1450,7 @@ const createStore = (invalidate, advance) => {
|
|
|
1450
1450
|
} = rootState.getState();
|
|
1451
1451
|
|
|
1452
1452
|
// Resize camera and renderer on changes to size and pixelratio
|
|
1453
|
-
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1453
|
+
if (size.width !== oldSize.width || size.height !== oldSize.height || viewport.dpr !== oldDpr) {
|
|
1454
1454
|
var _size$updateStyle;
|
|
1455
1455
|
oldSize = size;
|
|
1456
1456
|
oldDpr = viewport.dpr;
|
|
@@ -1740,8 +1740,23 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1740
1740
|
});
|
|
1741
1741
|
};
|
|
1742
1742
|
function computeInitialSize(canvas, defaultSize) {
|
|
1743
|
-
|
|
1744
|
-
if (
|
|
1743
|
+
const defaultStyle = typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement;
|
|
1744
|
+
if (defaultSize) {
|
|
1745
|
+
const {
|
|
1746
|
+
width,
|
|
1747
|
+
height,
|
|
1748
|
+
top,
|
|
1749
|
+
left,
|
|
1750
|
+
updateStyle = defaultStyle
|
|
1751
|
+
} = defaultSize;
|
|
1752
|
+
return {
|
|
1753
|
+
width,
|
|
1754
|
+
height,
|
|
1755
|
+
top,
|
|
1756
|
+
left,
|
|
1757
|
+
updateStyle
|
|
1758
|
+
};
|
|
1759
|
+
} else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {
|
|
1745
1760
|
const {
|
|
1746
1761
|
width,
|
|
1747
1762
|
height,
|
|
@@ -1752,14 +1767,16 @@ function computeInitialSize(canvas, defaultSize) {
|
|
|
1752
1767
|
width,
|
|
1753
1768
|
height,
|
|
1754
1769
|
top,
|
|
1755
|
-
left
|
|
1770
|
+
left,
|
|
1771
|
+
updateStyle: defaultStyle
|
|
1756
1772
|
};
|
|
1757
1773
|
} else if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
1758
1774
|
return {
|
|
1759
1775
|
width: canvas.width,
|
|
1760
1776
|
height: canvas.height,
|
|
1761
1777
|
top: 0,
|
|
1762
|
-
left: 0
|
|
1778
|
+
left: 0,
|
|
1779
|
+
updateStyle: defaultStyle
|
|
1763
1780
|
};
|
|
1764
1781
|
}
|
|
1765
1782
|
return {
|
|
@@ -1862,6 +1879,10 @@ function createRoot(canvas) {
|
|
|
1862
1879
|
state.set({
|
|
1863
1880
|
camera
|
|
1864
1881
|
});
|
|
1882
|
+
|
|
1883
|
+
// Configure raycaster
|
|
1884
|
+
// https://github.com/pmndrs/react-xr/issues/300
|
|
1885
|
+
raycaster.camera = camera;
|
|
1865
1886
|
}
|
|
1866
1887
|
|
|
1867
1888
|
// Set up scene (one time only!)
|
|
@@ -1450,7 +1450,7 @@ const createStore = (invalidate, advance) => {
|
|
|
1450
1450
|
} = rootState.getState();
|
|
1451
1451
|
|
|
1452
1452
|
// Resize camera and renderer on changes to size and pixelratio
|
|
1453
|
-
if (size !== oldSize || viewport.dpr !== oldDpr) {
|
|
1453
|
+
if (size.width !== oldSize.width || size.height !== oldSize.height || viewport.dpr !== oldDpr) {
|
|
1454
1454
|
var _size$updateStyle;
|
|
1455
1455
|
oldSize = size;
|
|
1456
1456
|
oldDpr = viewport.dpr;
|
|
@@ -1740,8 +1740,23 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1740
1740
|
});
|
|
1741
1741
|
};
|
|
1742
1742
|
function computeInitialSize(canvas, defaultSize) {
|
|
1743
|
-
|
|
1744
|
-
if (
|
|
1743
|
+
const defaultStyle = typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement;
|
|
1744
|
+
if (defaultSize) {
|
|
1745
|
+
const {
|
|
1746
|
+
width,
|
|
1747
|
+
height,
|
|
1748
|
+
top,
|
|
1749
|
+
left,
|
|
1750
|
+
updateStyle = defaultStyle
|
|
1751
|
+
} = defaultSize;
|
|
1752
|
+
return {
|
|
1753
|
+
width,
|
|
1754
|
+
height,
|
|
1755
|
+
top,
|
|
1756
|
+
left,
|
|
1757
|
+
updateStyle
|
|
1758
|
+
};
|
|
1759
|
+
} else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {
|
|
1745
1760
|
const {
|
|
1746
1761
|
width,
|
|
1747
1762
|
height,
|
|
@@ -1752,14 +1767,16 @@ function computeInitialSize(canvas, defaultSize) {
|
|
|
1752
1767
|
width,
|
|
1753
1768
|
height,
|
|
1754
1769
|
top,
|
|
1755
|
-
left
|
|
1770
|
+
left,
|
|
1771
|
+
updateStyle: defaultStyle
|
|
1756
1772
|
};
|
|
1757
1773
|
} else if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
1758
1774
|
return {
|
|
1759
1775
|
width: canvas.width,
|
|
1760
1776
|
height: canvas.height,
|
|
1761
1777
|
top: 0,
|
|
1762
|
-
left: 0
|
|
1778
|
+
left: 0,
|
|
1779
|
+
updateStyle: defaultStyle
|
|
1763
1780
|
};
|
|
1764
1781
|
}
|
|
1765
1782
|
return {
|
|
@@ -1862,6 +1879,10 @@ function createRoot(canvas) {
|
|
|
1862
1879
|
state.set({
|
|
1863
1880
|
camera
|
|
1864
1881
|
});
|
|
1882
|
+
|
|
1883
|
+
// Configure raycaster
|
|
1884
|
+
// https://github.com/pmndrs/react-xr/issues/300
|
|
1885
|
+
raycaster.camera = camera;
|
|
1865
1886
|
}
|
|
1866
1887
|
|
|
1867
1888
|
// Set up scene (one time only!)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-d26c5c57.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-e6d64601.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-594193f5.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-594193f5.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-d26c5c57.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -283,6 +283,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(p
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
function polyfills() {
|
|
286
|
+
// http://stackoverflow.com/questions/105034
|
|
286
287
|
function uuidv4() {
|
|
287
288
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
288
289
|
const r = Math.random() * 16 | 0,
|
|
@@ -292,6 +293,7 @@ function polyfills() {
|
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
// Patch Blob for ArrayBuffer if unsupported
|
|
296
|
+
// https://github.com/facebook/react-native/pull/39276
|
|
295
297
|
try {
|
|
296
298
|
new Blob([new ArrayBuffer(4)]);
|
|
297
299
|
} catch (_) {
|
|
@@ -360,7 +362,7 @@ function polyfills() {
|
|
|
360
362
|
|
|
361
363
|
// Create safe URI for JSI
|
|
362
364
|
if (input.startsWith('data:')) {
|
|
363
|
-
const [header, data] = input.split(',');
|
|
365
|
+
const [header, data] = input.split(';base64,');
|
|
364
366
|
const [, type] = header.split('/');
|
|
365
367
|
const uri = fs__namespace.cacheDirectory + uuidv4() + `.${type}`;
|
|
366
368
|
await fs__namespace.writeAsStringAsync(uri, data, {
|
|
@@ -396,6 +398,7 @@ function polyfills() {
|
|
|
396
398
|
this.manager.itemStart(url);
|
|
397
399
|
const texture = new THREE__namespace.Texture();
|
|
398
400
|
getAsset(url).then(async uri => {
|
|
401
|
+
// https://github.com/expo/expo-three/pull/266
|
|
399
402
|
const {
|
|
400
403
|
width,
|
|
401
404
|
height
|
|
@@ -404,17 +407,17 @@ function polyfills() {
|
|
|
404
407
|
height
|
|
405
408
|
}), rej));
|
|
406
409
|
texture.image = {
|
|
410
|
+
// Special case for EXGLImageUtils::loadImage
|
|
407
411
|
data: {
|
|
408
412
|
localUri: uri
|
|
409
413
|
},
|
|
410
414
|
width,
|
|
411
415
|
height
|
|
412
416
|
};
|
|
413
|
-
texture.flipY = true;
|
|
414
|
-
texture.unpackAlignment = 1;
|
|
417
|
+
texture.flipY = true; // Since expo-gl@12.4.0
|
|
415
418
|
texture.needsUpdate = true;
|
|
416
419
|
|
|
417
|
-
// Force non-DOM upload for EXGL
|
|
420
|
+
// Force non-DOM upload for EXGL texImage2D
|
|
418
421
|
// @ts-ignore
|
|
419
422
|
texture.isDataTexture = true;
|
|
420
423
|
onLoad == null ? void 0 : onLoad(texture);
|
|
@@ -427,7 +430,7 @@ function polyfills() {
|
|
|
427
430
|
return texture;
|
|
428
431
|
};
|
|
429
432
|
|
|
430
|
-
// Fetches assets via
|
|
433
|
+
// Fetches assets via FS
|
|
431
434
|
THREE__namespace.FileLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
432
435
|
if (this.path && typeof url === 'string') url = this.path + url;
|
|
433
436
|
this.manager.itemStart(url);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-e6d64601.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -283,6 +283,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(p
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
function polyfills() {
|
|
286
|
+
// http://stackoverflow.com/questions/105034
|
|
286
287
|
function uuidv4() {
|
|
287
288
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
288
289
|
const r = Math.random() * 16 | 0,
|
|
@@ -292,6 +293,7 @@ function polyfills() {
|
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
// Patch Blob for ArrayBuffer if unsupported
|
|
296
|
+
// https://github.com/facebook/react-native/pull/39276
|
|
295
297
|
try {
|
|
296
298
|
new Blob([new ArrayBuffer(4)]);
|
|
297
299
|
} catch (_) {
|
|
@@ -360,7 +362,7 @@ function polyfills() {
|
|
|
360
362
|
|
|
361
363
|
// Create safe URI for JSI
|
|
362
364
|
if (input.startsWith('data:')) {
|
|
363
|
-
const [header, data] = input.split(',');
|
|
365
|
+
const [header, data] = input.split(';base64,');
|
|
364
366
|
const [, type] = header.split('/');
|
|
365
367
|
const uri = fs__namespace.cacheDirectory + uuidv4() + `.${type}`;
|
|
366
368
|
await fs__namespace.writeAsStringAsync(uri, data, {
|
|
@@ -396,6 +398,7 @@ function polyfills() {
|
|
|
396
398
|
this.manager.itemStart(url);
|
|
397
399
|
const texture = new THREE__namespace.Texture();
|
|
398
400
|
getAsset(url).then(async uri => {
|
|
401
|
+
// https://github.com/expo/expo-three/pull/266
|
|
399
402
|
const {
|
|
400
403
|
width,
|
|
401
404
|
height
|
|
@@ -404,17 +407,17 @@ function polyfills() {
|
|
|
404
407
|
height
|
|
405
408
|
}), rej));
|
|
406
409
|
texture.image = {
|
|
410
|
+
// Special case for EXGLImageUtils::loadImage
|
|
407
411
|
data: {
|
|
408
412
|
localUri: uri
|
|
409
413
|
},
|
|
410
414
|
width,
|
|
411
415
|
height
|
|
412
416
|
};
|
|
413
|
-
texture.flipY = true;
|
|
414
|
-
texture.unpackAlignment = 1;
|
|
417
|
+
texture.flipY = true; // Since expo-gl@12.4.0
|
|
415
418
|
texture.needsUpdate = true;
|
|
416
419
|
|
|
417
|
-
// Force non-DOM upload for EXGL
|
|
420
|
+
// Force non-DOM upload for EXGL texImage2D
|
|
418
421
|
// @ts-ignore
|
|
419
422
|
texture.isDataTexture = true;
|
|
420
423
|
onLoad == null ? void 0 : onLoad(texture);
|
|
@@ -427,7 +430,7 @@ function polyfills() {
|
|
|
427
430
|
return texture;
|
|
428
431
|
};
|
|
429
432
|
|
|
430
|
-
// Fetches assets via
|
|
433
|
+
// Fetches assets via FS
|
|
431
434
|
THREE__namespace.FileLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
432
435
|
if (this.path && typeof url === 'string') url = this.path + url;
|
|
433
436
|
this.manager.itemStart(url);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-594193f5.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-594193f5.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -258,6 +258,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref)
|
|
|
258
258
|
});
|
|
259
259
|
|
|
260
260
|
function polyfills() {
|
|
261
|
+
// http://stackoverflow.com/questions/105034
|
|
261
262
|
function uuidv4() {
|
|
262
263
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
263
264
|
const r = Math.random() * 16 | 0,
|
|
@@ -267,6 +268,7 @@ function polyfills() {
|
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
// Patch Blob for ArrayBuffer if unsupported
|
|
271
|
+
// https://github.com/facebook/react-native/pull/39276
|
|
270
272
|
try {
|
|
271
273
|
new Blob([new ArrayBuffer(4)]);
|
|
272
274
|
} catch (_) {
|
|
@@ -335,7 +337,7 @@ function polyfills() {
|
|
|
335
337
|
|
|
336
338
|
// Create safe URI for JSI
|
|
337
339
|
if (input.startsWith('data:')) {
|
|
338
|
-
const [header, data] = input.split(',');
|
|
340
|
+
const [header, data] = input.split(';base64,');
|
|
339
341
|
const [, type] = header.split('/');
|
|
340
342
|
const uri = fs.cacheDirectory + uuidv4() + `.${type}`;
|
|
341
343
|
await fs.writeAsStringAsync(uri, data, {
|
|
@@ -371,6 +373,7 @@ function polyfills() {
|
|
|
371
373
|
this.manager.itemStart(url);
|
|
372
374
|
const texture = new THREE.Texture();
|
|
373
375
|
getAsset(url).then(async uri => {
|
|
376
|
+
// https://github.com/expo/expo-three/pull/266
|
|
374
377
|
const {
|
|
375
378
|
width,
|
|
376
379
|
height
|
|
@@ -379,17 +382,17 @@ function polyfills() {
|
|
|
379
382
|
height
|
|
380
383
|
}), rej));
|
|
381
384
|
texture.image = {
|
|
385
|
+
// Special case for EXGLImageUtils::loadImage
|
|
382
386
|
data: {
|
|
383
387
|
localUri: uri
|
|
384
388
|
},
|
|
385
389
|
width,
|
|
386
390
|
height
|
|
387
391
|
};
|
|
388
|
-
texture.flipY = true;
|
|
389
|
-
texture.unpackAlignment = 1;
|
|
392
|
+
texture.flipY = true; // Since expo-gl@12.4.0
|
|
390
393
|
texture.needsUpdate = true;
|
|
391
394
|
|
|
392
|
-
// Force non-DOM upload for EXGL
|
|
395
|
+
// Force non-DOM upload for EXGL texImage2D
|
|
393
396
|
// @ts-ignore
|
|
394
397
|
texture.isDataTexture = true;
|
|
395
398
|
onLoad == null ? void 0 : onLoad(texture);
|
|
@@ -402,7 +405,7 @@ function polyfills() {
|
|
|
402
405
|
return texture;
|
|
403
406
|
};
|
|
404
407
|
|
|
405
|
-
// Fetches assets via
|
|
408
|
+
// Fetches assets via FS
|
|
406
409
|
THREE.FileLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
407
410
|
if (this.path && typeof url === 'string') url = this.path + url;
|
|
408
411
|
this.manager.itemStart(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "8.15.
|
|
3
|
+
"version": "8.15.2",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.17.8",
|
|
46
46
|
"@types/react-reconciler": "^0.26.7",
|
|
47
|
+
"@types/webxr": "*",
|
|
47
48
|
"base64-js": "^1.5.1",
|
|
48
49
|
"buffer": "^6.0.3",
|
|
49
50
|
"its-fine": "^1.0.6",
|