示例#1
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSurfaceCurveTool;
            Ray3f worldRay            = (data.which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;

            // [RMS] this is a hack for trigger+shoulder grab gesture...really need some way
            //   to interrupt captures!!
            if ((data.which == CaptureSide.Left && input.bLeftShoulderPressed) ||
                (data.which == CaptureSide.Right && input.bRightShoulderPressed))
            {
                tool.CancelDraw();
                return(Capture.End);
            }


            // this happens if we exit tool while in draw (cts or multi-click). We need to fail gracefully in those cases.
            if (tool == null)
            {
                return(Capture.End);
            }
            // this can happen if we called tool.EndDraw() somewhere else
            if (tool.InDraw == false)
            {
                return(Capture.End);
            }

            bool bReleased = (data.which == CaptureSide.Left) ? input.bLeftTriggerReleased : input.bRightTriggerReleased;

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.OnClick)
            {
                if (bReleased)
                {
                    if (tool.UpdateDraw_Ray_MultiClick(worldRay) == false)
                    {
                        tool.EndDraw();
                        return(Capture.End);
                    }
                }
                else
                {
                    tool.UpdateDrawPreview_Ray_MultiClick(worldRay);
                }

                return(Capture.Continue);
            }
            else
            {
                tool.UpdateDraw_Ray_Continuous(worldRay);
                if (bReleased)
                {
                    tool.EndDraw();
                    return(Capture.End);
                }
                else
                {
                    return(Capture.Continue);
                }
            }
        }
示例#2
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            // this happens if we exit tool while in draw (cts or multi-click). We need to fail gracefully in those cases.
            if (tool == null)
            {
                return(Capture.End);
            }
            // this can happen if we called tool.EndDraw() somewhere else
            if (tool.InDraw == false)
            {
                return(Capture.End);
            }

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.OnClick)
            {
                if (Released(input))
                {
                    if (tool.UpdateDraw_Ray_MultiClick(WorldRay(input)) == false)
                    {
                        tool.EndDraw();
                        return(Capture.End);
                    }
                }
                else
                {
                    tool.UpdateDrawPreview_Ray_MultiClick(WorldRay(input));
                }

                return(Capture.Continue);
            }
            else
            {
                tool.UpdateDraw_Ray_Continuous(WorldRay(input));
                if (Released(input))
                {
                    tool.EndDraw();
                    return(Capture.End);
                }
                else
                {
                    return(Capture.Continue);
                }
            }
        }