void update_last_hit(SculptCurveTool tool, Ray3f ray) { SORayHit soHit; // stick brush to target if we have one if (tool.BrushTarget != null) { Vector3d hitPos, hitNormal; bool bHit = tool.BrushTarget.RayIntersect(ray, out hitPos, out hitNormal); if (bHit) { lastHitPosW = (Vector3f)hitPos; } } else if (in_draw) { lastHitPosW = curDrawFrameW.RayPlaneIntersection(ray.Origin, ray.Direction, 2); } else if (SceneUtil.FindNearestRayIntersection(tool.Targets, ray, out soHit)) { lastHitPosW = soHit.hitPos; } else { Frame3f f = new Frame3f(lastHitPosW, context.ActiveCamera.Forward()); lastHitPosW = f.RayPlaneIntersection(ray.Origin, ray.Direction, 2); } }
override public Capture ForceEndCapture(InputState input, CaptureData data) { SculptCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as SculptCurveTool; in_draw = false; tool.EndBrushStroke(); return(Capture.End); }
override public Capture UpdateCapture(InputState input, CaptureData data) { SculptCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as SculptCurveTool; // [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.EndBrushStroke(); return(Capture.End); } Vector2f vStick = (data.which == CaptureSide.Left) ? input.vLeftStickDelta2D : input.vRightStickDelta2D; if (vStick[1] != 0) { tool.Radius.Add(fDimension.World(vStick[1] * resize_speed(ref input))); } //Ray3f sideRay = (data.which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay; Frame3f sideHandF = (data.which == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame; sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z; //tool.UpdateDraw_Spatial(sideRay, sideHandF); bool bReleased = (data.which == CaptureSide.Left) ? input.bLeftTriggerReleased : input.bRightTriggerReleased; if (bReleased) { in_draw = false; tool.EndBrushStroke(); return(Capture.End); } else { tool.UpdateBrushStroke(sideHandF); // update draw frame if we are drawing on a target (?) if (tool.BrushTarget != null) { curDrawFrameW = new Frame3f(lastHitPosW, context.ActiveCamera.Forward()); } return(Capture.Continue); } }
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; SculptCurveTool tool = context.ToolManager.GetActiveTool((int)eSide) as SculptCurveTool; // [RMS] old oculus hack that was not very nice... //bool bTouchingStick = // (eSide == CaptureSide.Left) ? input.bLeftStickTouching : input.bRightStickTouching; //tool.ActiveBrush = (bTouchingStick) ? // SculptCurveTool.BrushTool.Smooth : SculptCurveTool.BrushTool.SoftMove; tool.BeginBrushStroke(sideHandF); in_draw = true; return(Capture.Begin(this, eSide)); }
public SculptCurveTool_2DInputBehavior(SculptCurveTool tool, FContext s) { this.tool = tool; context = s; }
public SculptCurveTool_SpatialBehavior(SculptCurveTool tool, FContext s) { context = s; this.tool = tool; }