Skip to content

Commit 21723b3

Browse files
chore: init colorspace as null
Mirrors mrdoob/three.js#25899
1 parent ccc52af commit 21723b3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/fiber/src/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Dpr, Renderer, RootState, Size } from './store'
1010
*/
1111
export const hasColorSpace = <
1212
T extends Renderer | THREE.Texture | object,
13-
P = T extends Renderer ? { outputColorSpace: string } : { colorSpace: string },
13+
P = T extends Renderer ? { outputColorSpace: string | null } : { colorSpace: string | null },
1414
>(
1515
object: T,
1616
): object is T & P => 'colorSpace' in object || 'outputColorSpace' in object

packages/fiber/tests/core/renderer.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ describe('renderer', () => {
740740
})
741741

742742
it('should respect color management preferences via gl', async () => {
743-
const texture = new THREE.Texture() as THREE.Texture & { colorSpace?: string }
743+
const texture = new THREE.Texture() as THREE.Texture & { colorSpace?: string | null }
744744
let key = 0
745745
function Test() {
746746
return <meshBasicMaterial key={key++} map={texture} />
@@ -749,7 +749,7 @@ describe('renderer', () => {
749749
const LinearEncoding = 3000
750750
const sRGBEncoding = 3001
751751

752-
let gl: THREE.WebGLRenderer & { outputColorSpace?: string } = null!
752+
let gl: THREE.WebGLRenderer & { outputColorSpace?: string | null } = null!
753753
await act(async () => (gl = root.render(<Test />).getState().gl))
754754
expect(gl.outputEncoding).toBe(sRGBEncoding)
755755
expect(gl.toneMapping).toBe(THREE.ACESFilmicToneMapping)
@@ -764,8 +764,8 @@ describe('renderer', () => {
764764
const SRGBColorSpace = 'srgb'
765765
const LinearSRGBColorSpace = 'srgb-linear'
766766

767-
gl.outputColorSpace ??= ''
768-
texture.colorSpace ??= ''
767+
gl.outputColorSpace ??= null
768+
texture.colorSpace ??= null
769769

770770
await act(async () => root.configure({ linear: true }).render(<Test />))
771771
expect(gl.outputColorSpace).toBe(LinearSRGBColorSpace)

0 commit comments

Comments
 (0)