diff --git a/src/components/TresScene.ts b/src/components/TresScene.ts index cf4ea99ad..7f6026693 100644 --- a/src/components/TresScene.ts +++ b/src/components/TresScene.ts @@ -1,6 +1,6 @@ import { App, defineComponent, h, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue' import * as THREE from 'three' -import { ShadowMapType, TextureEncoding, ToneMapping } from 'three' +import { ColorSpace, ShadowMapType, ToneMapping } from 'three' import { createTres } from '/@/core/renderer' import { CameraType, TRES_CONTEXT_KEY, useLogger } from '/@/composables' import { useCamera, useRenderer, useRenderLoop, useRaycaster, useTres } from '/@/composables' @@ -15,7 +15,7 @@ export interface TresSceneProps { shadowMapType?: ShadowMapType physicallyCorrectLights?: boolean useLegacyLights?: boolean - outputColorSpace?: TextureEncoding + outputColorSpace?: ColorSpace toneMapping?: ToneMapping toneMappingExposure?: number context?: WebGLRenderingContext @@ -107,8 +107,7 @@ export const TresScene = defineComponent({ }) onLoop(() => { - if (activeCamera.value && props.disableRender !== true && props.disableRender !== '') - renderer.value?.render(scene, activeCamera.value) + if (activeCamera.value && props.disableRender !== true) renderer.value?.render(scene, activeCamera.value) if (raycaster.value) { const intersects = raycaster.value.intersectObjects(scene.children) diff --git a/src/composables/useRenderer/index.ts b/src/composables/useRenderer/index.ts index 3c08b8f22..2828ce4ce 100644 --- a/src/composables/useRenderer/index.ts +++ b/src/composables/useRenderer/index.ts @@ -16,8 +16,9 @@ import { ShadowMapType, PCFShadowMap, Clock, + ColorSpace, } from 'three' -import type { TextureEncoding, ToneMapping } from 'three' +import type { ToneMapping } from 'three' import { useRenderLoop, useTres } from '/@/composables/' import { normalizeColor } from '/@/utils/normalize' import { TresColor } from '/@/types' @@ -63,7 +64,7 @@ export interface UseRendererOptions extends WebGLRendererParameters { * * @default LinearSRGBColorSpace */ - outputColorSpace?: MaybeRefOrGetter + outputColorSpace?: MaybeRefOrGetter /** * Defines the tone mapping used by the renderer. @@ -190,7 +191,7 @@ You could set windowSize=true to force the canvas to be the size of the window.` renderer.value.toneMapping = (toValue(toneMapping) as ToneMapping) || NoToneMapping renderer.value.toneMappingExposure = toValue(toneMappingExposure) as number // Wating for https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65356/files to be merged - renderer.value.outputColorSpace = (toValue(outputColorSpace) as TextureEncoding) || LinearSRGBColorSpace + renderer.value.outputColorSpace = toValue(outputColorSpace as ColorSpace) || LinearSRGBColorSpace if (clearColor?.value) renderer.value.setClearColor(normalizeColor(toValue(clearColor) as TresColor)) /* renderer.value.physicallyCorrectLights = toValue(physicallyCorrectLights) as boolean */