public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); float zMovement = state.CameraObj.Transform.Pos.Z - lastLocSpace.Z; Vector3 target = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z + zMovement)); Vector3 movLock = beginLocSpace - lastLocSpace; Vector3 mov = target - lastLocSpace; mov.Z = zMovement; target.Z = 0; if (lockedAxis == CamViewState.LockedAxis.X) { mov = new Vector3(mov.X, 0, 0); } else if (lockedAxis == CamViewState.LockedAxis.Y) { mov = new Vector3(0, mov.Y, 0); } else { mov = state.ApplyAxisLock(mov, movLock, target + (Vector3.UnitZ * state.CameraObj.Transform.Pos.Z) - beginLocSpace); } state.MoveSelectionBy(mov); state.ActionLastLocSpace += mov; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); float zMovement = state.CameraObj.Transform.Pos.Z - lastLocSpace.Z; Vector3 target = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z + zMovement)); Vector3 movLock = beginLocSpace - lastLocSpace; Vector3 mov = target - lastLocSpace; mov.Z = zMovement; target.Z = 0; if (lockedAxis == CamViewState.LockedAxis.X) { mov = new Vector3(mov.X, 0, 0); } else if (lockedAxis == CamViewState.LockedAxis.Y) { mov = new Vector3(0, mov.Y, 0); } else { mov = state.ApplyAxisLock(mov, movLock, target + (Vector3.UnitZ * state.CameraObj.Transform.Pos.Z) - beginLocSpace); } state.MoveSelectionBy(mov); state.ActionLastLocSpace += mov; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, lastLocSpace.X, lastLocSpace.Y); float curAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, spaceCoord.X, spaceCoord.Y); float rotation = curAngle - lastAngle; state.RotateSelectionBy(rotation); state.ActionLastLocSpace = spaceCoord; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, lastLocSpace.X, lastLocSpace.Y); float curAngle = MathF.Angle(selectionCenter.X, selectionCenter.Y, spaceCoord.X, spaceCoord.Y); float rotation = curAngle - lastAngle; state.RotateSelectionBy(rotation); state.ActionLastLocSpace = spaceCoord; }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); if (selectionRadius == 0.0f) return; Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastRadius = selectionRadius; float curRadius = (selectionCenter - spaceCoord).Length; float scale = MathF.Clamp(curRadius / lastRadius, 0.0001f, 10000.0f); state.ScaleSelectionBy(scale); state.ActionLastLocSpace = spaceCoord; state.Invalidate(); }
public void Update(CamViewState state, Point mouseLoc, Point beginLoc, Vector3 beginLocSpace, Vector3 lastLocSpace, Vector3 selectionCenter, float selectionRadius, CamViewState.LockedAxis lockedAxis) { state.ValidateSelectionStats(); if (selectionRadius == 0.0f) { return; } Vector3 spaceCoord = state.GetSpaceCoord(new Vector3(mouseLoc.X, mouseLoc.Y, selectionCenter.Z)); float lastRadius = selectionRadius; float curRadius = (selectionCenter - spaceCoord).Length; float scale = MathF.Clamp(curRadius / lastRadius, 0.0001f, 10000.0f); state.ScaleSelectionBy(scale); state.ActionLastLocSpace = spaceCoord; state.Invalidate(); }