mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
wip
This commit is contained in:
parent
7b7524d1dd
commit
04fe791340
@ -5,6 +5,8 @@
|
|||||||
<AmbientLight color="#808080" />
|
<AmbientLight color="#808080" />
|
||||||
<PointLight color="#ff6000" />
|
<PointLight color="#ff6000" />
|
||||||
<PointLight ref="light" color="#0060ff" :intensity="0.5" />
|
<PointLight ref="light" color="#0060ff" :intensity="0.5" />
|
||||||
|
<PointLight color="#ff6000" :intensity="0.5" :position="{ x: 100}" />
|
||||||
|
<PointLight color="#0000ff" :intensity="0.5" :position="{ x: -100}" />
|
||||||
|
|
||||||
<InstancedMesh ref="imesh" material-id="material" :count="NUM_INSTANCES">
|
<InstancedMesh ref="imesh" material-id="material" :count="NUM_INSTANCES">
|
||||||
<BoxGeometry :width="2" :height="2" :depth="10" />
|
<BoxGeometry :width="2" :height="2" :depth="10" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Renderer ref="renderer" :orbit-ctrl="{ enableDamping: true, dampingFactor: 0.05 }" :shadow="true">
|
<Renderer ref="renderer" :orbit-ctrl="{ enableDamping: true, dampingFactor: 0.05 }" shadow>
|
||||||
<Camera :position="{ z: 100 }" />
|
<Camera :position="{ z: 100 }" />
|
||||||
<Scene>
|
<Scene>
|
||||||
<SpotLight color="#ffffff" :intensity="0.5" :position="{ y: 150, z: 0 }" :cast-shadow="true" :shadow-map-size="{ width: 1024, height: 1024 }" />
|
<SpotLight color="#ffffff" :intensity="0.5" :position="{ y: 150, z: 0 }" :cast-shadow="true" :shadow-map-size="{ width: 1024, height: 1024 }" />
|
||||||
|
14
src/components/examples/Matcap.vue
Normal file
14
src/components/examples/Matcap.vue
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<Renderer>
|
||||||
|
<Camera :position="{ x: 0, y: 0, z: 10 }" />
|
||||||
|
<Scene>
|
||||||
|
<Sphere>
|
||||||
|
<MatcapMaterial name="2E763A_78A0B7_B3D1CF_14F209" />
|
||||||
|
</Sphere>
|
||||||
|
</Scene>
|
||||||
|
</Renderer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {};
|
||||||
|
</script>
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Renderer ref="renderer">
|
<Renderer ref="renderer" antialias>
|
||||||
<Camera ref="camera" :position="{ z: 150 }"></Camera>
|
<Camera ref="camera" :position="{ z: 150 }"></Camera>
|
||||||
<Scene ref="scene">
|
<Scene ref="scene">
|
||||||
</Scene>
|
</Scene>
|
||||||
|
@ -3,38 +3,14 @@ import useThree from './useThree';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
antialias: {
|
antialias: Boolean,
|
||||||
type: Boolean,
|
alpha: Boolean,
|
||||||
default: true,
|
autoClear: { type: Boolean, default: true },
|
||||||
},
|
mouseMove: { type: [Boolean, String], default: false },
|
||||||
alpha: {
|
mouseRaycast: { type: Boolean, default: false },
|
||||||
type: Boolean,
|
orbitCtrl: { type: [Boolean, Object], default: false },
|
||||||
default: false,
|
resize: { type: [Boolean, String, Element], default: 'window' },
|
||||||
},
|
shadow: Boolean,
|
||||||
autoClear: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
shadow: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
orbitCtrl: {
|
|
||||||
type: [Boolean, Object],
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
mouseMove: {
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
mouseRaycast: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
resize: {
|
|
||||||
type: [Boolean, String, Element],
|
|
||||||
default: 'window',
|
|
||||||
},
|
|
||||||
width: String,
|
width: String,
|
||||||
height: String,
|
height: String,
|
||||||
},
|
},
|
||||||
|
26
src/effects/FXAAPass.js
Normal file
26
src/effects/FXAAPass.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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 {
|
||||||
|
extends: EffectPass,
|
||||||
|
mounted() {
|
||||||
|
const pass = new ShaderPass(FXAAShader);
|
||||||
|
this.passes.push(pass);
|
||||||
|
this.pass = pass;
|
||||||
|
|
||||||
|
this.resize();
|
||||||
|
this.three.onAfterResize(this.resize);
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
this.three.offAfterResize(this.resize);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
resize() {
|
||||||
|
const { resolution } = this.pass.material.uniforms;
|
||||||
|
resolution.value.x = 1 / this.three.size.width;
|
||||||
|
resolution.value.y = 1 / this.three.size.height;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'FXAAPass',
|
||||||
|
};
|
@ -1,7 +1,9 @@
|
|||||||
export { default as EffectComposer } from './EffectComposer.js';
|
export { default as EffectComposer } from './EffectComposer.js';
|
||||||
export { default as RenderPass } from './RenderPass.js';
|
export { default as RenderPass } from './RenderPass.js';
|
||||||
|
|
||||||
export { default as BokehPass } from './BokehPass.js';
|
export { default as BokehPass } from './BokehPass.js';
|
||||||
export { default as FilmPass } from './FilmPass.js';
|
export { default as FilmPass } from './FilmPass.js';
|
||||||
|
export { default as FXAAPass } from './FXAAPass.js';
|
||||||
export { default as HalftonePass } from './HalftonePass.js';
|
export { default as HalftonePass } from './HalftonePass.js';
|
||||||
export { default as SAOPass } from './SAOPass.js';
|
export { default as SAOPass } from './SAOPass.js';
|
||||||
export { default as UnrealBloomPass } from './UnrealBloomPass.js';
|
export { default as UnrealBloomPass } from './UnrealBloomPass.js';
|
||||||
|
@ -23,6 +23,7 @@ export default {
|
|||||||
watch(() => this.urls, this.refreshTexture);
|
watch(() => this.urls, this.refreshTexture);
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
|
this.material.setTexture(null, this.id);
|
||||||
this.texture.dispose();
|
this.texture.dispose();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -16,6 +16,7 @@ export default {
|
|||||||
watch(() => this.src, this.refreshTexture);
|
watch(() => this.src, this.refreshTexture);
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
|
this.material.setTexture(null, this.id);
|
||||||
this.texture.dispose();
|
this.texture.dispose();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
Reference in New Issue
Block a user