void begin_capture(InputState input, CaptureSide eSide)
        {
            Frame3f handFrameW = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;

            lastPosS          = SceneTransforms.WorldToScene(context.Scene, handFrameW);
            startPosS         = lastPosS;
            startSocketFrameS = legSO.GetLocalFrame(CoordSpace.SceneCoords);
            startAxisS        = new Line3f(startSocketFrameS.Origin, startSocketFrameS.Y);


            if (op is EnclosedRegionOffsetOp)
            {
                EnclosedRegionOffsetOp deformOp = op as EnclosedRegionOffsetOp;
                startParam0 = deformOp.PushPullDistance;
            }
            else if (op is EnclosedRegionSmoothOp)
            {
                EnclosedRegionSmoothOp deformOp = op as EnclosedRegionSmoothOp;
                startParam0 = deformOp.OffsetDistance;
                startParam1 = deformOp.SmoothAlpha;
            }
            else if (op is PlaneBandExpansionOp)
            {
                PlaneBandExpansionOp deformOp = op as PlaneBandExpansionOp;
                startParam0 = deformOp.PushPullDistance;
                startParam1 = deformOp.BandDistance;
            }
        }
Пример #2
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f    useRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            SORayHit rayHit;

            if (cockpit.Scene.FindSORayIntersection(useRay, out rayHit, (so) => { return(so.IsTemporary == false); }))
            {
                var tso = rayHit.hitSO;
                if (tso != null)
                {
                    Frame3f handF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
                    begin_transform(tso);
                    snaps_begin_grab(tso);
                    if (OnBeginGrab != null)
                    {
                        OnBeginGrab(this, tso);
                    }
                    return(Capture.Begin(this, eSide,
                                         new GrabInfo(cockpit, tso, handF)
                    {
                        RotationSpeed = this.RotationSpeed, TranslationSpeed = this.TranslationSpeed
                    }));
                }
            }
            return(Capture.Ignore);
        }
Пример #3
0
        override public CaptureRequest WantsCapture(InputState input)
        {
            if (input.bAButtonPressed ^ input.bXButtonPressed)
            {
                CaptureSide eSide = (input.bXButtonPressed) ? CaptureSide.Left : CaptureSide.Right;
                ITool       tool  = context.ToolManager.GetActiveTool((int)eSide);
                if (tool != null && tool is RevolveTool)
                {
                    return(CaptureRequest.Begin(this, eSide));
                }
            }

            if (input.bLeftTriggerPressed ^ input.bRightTriggerPressed)
            {
                CaptureSide eSide   = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
                Ray         sideRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
                ITool       tool    = context.ToolManager.GetActiveTool((int)eSide);
                if (tool != null && tool is RevolveTool)
                {
                    SORayHit rayHit;
                    if (context.Scene.FindSORayIntersection(sideRay, out rayHit))
                    {
                        return(CaptureRequest.Begin(this, eSide));
                    }
                }
            }
            return(CaptureRequest.Ignore);
        }
Пример #4
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            SORayHit hitSO;

            if (context.Scene.FindSORayIntersection_PivotPriority(input.vTouchWorldRay, out hitSO))
            {
                hitObject = hitSO.hitSO;
            }

            bInitializedPair = false;
            downPos          = input.vTouchPosition2D;
            if (input.nTouchCount == 2)
            {
                downPos2         = input.vSecondTouchPosition2D;
                bInitializedPair = true;
                bHaveCameraState = false;
                bMaybeInSelect   = false;
            }
            else
            {
                bMaybeInSelect = true;
            }

            return(Capture.Begin(this, eSide, null));
        }
Пример #5
0
    // STARTS THE A STROKE CAPTURE
    public override Capture BeginCapture(InputState input, CaptureSide eSide)
    {
        Ray3f   useRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
        Frame3f handF  = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;

        return(Capture.Begin(this, eSide, new GestureInfo(handF)));
    }
        void update_capture(InputState input, InputState lastInput, CaptureSide eSide)
        {
            Frame3f handFrameW = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
            Frame3f newPosS    = SceneTransforms.WorldToScene(context.Scene, handFrameW);

            Vector3f start = startSocketFrameS.ToFrameP(startPosS.Origin);
            Vector3f cur   = startSocketFrameS.ToFrameP(newPosS.Origin);

            float dy = cur.y - start.y;

            start.y = cur.y = 0;
            float dx = cur.Length - start.Length;

            if (op is EnclosedRegionOffsetOp)
            {
                EnclosedRegionOffsetOp deformOp = op as EnclosedRegionOffsetOp;
                deformOp.PushPullDistance = startParam0 + 0.1 * dx;
            }
            else if (op is EnclosedRegionSmoothOp)
            {
                EnclosedRegionSmoothOp deformOp = op as EnclosedRegionSmoothOp;
                deformOp.OffsetDistance = startParam0 + 0.1 * dx;
                deformOp.SmoothAlpha    = startParam1 + 0.1 * dy;
            }
            else if (op is PlaneBandExpansionOp)
            {
                PlaneBandExpansionOp deformOp = op as PlaneBandExpansionOp;
                deformOp.PushPullDistance = startParam0 + 0.1 * dx;
                deformOp.BandDistance     = startParam1 + 0.25 * dy;
            }



            lastPosS = newPosS;
        }
Пример #7
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f   sideRay   = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            Frame3f sideHandF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;

            sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z;

            bool bTouchingStick =
                (eSide == CaptureSide.Left) ? input.bLeftStickTouching : input.bRightStickTouching;

            AnyRayHit rayHit;

            if (bTouchingStick)
            {
                if (context.Scene.FindSceneRayIntersection(sideRay, out rayHit, false))
                {
                    tool.UpdateMeasurePoint(rayHit.hitPos, CoordSpace.WorldCoords, (eSide == CaptureSide.Left) ? 0 : 1, true);
                }
                return(Capture.Begin(this, eSide));
            }
            else
            {
                tool.UpdateMeasurePoint(sideHandF.Origin, CoordSpace.WorldCoords, (eSide == CaptureSide.Left) ? 0 : 1, false);
                return(Capture.Begin(this, eSide));
            }
        }
Пример #8
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f sideRay             = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)eSide) as DrawSurfaceCurveTool;

            tool.BeginDraw_Ray(sideRay);
            return(Capture.Begin(this, eSide));
        }
Пример #9
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            RadialMeasureTool tool =
                (context.ToolManager.ActiveRightTool as RadialMeasureTool);

            upate_hit_pos(tool, WorldRay(input));
            return(Capture.Begin(this, CaptureSide.Any));
        }
Пример #10
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            tool.BeginDraw_Ray(WorldRay(input));
            return(Capture.Begin(this));
        }
Пример #11
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            update_last_hit(tool, SceneRay(ref input, tool.Scene));

            tool.BeginStroke(lastHitFrameS, lastHitElementID, lastHitElementType);

            return(Capture.Begin(this, CaptureSide.Any));
        }
Пример #12
0
 public static InputEvent Spatial(CaptureSide which, InputState input, AnyRayHit hit = null)
 {
     return(new InputEvent()
     {
         ray = (which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay,
         side = which, device = InputDevice.AnySpatialDevice, input = input, hit = hit
     });
 }
Пример #13
0
 public override CaptureRequest WantsCapture(InputState input)
 {
     if (input.bLeftStickPressed ^ input.bRightStickPressed)
     {
         CaptureSide eSide = (input.bLeftStickPressed) ? CaptureSide.Left : CaptureSide.Right;
         return(CaptureRequest.Begin(this, eSide));
     }
     return(CaptureRequest.Ignore);
 }
Пример #14
0
        Capture(CaptureState state, InputBehavior e, CaptureSide which = CaptureSide.Any, object custom_data = null)
        {
            this.state   = state;
            this.element = e;

            this.data             = new CaptureData();
            this.data.which       = which;
            this.data.custom_data = custom_data;
        }
Пример #15
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            //Ray3f sideRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            Frame3f sideHandF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;

            sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z;
            tool.UpdatePlane(sideHandF);

            return(Capture.Begin(this, eSide));
        }
Пример #16
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            SORayHit rayHit;

            if (SceneUtil.FindNearestRayIntersection(tool.Targets, WorldRay(input), out rayHit))
            {
                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
Пример #17
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            capture_data d = new capture_data()
            {
                is_right          = input.bRightMouseDown,
                is_secondary_left = (input.bRightMouseDown == false) && input.bLeftMouseDown && input.bShiftKeyDown
            };

            return(Capture.Begin(this, eSide, d));
        }
Пример #18
0
 public override CaptureRequest WantsCapture(InputState input)
 {
     if ((input.bYButtonPressed ^ input.bBButtonPressed) &&
         input.LeftCaptureActive == false &&
         input.RightCaptureActive == false)
     {
         CaptureSide eSide = (input.bYButtonPressed) ? CaptureSide.Left : CaptureSide.Right;
         return(CaptureRequest.Begin(this, eSide));
     }
     return(CaptureRequest.Ignore);
 }
Пример #19
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            //RevolveTool tool = (context.ToolManager.ActiveRightTool as RevolveTool);
            SORayHit soHit;

            if (context.Scene.FindSORayIntersection(input.vMouseWorldRay, out soHit))
            {
                return(Capture.Begin(this, CaptureSide.Any, soHit.hitSO));
            }
            return(Capture.Ignore);
        }
Пример #20
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            int hit_pt_id = tool.FindNearestHitPoint(WorldRay(input));

            if (hit_pt_id >= 0)
            {
                tool.Begin(hit_pt_id, WorldRay(input));
                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            GrabHandInfo hi = new GrabHandInfo();

            hi.leftStartF  = input.LeftHandFrame;
            hi.rightStartF = input.RightHandFrame;
            hi.camState    = cockpit.ActiveCamera.Manipulator().GetCurrentState(cockpit.Scene);
            hi.startCamF   = cockpit.ActiveCamera.Manipulator().SceneGetFrame(cockpit.Scene);

            return(Capture.Begin(this, eSide, hi));
        }
Пример #22
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f    useRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            SORayHit rayHit;

            if (scene.Scene.FindSORayIntersection(useRay, out rayHit))
            {
                return(Capture.Begin(this, eSide, rayHit.hitSO));
            }
            return(Capture.Ignore);
        }
Пример #23
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            selectSO = null;
            SORayHit rayHit;

            if (scene.Scene.FindSORayIntersection(input.vGamepadWorldRay, out rayHit))
            {
                selectSO = rayHit.hitSO;
                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
Пример #24
0
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (input.bLeftTriggerPressed ^ input.bRightTriggerPressed)
     {
         CaptureSide eSide = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
         //ITool tool = context.ToolManager.GetActiveTool((int)eSide);
         //if (tool != null && tool is TwoPointMeasureTool) {
         return(CaptureRequest.Begin(this, eSide));
         //}
     }
     return(CaptureRequest.Ignore);
 }
Пример #25
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f worldRay  = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            int   hit_pt_id = tool.FindNearestHitPoint(worldRay);

            if (hit_pt_id >= 0)
            {
                tool.Begin(hit_pt_id, worldRay);
                return(Capture.Begin(this, eSide));
            }
            return(Capture.Ignore);
        }
Пример #26
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            DrawCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawCurveTool);
            AnyRayHit rayHit;

            if (context.Scene.FindSceneRayIntersection(WorldRay(input), out rayHit))
            {
                tool.BeginDraw_Ray(rayHit);
                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
Пример #27
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            update_last_hit(tool, WorldRay(ref input));
            curDrawFrameW = new Frame3f(lastHitPosW, context.ActiveCamera.Forward());

            tool.ActiveBrush = (input.bShiftKeyDown) ?
                               tool.SecondaryBrushTool : tool.PrimaryBrushTool;

            tool.BeginBrushStroke(new Frame3f(lastHitPosW));
            in_draw = true;

            return(Capture.Begin(this, CaptureSide.Any));
        }
Пример #28
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            SORayHit rayHit;
            bool     bHit = context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF);

            if (bHit)
            {
                clickSO    = rayHit.hitSO;
                vClickDown = ClickPoint(input);
                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
 override public CaptureRequest WantsCapture(InputState input)
 {
     if ((input.bLeftTriggerPressed && input.LeftCaptureActive == false) ^
         (input.bRightTriggerPressed && input.RightCaptureActive == false))
     {
         CaptureSide eSide = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
         if (WantsCaptureF(input, eSide))
         {
             return(CaptureRequest.Begin(this, eSide));
         }
     }
     return(CaptureRequest.Ignore);
 }
Пример #30
0
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (input.bLeftTriggerPressed ^ input.bRightTriggerPressed)
     {
         CaptureSide eSide    = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
         ITool       sideTool = context.ToolManager.GetActiveTool((int)eSide);
         if (sideTool == tool)
         {
             return(CaptureRequest.Begin(this, eSide));
         }
     }
     return(CaptureRequest.Ignore);
 }