Skip to content

Commit

Permalink
pixel ratio #88
Browse files Browse the repository at this point in the history
  • Loading branch information
klevron committed Feb 16, 2022
1 parent 1c5a194 commit 60eee1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/Renderer.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 60eee1a

Please sign in to comment.