Esempio n. 1
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSurfaceCurveTool;
            Ray3f sideRay             = (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);
            }

            tool.UpdateDraw_Ray(sideRay);

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

            if (bReleased)
            {
                tool.EndDraw();
                return(Capture.End);
            }
            else
            {
                return(Capture.Continue);
            }
        }
Esempio n. 2
0
        override public Capture ForceEndCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSurfaceCurveTool;

            tool.CancelDraw();
            return(Capture.End);
        }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
0
        override public Capture ForceEndCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            tool.CancelDraw();
            return(Capture.End);
        }
Esempio n. 5
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));
        }
Esempio n. 6
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));
        }
Esempio n. 7
0
        public DrawSurfaceCurveTool_2DBehavior(DrawSurfaceCurveTool tool, FContext s)
        {
            ownerTool = tool;
            context   = s;

            // have to cancel capture if we are in multi-click mode and tool exits
            s.ToolManager.OnToolActivationChanged += ToolManager_OnToolActivationChanged;
        }
Esempio n. 8
0
        public ITool Build(FScene scene, List <SceneObject> targets)
        {
            DrawSurfaceCurveTool tool = new DrawSurfaceCurveTool(scene, targets[0]);

            tool.SamplingRate         = DefaultSamplingRate;
            tool.MinSamplingRate      = Math.Min(tool.MinSamplingRate, DefaultSamplingRate * 0.1f);
            tool.SurfaceOffset        = DefaultSurfaceOffset;
            tool.Closed               = Closed;
            tool.IsOverlayCurve       = IsOverlayCurve;
            tool.EmitNewCurveF        = EmitNewCurveF;
            tool.CurveMaterialF       = CurveMaterialF;
            tool.AttachCurveToSurface = AttachCurveToSurface;
            return(tool);
        }
Esempio n. 9
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));
        }
Esempio n. 10
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));
        }
Esempio n. 11
0
        public virtual ITool Build(FScene scene, List <SceneObject> targets)
        {
            DrawSurfaceCurveTool tool = new_tool(scene, targets[0]);

            tool.SamplingRateScene   = DefaultSamplingRateS;
            tool.MinSamplingRate     = Math.Min(tool.MinSamplingRate, DefaultSamplingRateS * 0.1f);
            tool.SurfaceOffsetScene  = DefaultSurfaceOffsetS;
            tool.CloseThresholdScene = DefaultCloseThresholdS;
            tool.Closed               = Closed;
            tool.IsOverlayCurve       = IsOverlayCurve;
            tool.EmitNewCurveF        = EmitNewCurveF;
            tool.CurveMaterialF       = CurveMaterialF;
            tool.AttachCurveToSurface = AttachCurveToSurface;
            tool.InputMode            = InputMode;
            return(tool);
        }
Esempio n. 12
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);
                }
            }
        }
Esempio n. 13
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            tool.UpdateDraw_Ray(WorldRay(input));

            if (Released(input))
            {
                tool.EndDraw();
                return(Capture.End);
            }
            else
            {
                return(Capture.Continue);
            }
        }
Esempio n. 14
0
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (context.ToolManager.ActiveRightTool == null || !(context.ToolManager.ActiveRightTool is DrawSurfaceCurveTool))
     {
         return(CaptureRequest.Ignore);
     }
     if (Pressed(input))
     {
         DrawSurfaceCurveTool tool =
             (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);
         SORayHit rayHit;
         if (tool.Target.FindRayIntersection(WorldRay(input), out rayHit))
         {
             return(CaptureRequest.Begin(this));
         }
     }
     return(CaptureRequest.Ignore);
 }
Esempio n. 15
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 DrawSurfaceCurveTool)
         {
             DrawSurfaceCurveTool drawTool = tool as DrawSurfaceCurveTool;
             SORayHit             rayHit;
             Ray3f ray = (input.bLeftTriggerPressed) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
             if (drawTool.Target.FindRayIntersection(ray, out rayHit))
             {
                 return(CaptureRequest.Begin(this, eSide));
             }
         }
     }
     return(CaptureRequest.Ignore);
 }