1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

fix SSAOPass (cs and unneeded resize)

This commit is contained in:
Kevin Levron 2021-04-01 22:31:57 +02:00
parent 36a7e7f519
commit 9cf540b0b7

View File

@ -8,8 +8,8 @@ export default {
camera: null, camera: null,
options: { options: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
} },
}, },
mounted() { mounted() {
const pass = new SSAOPass( const pass = new SSAOPass(
@ -18,22 +18,12 @@ export default {
this.three.size.width, this.three.size.width,
this.three.size.height this.three.size.height
); );
this.completePass(pass);
for (let key of Object.keys(this.options)) { for (const key of Object.keys(this.options)) {
this.pass[key] = this.options[key]; pass[key] = this.options[key];
} }
// resize will be called in three init
this.three.onAfterResize(this.resize); this.completePass(pass);
},
unmounted() {
this.three.offAfterResize(this.resize);
},
methods: {
resize() {
this.pass.width = this.three.size.width
this.pass.height = this.three.size.height
},
}, },
__hmrId: 'SSAOPass', __hmrId: 'SSAOPass',
}; };