From 60eee1a544c92c20301c9a3ffaebea0498bdf75a Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Wed, 16 Feb 2022 17:10:36 +0100 Subject: [PATCH] pixel ratio #88 --- src/core/Renderer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/Renderer.ts b/src/core/Renderer.ts index b0dfd87..d741d5c 100644 --- a/src/core/Renderer.ts +++ b/src/core/Renderer.ts @@ -1,7 +1,7 @@ /* eslint-disable no-use-before-define */ import { Camera, Scene, WebGLRenderer, WebGLRendererParameters } from 'three' import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer' -import { ComponentPublicInstance, defineComponent, InjectionKey, PropType } from 'vue' +import { ComponentPublicInstance, defineComponent, InjectionKey, PropType, watchEffect } from 'vue' import { bindObjectProp } from '../tools' import { PointerInterface, PointerPublicConfigInterface } from './usePointer' import useThree, { SizeInterface, ThreeConfigInterface, ThreeInterface } from './useThree' @@ -108,6 +108,7 @@ export default defineComponent({ shadow: Boolean, width: String, height: String, + pixelRatio: Number, xr: Boolean, props: { type: Object, default: () => ({}) }, onReady: Function as PropType<(r: RendererInterface) => void>, @@ -147,6 +148,10 @@ export default defineComponent({ const three = useThree(config) bindObjectProp(props, 'props', three.renderer) + watchEffect(() => { + if (props.pixelRatio) three.renderer.setPixelRatio(props.pixelRatio) + }) + const renderFn: {(): void} = () => {} return {