diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 275242e0..2aada15f 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -1822,7 +1822,7 @@ lcVector3 lcModel::SnapRotation(const lcVector3& Angles) const return NewAngles; } -lcMatrix44 lcModel::GetRelativeRotation() const +lcMatrix33 lcModel::GetRelativeRotation() const { if (gMainWindow->GetRelativeTransform()) { @@ -1832,7 +1832,7 @@ lcMatrix44 lcModel::GetRelativeRotation() const return ((lcPiece*)Focus)->GetRelativeRotation(); } - return lcMatrix44Identity(); + return lcMatrix33Identity(); } void lcModel::AddPiece() @@ -2232,16 +2232,16 @@ bool lcModel::RemoveSelectedObjects() void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool AlternateButtonDrag, bool Update, bool Checkpoint) { bool Moved = false; - lcMatrix44 RelativeRotation; + lcMatrix33 RelativeRotation; if (Relative) RelativeRotation = GetRelativeRotation(); else - RelativeRotation = lcMatrix44Identity(); + RelativeRotation = lcMatrix33Identity(); if (PieceDistance.LengthSquared() >= 0.001f) { - lcVector3 TransformedPieceDistance = lcMul30(PieceDistance, RelativeRotation); + lcVector3 TransformedPieceDistance = lcMul(PieceDistance, RelativeRotation); for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++) { @@ -2258,7 +2258,7 @@ void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector if (ObjectDistance.LengthSquared() >= 0.001f) { - lcVector3 TransformedObjectDistance = lcMul30(ObjectDistance, RelativeRotation); + lcVector3 TransformedObjectDistance = lcMul(ObjectDistance, RelativeRotation); for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++) { diff --git a/common/lc_model.h b/common/lc_model.h index 0ae9ce03..e12872af 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -277,7 +277,7 @@ public: lcVector3 LockVector(const lcVector3& Vector) const; lcVector3 SnapPosition(const lcVector3& Delta) const; lcVector3 SnapRotation(const lcVector3& Delta) const; - lcMatrix44 GetRelativeRotation() const; + lcMatrix33 GetRelativeRotation() const; const lcVector3& GetMouseToolDistance() const { diff --git a/common/piece.h b/common/piece.h index 668fdf40..7b4c3640 100644 --- a/common/piece.h +++ b/common/piece.h @@ -410,20 +410,12 @@ public: return mModelWorld.GetTranslation(); } - lcMatrix44 GetRelativeRotation() const + lcMatrix33 GetRelativeRotation() const { if (mState & LC_PIECE_PIVOT_POINT_VALID) - { - lcMatrix44 WorldMatrix = lcMul(mModelWorld, mPivotMatrix); - WorldMatrix.SetTranslation(lcVector3(0.0f, 0.0f, 0.0f)); - return WorldMatrix; - } + return lcMatrix33(lcMul(mModelWorld, mPivotMatrix)); else - { - lcMatrix44 WorldMatrix = mModelWorld; - WorldMatrix.SetTranslation(lcVector3(0.0f, 0.0f, 0.0f)); - return WorldMatrix; - } + return lcMatrix33(mModelWorld); } void ResetPivotPoint() diff --git a/common/view.cpp b/common/view.cpp index 1ff635ee..9ce6a704 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -683,11 +683,11 @@ void View::DrawSelectMoveOverlay() glDisable(GL_DEPTH_TEST); - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); lcVector3 OverlayCenter = mModel->GetFocusOrSelectionCenter(); bool AnyPiecesSelected = mModel->AnyPiecesSelected(); - lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter)); + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); const float OverlayScale = GetOverlayScale(); WorldMatrix = lcMul(lcMatrix44Scale(lcVector3(OverlayScale, OverlayScale, OverlayScale)), WorldMatrix); @@ -793,7 +793,7 @@ void View::DrawRotateOverlay() int j; - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); lcVector3 OverlayCenter = mModel->GetFocusOrSelectionCenter(); lcVector3 MouseToolDistance = mModel->SnapRotation(mModel->GetMouseToolDistance()); bool HasAngle = false; @@ -841,7 +841,7 @@ void View::DrawRotateOverlay() if (fabsf(Angle) >= fabsf(Step)) { - lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter)); + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); WorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); mContext->SetWorldMatrix(WorldMatrix); @@ -925,9 +925,9 @@ void View::DrawRotateOverlay() ViewDir.Normalize(); // Transform ViewDir to local space. - ViewDir = lcMul30(ViewDir, lcMatrix44AffineInverse(RelativeRotation)); + ViewDir = lcMul(ViewDir, lcMatrix33AffineInverse(RelativeRotation)); - lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter)); + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); mContext->SetWorldMatrix(WorldMatrix); // Draw each axis circle. @@ -1023,7 +1023,7 @@ void View::DrawRotateOverlay() break; }; - lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter)); + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); WorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); mContext->SetWorldMatrix(WorldMatrix); @@ -1691,10 +1691,10 @@ void View::UpdateTrackTool() lcVector3(0.0f, 0.0f, 1.0f), }; - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); for (int i = 0; i < 3; i++) - PlaneNormals[i] = lcMul30(PlaneNormals[i], RelativeRotation); + PlaneNormals[i] = lcMul(PlaneNormals[i], RelativeRotation); lcVector3 StartEnd[2] = { lcVector3((float)x, (float)y, 0.0f), lcVector3((float)x, (float)y, 1.0f) }; UnprojectPoints(StartEnd, 2); @@ -1834,7 +1834,7 @@ void View::UpdateTrackTool() lcVector3(x1 + u2*(x2-x1), y1 + u2*(y2-y1), z1 + u2*(z2-z1)) }; - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); for (int i = 0; i < 2; i++) { @@ -1843,7 +1843,7 @@ void View::UpdateTrackTool() if (lcDot(ViewDir, Dist) > 0.0f) continue; - Dist = lcMul30(Dist, RelativeRotation); + Dist = lcMul(Dist, RelativeRotation); // Check if we're close enough to one of the axis. Dist.Normalize(); @@ -2475,8 +2475,8 @@ void View::OnMouseMove() else Direction = lcVector3(0.0, 0.0f, 1.0f); - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); - Direction = lcMul30(Direction, RelativeRotation); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); + Direction = lcMul(Direction, RelativeRotation); lcVector3 Intersection; lcClosestPointsBetweenLines(Center, Center + Direction, CurrentStart, CurrentEnd, &Intersection, NULL); @@ -2485,7 +2485,7 @@ void View::OnMouseMove() lcClosestPointsBetweenLines(Center, Center + Direction, MouseDownStart, MouseDownEnd, &MoveStart, NULL); lcVector3 Distance = Intersection - MoveStart; - Distance = lcMul30(Distance, lcMatrix44AffineInverse(RelativeRotation)); + Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); mModel->UpdateMoveTool(Distance, mTrackButton != LC_TRACKBUTTON_LEFT); } else if (mTrackTool == LC_TRACKTOOL_MOVE_XY || mTrackTool == LC_TRACKTOOL_MOVE_XZ || mTrackTool == LC_TRACKTOOL_MOVE_YZ) @@ -2499,8 +2499,8 @@ void View::OnMouseMove() else PlaneNormal = lcVector3(1.0f, 0.0f, 0.0f); - lcMatrix44 RelativeRotation = mModel->GetRelativeRotation(); - PlaneNormal = lcMul30(PlaneNormal, RelativeRotation); + lcMatrix33 RelativeRotation = mModel->GetRelativeRotation(); + PlaneNormal = lcMul(PlaneNormal, RelativeRotation); lcVector4 Plane(PlaneNormal, -lcDot(PlaneNormal, Center)); lcVector3 Intersection; @@ -2511,7 +2511,7 @@ void View::OnMouseMove() if (lcLinePlaneIntersection(&MoveStart, MouseDownStart, MouseDownEnd, Plane)) { lcVector3 Distance = Intersection - MoveStart; - Distance = lcMul30(Distance, lcMatrix44AffineInverse(RelativeRotation)); + Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); mModel->UpdateMoveTool(Distance, mTrackButton != LC_TRACKBUTTON_LEFT); } }