Skip to content

Commit aee1a6e

Browse files
committed
Upgrade
Everything is mostly working but: - Leva is weirdly small. Waiting until they get things working on R18 here. pmndrs/leva#330
1 parent a82c228 commit aee1a6e

33 files changed

+285
-249
lines changed

.babelrc

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2-
"presets": ["next/babel"],
3-
"plugins": ["glsl"]
2+
"presets": [
3+
"next/babel"
4+
],
5+
"plugins": [
6+
"glsl",
7+
"module:@react-three/babel"
8+
]
49
}

@types/react-new-window.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React, { PropsWithChildren } from 'react';
2+
3+
// Bypassing a type issue until fixed.
4+
// https://github.com/rmariuzzo/react-new-window/issues/118
5+
declare module 'react-new-window' {
6+
import { INewWindowProps } from 'react-new-window';
7+
8+
export default class NewWindow extends React.PureComponent<
9+
PropsWithChildren<INewWindowProps>
10+
> {}
11+
}

components/cubedraw.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type BoxData = {
1212
creationTime: number;
1313
};
1414
const Box = ({ position, color, rotation, creationTime }: BoxData) => {
15-
const meshRef = useRef<THREE.Mesh<THREE.BoxGeometry>>();
15+
const meshRef = useRef<THREE.Mesh<THREE.BoxGeometry>>(null);
1616
useFrame(({ clock }) => {
1717
const mesh = meshRef.current!;
1818
const factor = Math.sin(creationTime + clock.elapsedTime / 3);

components/effects.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ declare global {
2929
/* eslint-enable @typescript-eslint/no-namespace */
3030

3131
const TunnelEffects = () => {
32-
const ref = useRef<AfterimagePass>();
32+
const ref = useRef<AfterimagePass>(null);
3333
const viewport = useThree((three) => three.viewport);
3434
const size = useThree((three) => three.size);
3535
const trailNoiseTimeRef = useRef(0);
@@ -146,7 +146,7 @@ const TunnelEffects = () => {
146146
return (
147147
<afterimagePass
148148
ref={ref}
149-
attachArray="passes"
149+
attach="passes-1"
150150
args={[0.96, TunnelShader]}
151151
uniforms-aspect-value={viewport.aspect}
152152
uniforms-resolution-value={new Vector2(

components/scene.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ export const FiberScene = ({
77
controls,
88
children,
99
...rest
10-
}: Props & { controls?: boolean }) => {
11-
return (
12-
<>
13-
<Canvas mode="concurrent" {...rest}>
14-
{controls && <OrbitControls />}
15-
{children}
16-
</Canvas>
17-
</>
18-
);
19-
};
10+
}: Props & { controls?: boolean }) => (
11+
<Canvas {...rest}>
12+
{controls && <OrbitControls />}
13+
{children}
14+
</Canvas>
15+
);

components/shader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Shaders = React.memo(function Shader({
99
}) {
1010
const viewport = useThree((t) => t.viewport);
1111
const size = useThree((t) => t.size);
12-
const ref = useRef<ShaderMaterial>();
12+
const ref = useRef<ShaderMaterial>(null);
1313

1414
useFrame(({ clock }) => {
1515
ref.current!.uniforms.time.value = clock.elapsedTime;

0 commit comments

Comments
 (0)