Skip to content

Commit 15bd9ba

Browse files
authored
fix(Fbo): simplifying types (#2479)
* simplifying types * doc
1 parent ef43855 commit 15bd9ba

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

docs/misc/fbo-use-fbo.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ The rendertarget is automatically disposed when unmounted.
3131
```tsx
3232
export type FboProps = {
3333
children?: (renderTarget: Fbo) => React.ReactNode
34-
width: UseFBOParams[0]
35-
height: UseFBOParams[1]
34+
width?: UseFBOParams[0]
35+
height?: UseFBOParams[1]
3636
} & FBOSettings
3737
```
3838

src/core/Fbo.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import * as React from 'react'
22
import * as THREE from 'three'
33
import { useThree } from '@react-three/fiber'
44
import { forwardRef, useImperativeHandle } from 'react'
5-
6-
type WebGLRenderTargetCtorParams = ConstructorParameters<typeof THREE.WebGLRenderTarget>
7-
type WebGLRenderTargetOptions = WebGLRenderTargetCtorParams[2]
5+
import { type WebGLRenderTargetOptions } from 'three'
86

97
type FBOSettings = {
108
/** @deprecated use `depthBuffer` instead. If set, the scene depth will be rendered into buffer.depthTexture. Default: false */
@@ -20,7 +18,7 @@ export function useFBO(
2018
height?: number,
2119
/**Settings */
2220
settings?: FBOSettings
23-
): THREE.WebGLRenderTarget {
21+
) {
2422
const size = useThree((state) => state.size)
2523
const viewport = useThree((state) => state.viewport)
2624
const _width = typeof width === 'number' ? width : size.width * viewport.dpr

0 commit comments

Comments
 (0)