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

defineComponent for effects (#10)

This commit is contained in:
Kevin Levron 2021-04-04 21:02:21 +02:00
parent a1d786297c
commit 98c74aa1c4
12 changed files with 41 additions and 42 deletions

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { BokehPass } from 'three/examples/jsm/postprocessing/BokehPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
props: {
focus: {
@ -40,4 +41,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'BokehPass',
};
});

View File

@ -1,6 +1,7 @@
import { defineComponent } from 'vue';
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
export default {
export default defineComponent({
setup() {
return {
passes: [],
@ -37,4 +38,4 @@ export default {
return this.$slots.default();
},
__hmrId: 'EffectComposer',
};
});

View File

@ -1,4 +1,6 @@
export default {
import { defineComponent } from 'vue';
export default defineComponent({
inject: ['three', 'passes'],
emits: ['ready'],
beforeMount() {
@ -20,4 +22,4 @@ export default {
return [];
},
__hmrId: 'EffectPass',
};
});

View File

@ -1,8 +1,9 @@
import { defineComponent } from 'vue';
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
mounted() {
const pass = new ShaderPass(FXAAShader);
@ -22,4 +23,4 @@ export default {
},
},
__hmrId: 'FXAAPass',
};
});

View File

@ -1,25 +1,14 @@
import { defineComponent } from 'vue';
import { FilmPass } from 'three/examples/jsm/postprocessing/FilmPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
props: {
noiseIntensity: {
type: Number,
default: 0.5,
},
scanlinesIntensity: {
type: Number,
default: 0.05,
},
scanlinesCount: {
type: Number,
default: 4096,
},
grayscale: {
type: Number,
default: 0,
},
noiseIntensity: { type: Number, default: 0.5 },
scanlinesIntensity: { type: Number, default: 0.05 },
scanlinesCount: { type: Number, default: 4096 },
grayscale: { type: Number, default: 0 },
},
watch: {
noiseIntensity() { this.pass.uniforms.nIntensity.value = this.noiseIntensity; },
@ -32,4 +21,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'FilmPass',
};
});

View File

@ -1,8 +1,8 @@
import { defineComponent, watch } from 'vue';
import { HalftonePass } from 'three/examples/jsm/postprocessing/HalftonePass.js';
import { watch } from 'vue';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
props: {
shape: { type: Number, default: 1 },
@ -25,4 +25,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'HalftonePass',
};
});

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
mounted() {
if (!this.three.scene) {
@ -14,4 +15,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'RenderPass',
};
});

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { SMAAPass } from 'three/examples/jsm/postprocessing/SMAAPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
mounted() {
// three size is not set yet, but this pass will be resized by effect composer
@ -9,4 +10,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'SMAAPass',
};
});

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { SSAOPass } from 'three/examples/jsm/postprocessing/SSAOPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
props: {
scene: null,
@ -26,4 +27,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'SSAOPass',
};
});

View File

@ -1,11 +1,11 @@
import { defineComponent, watch } from 'vue';
import { Vector2 } from 'three';
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
import { watch } from 'vue';
import EffectPass from './EffectPass.js';
import TiltShift from '../shaders/TiltShift.js';
import { bindProp } from '../tools';
export default {
export default defineComponent({
extends: EffectPass,
props: {
blurRadius: { type: Number, default: 10 },
@ -54,4 +54,4 @@ export default {
},
},
__hmrId: 'TiltShiftPass',
};
});

View File

@ -1,8 +1,9 @@
import { defineComponent } from 'vue';
import { Vector2 } from 'three';
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass.js';
import EffectPass from './EffectPass.js';
export default {
export default defineComponent({
extends: EffectPass,
props: {
strength: { type: Number, default: 1.5 },
@ -20,4 +21,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'UnrealBloomPass',
};
});

View File

@ -1,9 +1,10 @@
import { defineComponent } from 'vue';
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
import EffectPass from './EffectPass.js';
import ZoomBlur from '../shaders/ZoomBlur.js';
import { bindProp } from '../tools';
export default {
export default defineComponent({
extends: EffectPass,
props: {
center: { type: Object, default: { x: 0.5, y: 0.5 } },
@ -19,4 +20,4 @@ export default {
this.completePass(pass);
},
__hmrId: 'ZoomBlurPass',
};
});