From f891caa99d0c6495ed1fb9fff959671e1c1e158d Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 3 Jan 2022 21:14:36 -0500 Subject: [PATCH] faster and more memory efficient wireframes --- src/mesh/model.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mesh/model.js b/src/mesh/model.js index 102e3da4..78271169 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -37,7 +37,12 @@ let materials = mesh.material = { specular: 0x181818, color: 0x00ff00, opacity: 1 - }) + }), + wireframe: new THREE.MeshBasicMaterial({ + side: THREE.DoubleSide, + wireframe: true, + color: 0x0 + }), }; /** 3D model rendered on plaform **/ @@ -164,9 +169,7 @@ mesh.model = class MeshModel extends mesh.object { if (bool) { this.material({clone:true}); this._wireo = this.opacity(); - this._wire = new THREE.LineSegments( - new THREE.WireframeGeometry(this.mesh.geometry), - new THREE.LineBasicMaterial({ color: opt.color || 0 })); + this._wire = new THREE.Mesh(this.mesh.geometry, materials.wireframe); this.mesh.add(this._wire); this.opacity(opt.opacity || 0); }