1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/effects/RenderPass.ts

23 lines
572 B
TypeScript
Raw Normal View History

2021-04-20 18:41:04 +08:00
import { defineComponent } from 'vue'
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js'
import EffectPass from './EffectPass'
2020-09-17 05:27:29 +08:00
2021-04-05 03:02:21 +08:00
export default defineComponent({
2020-09-17 05:27:29 +08:00
extends: EffectPass,
2021-04-20 18:41:04 +08:00
created() {
2021-04-25 03:45:57 +08:00
if (!this.renderer) return
2021-04-22 03:05:02 +08:00
if (!this.renderer.scene) {
2021-04-20 18:41:04 +08:00
console.error('Missing Scene')
return
2020-09-17 05:27:29 +08:00
}
2021-04-22 03:05:02 +08:00
if (!this.renderer.camera) {
2021-04-20 18:41:04 +08:00
console.error('Missing Camera')
return
2020-09-17 05:27:29 +08:00
}
2021-04-22 03:05:02 +08:00
const pass = new RenderPass(this.renderer.scene, this.renderer.camera)
2021-04-20 18:41:04 +08:00
this.initEffectPass(pass)
2020-09-17 05:27:29 +08:00
},
2020-09-20 02:29:53 +08:00
__hmrId: 'RenderPass',
2021-04-20 18:41:04 +08:00
})