修复:关联实体的更新显示

pull/898/head
ChenX 5 years ago
parent b2e88ce3b9
commit 8e56bf9083

@ -174,14 +174,20 @@ export class ExtrudeSolid extends Entity
ApplyMatrix(m: Matrix4) ApplyMatrix(m: Matrix4)
{ {
//暂时关闭更新,避免内部实体还没有更新位置时,先更新了实体的Geometry,导致后续没有进行更新
let updateBak = this.AutoUpdate;
this.AutoUpdate = false;
super.ApplyMatrix(m); super.ApplyMatrix(m);
for (let g of this.grooves) for (let g of this.grooves)
g.ApplyMatrix(m); g.ApplyMatrix(m);
//由于修改矩阵会导致矩阵错误 //由于修改矩阵会导致矩阵错误
this.csg = undefined; this.csg = undefined;
this.AutoUpdate = updateBak;
if (!equaln(m.getMaxScaleOnAxis(), 1)) if (!equaln(m.getMaxScaleOnAxis(), 1))
this.Update(UpdateDraw.Geometry); this.Update(UpdateDraw.Geometry);
else if (this.AutoUpdate)
this.DeferUpdate();
return this; return this;
} }
protected ApplyScaleMatrix(m: Matrix4): this protected ApplyScaleMatrix(m: Matrix4): this
@ -1411,8 +1417,6 @@ export class ExtrudeSolid extends Entity
if (this._MeshGeometry) if (this._MeshGeometry)
return this._MeshGeometry; return this._MeshGeometry;
this.csg = undefined;
if (this.thickness <= 0) if (this.thickness <= 0)
return new BufferGeometry(); return new BufferGeometry();
@ -1511,16 +1515,6 @@ export class ExtrudeSolid extends Entity
this.NeedUpdateFlag |= UpdateDraw.Geometry; 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(); super.DeferUpdate();
} }

@ -77,7 +77,7 @@ export namespace BufferGeometryUtils
for (let name in geometry.attributes) for (let name in geometry.attributes)
{ {
if (!attributesUsed.has(name)) return null; if (!attributesUsed.has(name)) continue;
if (attributes[name] === undefined) attributes[name] = []; if (attributes[name] === undefined) attributes[name] = [];
@ -92,7 +92,7 @@ export namespace BufferGeometryUtils
for (let name in geometry.morphAttributes) for (let name in geometry.morphAttributes)
{ {
if (!morphAttributesUsed.has(name)) return null; if (!morphAttributesUsed.has(name)) continue;
if (morphAttributes[name] === undefined) morphAttributes[name] = []; if (morphAttributes[name] === undefined) morphAttributes[name] = [];

Loading…
Cancel
Save