Skip to content

Commit

Permalink
added prop to EffectComposer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinoooo committed Sep 5, 2024
1 parent 546c044 commit 653b738
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion playground/src/components/BasicScene.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defineProps<{
</script>

<template>
<TresCanvas>
<TresCanvas :disable-render="true">
<TresPerspectiveCamera
:position="[5, 5, 5]"
:look-at="[0, 0, 0]"
Expand Down
16 changes: 11 additions & 5 deletions src/core/three/EffectComposer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const effectComposerInjectionKey: InjectionKey<ShallowRef<EffectComposerT
</script>

<script lang="ts" setup>
const props = defineProps<{
withoutRenderPass?: boolean
}>()
const effectComposer: ShallowRef<EffectComposerThreejs | null> = shallowRef(null)
provide(effectComposerInjectionKey, effectComposer)
Expand All @@ -35,11 +39,13 @@ watchEffect(() => {
effectComposer.value?.setPixelRatio(pixelRatio.value)
})
watchEffect(() => {
if (camera.value && scene.value && effectComposer.value) {
effectComposer.value.addPass(new RenderPass(scene.value, camera.value)) // TODO prop that allows disabling automatically adding the render pass
}
})
if (!props.withoutRenderPass) {
watchEffect(() => {
if (camera.value && scene.value && effectComposer.value) {
effectComposer.value.addPass(new RenderPass(scene.value, camera.value))
}
})
}
const { render } = useLoop()
Expand Down

0 comments on commit 653b738

Please sign in to comment.