Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/src/demos/default/FlushSync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const colors = ['orange', 'hotpink', 'cyan', 'lime', 'yellow', 'red', 'blue', 'p

function Capture() {
const [color, setColor] = useState(colors[0])
const { gl } = useThree()
const { renderer } = useThree()
const wantToCapture = useRef(false)

const handleClick = useCallback(() => {
Expand All @@ -20,11 +20,11 @@ function Capture() {

// Takes a screenshot of the canvas and downloads it
const link = document.createElement('a')
link.href = gl.domElement.toDataURL()
link.href = renderer.domElement.toDataURL()
link.download = 'screenshot.png'
link.click()
}
}, [gl])
}, [renderer])

return (
<mesh onClick={handleClick} onAfterRender={captureScreenshot}>
Expand Down
6 changes: 3 additions & 3 deletions example/src/demos/default/ResetProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { useEffect, useRef, useState } from 'react'
import * as THREE from 'three'

function AdaptivePixelRatio() {
const gl = useThree((state) => state.gl)
const renderer = useThree((state) => state.renderer)
const current = useThree((state) => state.performance.current)
const initialDpr = useThree((state) => state.viewport.initialDpr)
const setDpr = useThree((state) => state.setDpr)

// Restore initial pixelratio on unmount
useEffect(() => {
const domElement = gl.domElement
const domElement = renderer.domElement
return () => {
setDpr(initialDpr)
domElement.style.imageRendering = 'auto'
Expand All @@ -21,7 +21,7 @@ function AdaptivePixelRatio() {
// Set adaptive pixelratio
useEffect(() => {
setDpr(current * initialDpr)
gl.domElement.style.imageRendering = current === 1 ? 'auto' : 'pixelated'
renderer.domElement.style.imageRendering = current === 1 ? 'auto' : 'pixelated'
}, [current])

return null
Expand Down
90 changes: 0 additions & 90 deletions example/src/demos/webgpu/Fog.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion example/src/demos/webgpu/WebGPUMotionBlur.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function AnimatedCharacter({ speed = 1 }: { speed?: number }) {
const group = useRef<THREE.Group>(null!)
const [model, setModel] = useState<THREE.Group | null>(cachedModel?.scene ?? null)
const mixerRef = useRef<THREE.AnimationMixer | null>(cachedModel?.mixer ?? null)
const renderer = useThree((s) => s.gl) as unknown as THREE.WebGPURenderer
const renderer = useThree((state) => state.renderer)

// Load GLTF model directly (not using drei's useGLTF for WebGPU compatibility)
useEffect(() => {
Expand Down