예제 #1
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));
        }
예제 #2
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));
        }
예제 #3
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));
        }
예제 #4
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);
        }
        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));
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
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));
        }
예제 #9
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            update_last_hit(tool, WorldRay(ref input));

            if (input.IsForDevice(InputDevice.Mouse))
            {
                tool.Invert       = input.bCtrlKeyDown;
                tool.UseSecondary = input.bShiftKeyDown;
            }

            tool.BeginBrushStroke(lastHitFrameW, lastHitTID);

            return(Capture.Begin(this, CaptureSide.Any));
        }
예제 #10
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.Continuous)
            {
                tool.BeginDraw_Ray_Continuous(WorldRay(input));
            }
            else
            {
                tool.BeginDraw_Ray_MultiClick();
            }
            return(Capture.Begin(this));
        }
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f    useRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            UIRayHit uiHit;

            if (scene.FindUIHit(useRay, out uiHit))
            {
                bool bCanCapture = uiHit.hitUI.BeginCapture(InputEvent.Spatial(eSide, input, new AnyRayHit(uiHit)));
                if (bCanCapture)
                {
                    return(Capture.Begin(this, eSide, uiHit.hitUI));
                }
            }
            return(Capture.Ignore);
        }
예제 #12
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f worldRay            = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)eSide) as DrawSurfaceCurveTool;

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.Continuous)
            {
                tool.BeginDraw_Ray_Continuous(worldRay);
            }
            else
            {
                tool.BeginDraw_Ray_MultiClick();
            }

            return(Capture.Begin(this, eSide));
        }
예제 #13
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f    worldRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            SORayHit rayHit;
            bool     bHit = context.Scene.FindSORayIntersection(worldRay, out rayHit, ObjectFilterF);

            if (bHit)
            {
                targetSO = rayHit.hitSO;
                BaseSurfacePointTool tool = context.ToolManager.GetActiveTool((int)eSide) as BaseSurfacePointTool;
                tool.Begin(targetSO, Vector2d.Zero, worldRay);

                return(Capture.Begin(this, eSide));
            }
            return(Capture.Ignore);
        }
예제 #14
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            SORayHit rayHit;
            bool     bHit = context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF);

            if (bHit)
            {
                targetSO = rayHit.hitSO;
                BaseSurfacePointTool tool =
                    (context.ToolManager.ActiveRightTool as BaseSurfacePointTool);
                tool.Begin(targetSO, ClickPoint(input), WorldRay(input));

                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
        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))
            {
                var tso = rayHit.hitSO as TransformableSO;
                if (tso != null)
                {
                    Frame3f handF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
                    return(Capture.Begin(this, eSide, new GrabInfo(cockpit, tso, handF)));
                }
            }
            return(Capture.Ignore);
        }
예제 #16
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Frame3f            worldFrame = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
            DrawSpaceCurveTool tool       = context.ToolManager.GetActiveTool((int)eSide) as DrawSpaceCurveTool;

            if (tool.InputMode == DrawSpaceCurveTool.DrawMode.Continuous)
            {
                tool.BeginDraw_Ray_Continuous(worldFrame);
            }
            else
            {
                tool.BeginDraw_Ray_MultiClick();
            }

            return(Capture.Begin(this, eSide));
        }
예제 #17
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            DrawPrimitivesTool tool =
                (context.ToolManager.ActiveRightTool as DrawPrimitivesTool);
            AnyRayHit rayHit;

            if (context.Scene.FindSceneRayIntersection(input.vMouseWorldRay, out rayHit))
            {
                tool.BeginDraw_Ray(input.vMouseWorldRay, rayHit, 0);
                return(Capture.Begin(this, CaptureSide.Any, new capture_data()
                {
                    nStep = 0
                }));
            }
            return(Capture.Ignore);
        }
예제 #18
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;
            SurfaceBrushTool tool = context.ToolManager.GetActiveTool((int)eSide) as SurfaceBrushTool;

            // [RMS] old oculus hack that was not very nice...
            //bool bTouchingStick =
            //    (eSide == CaptureSide.Left) ? input.bLeftStickTouching : input.bRightStickTouching;
            //tool.ActiveBrush = (bTouchingStick) ?
            //    SurfaceBrushTool.BrushTool.Smooth : SurfaceBrushTool.BrushTool.SoftMove;

            tool.BeginBrushStroke(sideHandF, lastHitTID);

            return(Capture.Begin(this, eSide));
        }
예제 #19
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray                sideRay   = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            Frame3f            sideHandF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
            DrawPrimitivesTool tool      = context.ToolManager.GetActiveTool((int)eSide) as DrawPrimitivesTool;

            AnyRayHit rayHit;

            if (context.Scene.FindSceneRayIntersection(sideRay, out rayHit))
            {
                tool.BeginDraw_Spatial(sideRay, rayHit, sideHandF, 0);
                return(Capture.Begin(this, eSide, new capture_data()
                {
                    nStep = 0
                }));
            }
            return(Capture.Ignore);
        }
예제 #20
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            float fDelta = 0.0f;

            if (input.fMouseWheel != 0)
            {
                fDelta = -input.fMouseWheel * 0.02f;
            }
            else if (input.vLeftStickDelta2D[1] != 0)
            {
                fDelta = input.vLeftStickDelta2D[1] * 0.015f;
            }
            else if (input.vRightStickDelta2D[1] != 0)
            {
                fDelta = input.vRightStickDelta2D[1] * 0.015f;
            }
            adapter.FolderList.Scroll(fDelta);

            return(Capture.Begin(this));
        }
예제 #21
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            // [TODO] we just did above...
            pCapturing = null;

            UIRayHit uiHit;

            if (input.bTouchPressed)
            {
                if (scene.FindUIHit(input.vTouchWorldRay, out uiHit))
                {
                    bool bCanCapture = uiHit.hitUI.BeginCapture(InputEvent.Touch(input, new AnyRayHit(uiHit)));
                    if (bCanCapture)
                    {
                        pCapturing = uiHit.hitUI;
                        return(Capture.Begin(this));
                    }
                }
            }
            return(Capture.Ignore);
        }
예제 #22
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);

                // if tool wants to apply action on press instead of release, we send it next frame
                BaseSingleClickTool tool = (context.ToolManager.ActiveRightTool as BaseSingleClickTool);
                if (tool.ActionOnRelease == false)
                {
                    clicked(clickSO, ClickPoint(input), WorldRay(input));
                }

                return(Capture.Begin(this));
            }
            return(Capture.Ignore);
        }
예제 #23
0
        public override Capture BeginCapture(InputState input, CaptureSide eWhich)
        {
            pCapturing = null;

            UIRayHit uiHit;

            if (input.bLeftTriggerPressed || input.bAButtonPressed)
            {
                ActiveInput = (input.bLeftTriggerPressed) ? WhichInput.LeftTrigger : WhichInput.AButton;
                if (scene.FindUIHit(input.vGamepadWorldRay, out uiHit))
                {
                    bool bCanCapture = uiHit.hitUI.BeginCapture(InputEvent.Gamepad(input, new AnyRayHit(uiHit)));
                    if (bCanCapture)
                    {
                        pCapturing = uiHit.hitUI;
                        return(Capture.Begin(this));
                    }
                }
            }
            return(Capture.Ignore);
        }
예제 #24
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            HandInfo hi = new HandInfo();

            hi.eMode = ActionMode.TransformCamera;

            Frame3f camFrame = cockpit.ActiveCamera.GetWorldFrame();

            // if both rays hit scene and are within a few visual degrees, then we
            // we pull out a sphere and use it to re-scale the world.
            // Otherwise do normal hand-transform actions
            AnyRayHit hit1, hit2;
            bool      bHit1 = cockpit.Scene.FindSceneRayIntersection(input.vLeftSpatialWorldRay, out hit1);
            bool      bHit2 = cockpit.Scene.FindSceneRayIntersection(input.vRightSpatialWorldRay, out hit2);

            if (bHit1 && bHit2)
            {
                Vector3 avg = (hit1.hitPos + hit2.hitPos) * 0.5f;
                float   d   = VRUtil.GetVRRadiusForVisualAngle(avg, camFrame.Origin, 2.0f);
                if ((hit1.hitPos - hit2.hitPos).Length < d)
                {
                    hi.eMode = ActionMode.SetWorldScale;
                    Frame3f centerF = cockpit.Scene.SceneFrame;
                    centerF.Origin = avg;
                    Frame3f planeF = new Frame3f(centerF.Origin, camFrame.Z);
                    hi.BeginSetWorldScale(centerF, planeF, 2 * d);
                    hi.UpdateSetWorldScale(input.vLeftSpatialWorldRay, input.vRightSpatialWorldRay);
                }
            }

            hi.leftStartF  = input.LeftHandFrame;
            hi.rightStartF = input.RightHandFrame;
            hi.camState    = cockpit.ActiveCamera.Manipulator().GetCurrentState(cockpit.Scene);
            hi.camRight    = camFrame.X;
            hi.camForward  = camFrame.Z;

            cockpit.ActiveCamera.SetTargetVisible(true);

            return(Capture.Begin(this, CaptureSide.Both, hi));
        }
예제 #25
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            // [TODO] we just did above...

            pCapturing = null;

            UIRayHit uiHit;

            if (input.bLeftMousePressed)
            {
                if (scene.Find2DCockpitUIHit(input.vMouseOrthoWorldRay, out uiHit))
                {
                    bool bCanCapture = uiHit.hitUI.BeginCapture(InputEvent.Mouse(input.ToOrthoLayerInput(), new AnyRayHit(uiHit)));
                    if (bCanCapture)
                    {
                        pCapturing = uiHit.hitUI;
                        return(Capture.Begin(this));
                    }
                }
            }
            return(Capture.Ignore);
        }
예제 #26
0
        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Ray3f    useRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            SORayHit rayHit;

            if (context.Scene.FindSORayIntersection(useRay, out rayHit, ObjectFilterF))
            {
                var tso = rayHit.hitSO;
                if (tso != null)
                {
                    Frame3f handF = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
                    if (OnBeginGrab != null)
                    {
                        OnBeginGrab(this, tso);
                    }
                    return(Capture.Begin(this, eSide,
                                         new GrabInfo(tso, handF)
                    {
                        RotationSpeed = this.RotationSpeed, TranslationSpeed = this.TranslationSpeed, StickSpeed = this.StickMoveSpeed
                    }));
                }
            }
            return(Capture.Ignore);
        }
 public override Capture BeginCapture(InputState input, CaptureSide eSide)
 {
     Context.ActiveCamera.SetTargetVisible(true);
     return(Capture.Begin(this, eSide, null));
 }
 override public Capture BeginCapture(InputState input, CaptureSide eSide)
 {
     BeginCaptureF(input, eSide);
     return(Capture.Begin(this));
 }
 public override Capture BeginCapture(InputState input, CaptureSide eSide)
 {
     return(Capture.Begin(this, eSide, null));
 }
예제 #30
0
        // we only get to these functions if we are in one of them


        public override Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            mouseDownPos = input.vMousePosition2D;
            return(Capture.Begin(this, eSide, null));
        }