From a4eb25654ccb5ac21e5a4d2249358b302ca2f769 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Fri, 12 Mar 2021 23:59:24 +0100 Subject: [PATCH] fix SubSurfaceMaterial (after #19) --- src/materials/SubSurfaceMaterial.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/materials/SubSurfaceMaterial.js b/src/materials/SubSurfaceMaterial.js index efac4d2..f6cebbe 100644 --- a/src/materials/SubSurfaceMaterial.js +++ b/src/materials/SubSurfaceMaterial.js @@ -1,9 +1,8 @@ import { Color, ShaderMaterial as TShaderMaterial, UniformsUtils } from 'three'; import SubsurfaceScatteringShader from './SubsurfaceScatteringShader.js'; -import ShaderMaterial from './ShaderMaterial'; export default { - extends: ShaderMaterial, + inject: ['three', 'mesh'], props: { color: { type: String, default: '#ffffff' }, thicknessColor: { type: String, default: '#ffffff' }, @@ -16,6 +15,13 @@ export default { opacity: { type: Number, default: 1 }, vertexColors: { type: Boolean, default: false }, }, + created() { + this.createMaterial(); + this.mesh.setMaterial(this.material); + }, + unmounted() { + this.material.dispose(); + }, methods: { createMaterial() { const params = SubsurfaceScatteringShader; @@ -41,5 +47,8 @@ export default { }); }, }, + render() { + return []; + }, __hmrId: 'SubSurfaceMaterial', };