示例#1
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);
        }
示例#2
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);
        }
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (context.ToolManager.ActiveRightTool == null || !(context.ToolManager.ActiveRightTool is BaseSurfacePointTool))
     {
         return(CaptureRequest.Ignore);
     }
     if (Pressed(input))
     {
         SORayHit rayHit;
         if (context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF))
         {
             BaseSurfacePointTool tool =
                 (context.ToolManager.ActiveRightTool as BaseSurfacePointTool);
             if (tool.WantCapture(rayHit.hitSO, ClickPoint(input), WorldRay(input)))
             {
                 return(CaptureRequest.Begin(this));
             }
         }
     }
     return(CaptureRequest.Ignore);
 }
示例#4
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            BaseSurfacePointTool tool =
                (context.ToolManager.ActiveRightTool as BaseSurfacePointTool);

            if (Released(input))
            {
                tool.End();
                return(Capture.End);
            }
            else
            {
                SORayHit rayHit;
                bool     bHit = targetSO.FindRayIntersection(WorldRay(input), out rayHit);
                if (bHit)
                {
                    tool.Update(ClickPoint(input), WorldRay(input));
                }
                return(Capture.Continue);
            }
        }
示例#5
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            BaseSurfacePointTool tool = context.ToolManager.GetActiveTool((int)data.which) as BaseSurfacePointTool;
            Ray3f worldRay            = (data.which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
            bool  bReleased           = (data.which == CaptureSide.Left) ? input.bLeftTriggerReleased : input.bRightTriggerReleased;

            if (bReleased)
            {
                tool.End();
                return(Capture.End);
            }
            else
            {
                SORayHit rayHit;
                bool     bHit = targetSO.FindRayIntersection(worldRay, out rayHit);
                if (bHit)
                {
                    tool.Update(Vector2d.Zero, worldRay);
                }
                return(Capture.Continue);
            }
        }
示例#6
0
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (input.bLeftTriggerPressed ^ input.bRightTriggerPressed)
     {
         CaptureSide eSide = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
         ITool       itool = context.ToolManager.GetActiveTool((int)eSide);
         if (itool != null && itool is BaseSurfacePointTool)
         {
             Ray3f    worldRay = (eSide == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;
             SORayHit rayHit;
             if (context.Scene.FindSORayIntersection(worldRay, out rayHit, ObjectFilterF))
             {
                 BaseSurfacePointTool tool = itool as BaseSurfacePointTool;
                 if (tool.WantCapture(rayHit.hitSO, Vector2d.Zero, worldRay))
                 {
                     return(CaptureRequest.Begin(this, eSide));
                 }
             }
         }
     }
     return(CaptureRequest.Ignore);
 }