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

fix SubSurfaceMaterial (after #19)

This commit is contained in:
Kevin Levron 2021-03-12 23:59:24 +01:00
parent 8d66934fa9
commit a4eb25654c

View File

@ -1,9 +1,8 @@
import { Color, ShaderMaterial as TShaderMaterial, UniformsUtils } from 'three'; import { Color, ShaderMaterial as TShaderMaterial, UniformsUtils } from 'three';
import SubsurfaceScatteringShader from './SubsurfaceScatteringShader.js'; import SubsurfaceScatteringShader from './SubsurfaceScatteringShader.js';
import ShaderMaterial from './ShaderMaterial';
export default { export default {
extends: ShaderMaterial, inject: ['three', 'mesh'],
props: { props: {
color: { type: String, default: '#ffffff' }, color: { type: String, default: '#ffffff' },
thicknessColor: { type: String, default: '#ffffff' }, thicknessColor: { type: String, default: '#ffffff' },
@ -16,6 +15,13 @@ export default {
opacity: { type: Number, default: 1 }, opacity: { type: Number, default: 1 },
vertexColors: { type: Boolean, default: false }, vertexColors: { type: Boolean, default: false },
}, },
created() {
this.createMaterial();
this.mesh.setMaterial(this.material);
},
unmounted() {
this.material.dispose();
},
methods: { methods: {
createMaterial() { createMaterial() {
const params = SubsurfaceScatteringShader; const params = SubsurfaceScatteringShader;
@ -41,5 +47,8 @@ export default {
}); });
}, },
}, },
render() {
return [];
},
__hmrId: 'SubSurfaceMaterial', __hmrId: 'SubSurfaceMaterial',
}; };