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:
parent
a1d786297c
commit
98c74aa1c4
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { BokehPass } from 'three/examples/jsm/postprocessing/BokehPass.js';
|
import { BokehPass } from 'three/examples/jsm/postprocessing/BokehPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
focus: {
|
focus: {
|
||||||
@ -40,4 +41,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'BokehPass',
|
__hmrId: 'BokehPass',
|
||||||
};
|
});
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
passes: [],
|
passes: [],
|
||||||
@ -37,4 +38,4 @@ export default {
|
|||||||
return this.$slots.default();
|
return this.$slots.default();
|
||||||
},
|
},
|
||||||
__hmrId: 'EffectComposer',
|
__hmrId: 'EffectComposer',
|
||||||
};
|
});
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
export default {
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
inject: ['three', 'passes'],
|
inject: ['three', 'passes'],
|
||||||
emits: ['ready'],
|
emits: ['ready'],
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
@ -20,4 +22,4 @@ export default {
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
__hmrId: 'EffectPass',
|
__hmrId: 'EffectPass',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
||||||
import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader.js';
|
import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
mounted() {
|
mounted() {
|
||||||
const pass = new ShaderPass(FXAAShader);
|
const pass = new ShaderPass(FXAAShader);
|
||||||
@ -22,4 +23,4 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
__hmrId: 'FXAAPass',
|
__hmrId: 'FXAAPass',
|
||||||
};
|
});
|
||||||
|
@ -1,25 +1,14 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { FilmPass } from 'three/examples/jsm/postprocessing/FilmPass.js';
|
import { FilmPass } from 'three/examples/jsm/postprocessing/FilmPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
noiseIntensity: {
|
noiseIntensity: { type: Number, default: 0.5 },
|
||||||
type: Number,
|
scanlinesIntensity: { type: Number, default: 0.05 },
|
||||||
default: 0.5,
|
scanlinesCount: { type: Number, default: 4096 },
|
||||||
},
|
grayscale: { type: Number, default: 0 },
|
||||||
scanlinesIntensity: {
|
|
||||||
type: Number,
|
|
||||||
default: 0.05,
|
|
||||||
},
|
|
||||||
scanlinesCount: {
|
|
||||||
type: Number,
|
|
||||||
default: 4096,
|
|
||||||
},
|
|
||||||
grayscale: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
noiseIntensity() { this.pass.uniforms.nIntensity.value = this.noiseIntensity; },
|
noiseIntensity() { this.pass.uniforms.nIntensity.value = this.noiseIntensity; },
|
||||||
@ -32,4 +21,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'FilmPass',
|
__hmrId: 'FilmPass',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
import { defineComponent, watch } from 'vue';
|
||||||
import { HalftonePass } from 'three/examples/jsm/postprocessing/HalftonePass.js';
|
import { HalftonePass } from 'three/examples/jsm/postprocessing/HalftonePass.js';
|
||||||
import { watch } from 'vue';
|
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
shape: { type: Number, default: 1 },
|
shape: { type: Number, default: 1 },
|
||||||
@ -25,4 +25,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'HalftonePass',
|
__hmrId: 'HalftonePass',
|
||||||
};
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
|
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.three.scene) {
|
if (!this.three.scene) {
|
||||||
@ -14,4 +15,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'RenderPass',
|
__hmrId: 'RenderPass',
|
||||||
};
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { SMAAPass } from 'three/examples/jsm/postprocessing/SMAAPass.js';
|
import { SMAAPass } from 'three/examples/jsm/postprocessing/SMAAPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
mounted() {
|
mounted() {
|
||||||
// three size is not set yet, but this pass will be resized by effect composer
|
// three size is not set yet, but this pass will be resized by effect composer
|
||||||
@ -9,4 +10,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'SMAAPass',
|
__hmrId: 'SMAAPass',
|
||||||
};
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { SSAOPass } from 'three/examples/jsm/postprocessing/SSAOPass.js';
|
import { SSAOPass } from 'three/examples/jsm/postprocessing/SSAOPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
scene: null,
|
scene: null,
|
||||||
@ -26,4 +27,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'SSAOPass',
|
__hmrId: 'SSAOPass',
|
||||||
};
|
});
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
import { defineComponent, watch } from 'vue';
|
||||||
import { Vector2 } from 'three';
|
import { Vector2 } from 'three';
|
||||||
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
||||||
import { watch } from 'vue';
|
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
import TiltShift from '../shaders/TiltShift.js';
|
import TiltShift from '../shaders/TiltShift.js';
|
||||||
import { bindProp } from '../tools';
|
import { bindProp } from '../tools';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
blurRadius: { type: Number, default: 10 },
|
blurRadius: { type: Number, default: 10 },
|
||||||
@ -54,4 +54,4 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
__hmrId: 'TiltShiftPass',
|
__hmrId: 'TiltShiftPass',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { Vector2 } from 'three';
|
import { Vector2 } from 'three';
|
||||||
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass.js';
|
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
strength: { type: Number, default: 1.5 },
|
strength: { type: Number, default: 1.5 },
|
||||||
@ -20,4 +21,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'UnrealBloomPass',
|
__hmrId: 'UnrealBloomPass',
|
||||||
};
|
});
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
|
||||||
import EffectPass from './EffectPass.js';
|
import EffectPass from './EffectPass.js';
|
||||||
import ZoomBlur from '../shaders/ZoomBlur.js';
|
import ZoomBlur from '../shaders/ZoomBlur.js';
|
||||||
import { bindProp } from '../tools';
|
import { bindProp } from '../tools';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: EffectPass,
|
extends: EffectPass,
|
||||||
props: {
|
props: {
|
||||||
center: { type: Object, default: { x: 0.5, y: 0.5 } },
|
center: { type: Object, default: { x: 0.5, y: 0.5 } },
|
||||||
@ -19,4 +20,4 @@ export default {
|
|||||||
this.completePass(pass);
|
this.completePass(pass);
|
||||||
},
|
},
|
||||||
__hmrId: 'ZoomBlurPass',
|
__hmrId: 'ZoomBlurPass',
|
||||||
};
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user