Ejemplo n.º 1
0
 override public void UpdateHover(Ray3f ray, UIRayHit hit)
 {
     if (Enabled && HasGO(hit.hitGO))
     {
         indicator.SetMaterial((tracker.IsLocked) ? matLockedHover : matHover, true);
     }
 }
Ejemplo n.º 2
0
        public override bool BeginCapture(ITransformable target, Ray3f worldRay, UIRayHit hit)
        {
            originalTargetS = target.GetLocalFrame(CoordSpace.SceneCoords);

            snapState = new SnapStateMachine <SnapResult>();

            return(true);
        }
Ejemplo n.º 3
0
        public override Capture UpdateCapture(InputState input, CaptureData data)
        {
            bool       bReleased = false;
            bool       bContinue = false;
            InputEvent e         = null;

            if (input.IsForDevice(InputDevice.Mouse))
            {
                bReleased = input.bRightMouseReleased;
                bContinue = input.bRightMouseDown;
                e         = InputEvent.Mouse(input);
            }
            else if (input.IsForDevice(InputDevice.Gamepad))
            {
                bReleased = input.bRightTriggerReleased;
                bContinue = input.bRightTriggerDown;
                e         = InputEvent.Gamepad(input);
            }
            else if (input.IsForDevice(InputDevice.AnySpatialDevice))
            {
                bReleased =
                    (data.which == CaptureSide.Left && input.bXButtonReleased) ||
                    (data.which == CaptureSide.Right && input.bAButtonReleased);
                bContinue =
                    (data.which == CaptureSide.Left && input.bXButtonDown) ||
                    (data.which == CaptureSide.Right && input.bAButtonDown);
                e = InputEvent.Spatial(data.which, input);
            }


            if (bReleased)
            {
                UIRayHit hit = new UIRayHit();
                if (popup.FindRayIntersection(e.ray, out hit))
                {
                    popup.EndCapture(e);
                }

                // do animated dismiss that will destroy menu on completion
                HUDUtil.AnimatedDimiss_Scene(popup, cockpit.Scene, true, 0.2f);

                // lose our reference
                popup = null;

                return(Capture.End);
            }
            else if (bContinue)
            {
                popup.UpdateCapture(e);
                return(Capture.Continue);
            }
            // should never get here...
            DebugUtil.Log(2, "[RightClickBehavior::UpdateCapture] how did we get here?");
            return(Capture.End);
        }
Ejemplo n.º 4
0
        public override bool BeginCapture(ITransformable target, Ray3f worldRay, UIRayHit hit)
        {
            if (deformer == null)
            {
                deformer = new ArcLengthSoftTranslation()
                {
                    Curve = curve.Curve, ArcRadius = 3.0f
                };
            }

            DCurve3 c  = curve.Curve;
            int     vi = (VertexIndex == LastIndex) ? c.VertexCount - 1 : 0;

            deformer.Handle = c.GetVertex(vi);
            deformer.UpdateROI(vi);
            deformer.BeginDeformation();

            targetW = target.GetLocalFrame(CoordSpace.WorldCoords);

            return(true);
        }
Ejemplo n.º 5
0
        float fHeightStartT;         // start T-value along heightAxisW

        public override bool BeginCapture(ITransformable target, Ray3f worldRay, UIRayHit hit)
        {
            fStartValue = primitive.Parameters.GetValue <float>(AxisParamName);

            // save necessary frame info
            targetFrameW = target.GetLocalFrame(CoordSpace.WorldCoords);
            heightAxisW  = targetFrameW.FromFrameV(AxisVectorInFrame);

            // save t-value of closest point on height axis, so we can find delta-t
            Vector3f vWorldHitPos = hit.hitPos;

            fHeightStartT = Distance.ClosestPointOnLineT(
                targetFrameW.Origin, heightAxisW, vWorldHitPos);

            // construct plane we will ray-intersect with in UpdateCapture()
            Vector3f makeUp       = Vector3f.Cross(scene.ActiveCamera.Forward(), heightAxisW).Normalized;
            Vector3f vPlaneNormal = Vector3f.Cross(makeUp, heightAxisW).Normalized;

            raycastFrame = new Frame3f(vWorldHitPos, vPlaneNormal);

            return(true);
        }
Ejemplo n.º 6
0
 public override bool BeginCapture(ITransformable target, Ray3f worldRay, UIRayHit hit)
 {
     return(true);
 }