优化文本材质更新

pull/706/MERGE
ChenX 5 years ago
parent f3382aca05
commit f70ec3dc6c

@ -101,7 +101,7 @@ export class Text extends Entity
this.UpdateTranslate(); this.UpdateTranslate();
this.AsyncUpdated(); this.AsyncUpdated();
} }
//TODO: FIXME 应该避免一直重载这个迭代.
UpdateTranslate() UpdateTranslate()
{ {
for (let [type, obj] of this._CacheDrawObject) for (let [type, obj] of this._CacheDrawObject)
@ -149,10 +149,14 @@ export class Text extends Entity
{ {
this.AsyncUpdateDrawObject(obj, type); this.AsyncUpdateDrawObject(obj, type);
} }
UpdateDrawObjectMaterial(type: RenderType, en: Object3D) UpdateDrawObjectMaterial(renderType: RenderType, en: Object3D)
{
if (en && en.children.length === 1)
{ {
if (en) let mesh = en.children[0] as Mesh;
this.AsyncUpdateDrawObject(en, type); let color = renderType === RenderType.Print ? 256 : this.ColorIndex;
mesh.material = ColorMaterial.GetBasicMaterialDoubleSide(color);
}
} }
GetGripPoints(): Array<Vector3> GetGripPoints(): Array<Vector3>
{ {

Loading…
Cancel
Save