浏览代码

add removeAllMeshes to highlight layer

sebavan 5 年之前
父节点
当前提交
936b8a2423
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      src/Layers/highlightLayer.ts

+ 18 - 0
src/Layers/highlightLayer.ts

@@ -686,6 +686,24 @@ export class HighlightLayer extends EffectLayer {
     }
 
     /**
+     * Remove all the meshes currently referenced in the highlight layer
+     */
+    public removeAllMeshes(): void {
+        if (!this._meshes) {
+            return;
+        }
+
+        for (const uniqueId in this._meshes) {
+            if (this._meshes.hasOwnProperty(uniqueId)) {
+                const mesh = this._meshes[uniqueId];
+                if (mesh) {
+                    this.removeMesh(mesh.mesh);
+                }
+            }
+        }
+    }
+
+    /**
      * Force the stencil to the normal expected value for none glowing parts
      */
     private _defaultStencilReference(mesh: Mesh) {