From 8e56bf9083dad0d666ab99d04b78aba6c8d33ed0 Mon Sep 17 00:00:00 2001 From: ChenX Date: Tue, 31 Mar 2020 16:55:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E5=85=B3=E8=81=94=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=9A=84=E6=9B=B4=E6=96=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Entity/Extrude.ts | 18 ++++++------------ src/Geometry/BufferGeometryUtils.ts | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/DatabaseServices/Entity/Extrude.ts b/src/DatabaseServices/Entity/Extrude.ts index 9afcd40f1..dedbf8e8d 100644 --- a/src/DatabaseServices/Entity/Extrude.ts +++ b/src/DatabaseServices/Entity/Extrude.ts @@ -174,14 +174,20 @@ export class ExtrudeSolid extends Entity ApplyMatrix(m: Matrix4) { + //暂时关闭更新,避免内部实体还没有更新位置时,先更新了实体的Geometry,导致后续没有进行更新 + let updateBak = this.AutoUpdate; + this.AutoUpdate = false; super.ApplyMatrix(m); for (let g of this.grooves) g.ApplyMatrix(m); //由于修改矩阵会导致矩阵错误 this.csg = undefined; + this.AutoUpdate = updateBak; if (!equaln(m.getMaxScaleOnAxis(), 1)) this.Update(UpdateDraw.Geometry); + else if (this.AutoUpdate) + this.DeferUpdate(); return this; } protected ApplyScaleMatrix(m: Matrix4): this @@ -1411,8 +1417,6 @@ export class ExtrudeSolid extends Entity if (this._MeshGeometry) return this._MeshGeometry; - this.csg = undefined; - if (this.thickness <= 0) return new BufferGeometry(); @@ -1511,16 +1515,6 @@ export class ExtrudeSolid extends Entity this.NeedUpdateFlag |= UpdateDraw.Geometry; } - if (this.NeedUpdateFlag & UpdateDraw.Geometry) - { - if (this._MeshGeometry && this._CacheDrawObject.size === 0) - { - this._MeshGeometry.dispose(); - this._MeshGeometry = undefined; - this.csg = undefined; - } - } - super.DeferUpdate(); } diff --git a/src/Geometry/BufferGeometryUtils.ts b/src/Geometry/BufferGeometryUtils.ts index 548e17164..83eac15e6 100644 --- a/src/Geometry/BufferGeometryUtils.ts +++ b/src/Geometry/BufferGeometryUtils.ts @@ -77,7 +77,7 @@ export namespace BufferGeometryUtils for (let name in geometry.attributes) { - if (!attributesUsed.has(name)) return null; + if (!attributesUsed.has(name)) continue; if (attributes[name] === undefined) attributes[name] = []; @@ -92,7 +92,7 @@ export namespace BufferGeometryUtils for (let name in geometry.morphAttributes) { - if (!morphAttributesUsed.has(name)) return null; + if (!morphAttributesUsed.has(name)) continue; if (morphAttributes[name] === undefined) morphAttributes[name] = [];