1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00
This commit is contained in:
Kevin Levron 2020-10-04 22:52:39 +02:00
parent 04fe791340
commit 8dd1e4d561
3 changed files with 25 additions and 1 deletions

View File

@ -20,8 +20,19 @@ export default {
this.composer.addPass(pass); this.composer.addPass(pass);
}); });
this.three.composer = this.composer; this.three.composer = this.composer;
this.resize();
this.three.onAfterResize(this.resize);
}); });
}, },
unmounted() {
this.three.offAfterResize(this.resize);
},
methods: {
resize() {
this.composer.setSize(this.three.size.width, this.three.size.height);
},
},
render() { render() {
return this.$slots.default(); return this.$slots.default();
}, },

View File

@ -9,7 +9,7 @@ export default {
this.passes.push(pass); this.passes.push(pass);
this.pass = pass; this.pass = pass;
this.resize(); // resize will be called in three init
this.three.onAfterResize(this.resize); this.three.onAfterResize(this.resize);
}, },
unmounted() { unmounted() {

13
src/effects/SMAAPass.js Normal file
View File

@ -0,0 +1,13 @@
import { SMAAPass } from 'three/examples/jsm/postprocessing/SMAAPass.js';
import EffectPass from './EffectPass.js';
export default {
extends: EffectPass,
mounted() {
// three size is not set yet, but this pass will be resized by effect composer
const pass = new SMAAPass(this.three.size.width, this.three.size.height);
this.passes.push(pass);
this.pass = pass;
},
__hmrId: 'SMAAPass',
};