mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
added ssao pass
This commit is contained in:
parent
eb1ca16b8a
commit
de34a48d8a
40
src/effects/SSAOPass.js
Normal file
40
src/effects/SSAOPass.js
Normal file
@ -0,0 +1,40 @@
|
||||
import { SSAOPass } from 'three/examples/jsm/postprocessing/SSAOPass.js';
|
||||
import EffectPass from './EffectPass.js';
|
||||
|
||||
export default {
|
||||
extends: EffectPass,
|
||||
props: {
|
||||
scene: null,
|
||||
camera: null,
|
||||
options: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const pass = new SSAOPass(
|
||||
this.scene || this.three.scene,
|
||||
this.camera || this.three.camera,
|
||||
this.three.size.width,
|
||||
this.three.size.height
|
||||
);
|
||||
this.passes.push(pass);
|
||||
this.pass = pass;
|
||||
|
||||
for (let key of Object.keys(this.options)) {
|
||||
this.pass[key] = this.options[key];
|
||||
}
|
||||
// resize will be called in three init
|
||||
this.three.onAfterResize(this.resize);
|
||||
},
|
||||
unmounted() {
|
||||
this.three.offAfterResize(this.resize);
|
||||
},
|
||||
methods: {
|
||||
resize() {
|
||||
this.pass.width = this.three.size.width
|
||||
this.pass.height = this.three.size.height
|
||||
},
|
||||
},
|
||||
__hmrId: 'FXAAPass',
|
||||
};
|
@ -6,6 +6,7 @@ export { default as FilmPass } from './FilmPass.js';
|
||||
export { default as FXAAPass } from './FXAAPass.js';
|
||||
export { default as HalftonePass } from './HalftonePass.js';
|
||||
export { default as SMAAPass } from './SMAAPass.js';
|
||||
export { default as SSAOPass } from './SSAOPass.js';
|
||||
export { default as TiltShiftPass } from './TiltShiftPass.js';
|
||||
export { default as UnrealBloomPass } from './UnrealBloomPass.js';
|
||||
export { default as ZoomBlurPass } from './ZoomBlurPass.js';
|
||||
|
@ -69,6 +69,7 @@ export const TroisJSVuePlugin = {
|
||||
'RenderPass',
|
||||
'SAOPass',
|
||||
'SMAAPass',
|
||||
'SSAOPass',
|
||||
'TiltShiftPass',
|
||||
'UnrealBloomPass',
|
||||
'ZoomBlurPass',
|
||||
|
Loading…
Reference in New Issue
Block a user