From 4a1a56d0387650ed2952a03c6c909de633de0ddd Mon Sep 17 00:00:00 2001 From: ChenX Date: Wed, 19 Feb 2020 14:58:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=A2=E5=9F=9F=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E8=BF=9B=E6=9D=A5=E5=90=8E=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Entity/Region.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/DatabaseServices/Entity/Region.ts b/src/DatabaseServices/Entity/Region.ts index 8a2c8ca29..501728e0e 100644 --- a/src/DatabaseServices/Entity/Region.ts +++ b/src/DatabaseServices/Entity/Region.ts @@ -129,6 +129,29 @@ export class Region extends Entity this._ShapeManager.ShapeList.forEach(s => s.ApplyMatrix(m)); return super.ApplyMatrix(m); } + + get Position() + { + return super.Position; + } + set Position(pt: Vector3) + { + this.WriteAllObjectRecord(); + let moveX = pt.x - this._Matrix.elements[12]; + let moveY = pt.y - this._Matrix.elements[13]; + let moveZ = pt.z - this._Matrix.elements[14]; + this._Matrix.setPosition(pt); + this._SpaceOCS.elements[12] += moveX; + this._SpaceOCS.elements[13] += moveY; + this._SpaceOCS.elements[14] += moveZ; + + let m = new Matrix4().setPosition(moveX, moveY, moveZ); + for (let s of this.ShapeManager.ShapeList) + s.ApplyMatrix(m); + + this.Update(UpdateDraw.Matrix); + } + protected ApplyScaleMatrix(m: Matrix4): this { this.WriteAllObjectRecord(); @@ -201,7 +224,7 @@ export class Region extends Entity //多形状面域,需把geo移动到相对 let geometry = new ShapeGeometry(shape.Shape, 60);//60 可以优化. - let diffMat = this.OCSInv.clone().multiply(shape.Outline.Curve.OCS); + let diffMat = this.OCSInv.clone().multiply(shape.Outline.Curve.OCSNoClone); geometry.applyMatrix4(diffMat); ScaleUV(geometry); if (type === RenderType.Wireframe)