From 3beec440a2422f107266d0518088b1ac5b9b50ce Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 2 Apr 2016 23:11:39 +0000 Subject: [PATCH] Fixed control point overlay position. --- common/piece.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/common/piece.h b/common/piece.h index 96a8dc61..56c24081 100644 --- a/common/piece.h +++ b/common/piece.h @@ -458,10 +458,27 @@ public: lcVector3 GetRotationCenter() const { - if (mState & LC_PIECE_PIVOT_POINT_VALID) - return lcMul31(mPivotMatrix.GetTranslation(), mModelWorld); + lcuint32 Section = GetFocusSection(); + + if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID) + { + if (mState & LC_PIECE_PIVOT_POINT_VALID) + return lcMul31(mPivotMatrix.GetTranslation(), mModelWorld); + else + return mModelWorld.GetTranslation(); + } else + { + int ControlPointIndex = Section - LC_PIECE_SECTION_CONTROL_POINT_1; + + if (ControlPointIndex >= 0 && ControlPointIndex < mControlPoints.GetSize()) + { + lcMatrix44& Transform = mControlPoints[ControlPointIndex].Transform; + return lcMul31(Transform.GetTranslation(), mModelWorld); + } + return mModelWorld.GetTranslation(); + } } lcMatrix33 GetRelativeRotation() const