public DrawSurfaceCurveTool(FScene scene, SceneObject target) { this.Scene = scene; this.target = target; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new DrawSurfaceCurveTool_2DBehavior(this, scene.Context) { Priority = 5 }); if (FPlatform.IsUsingVR()) { behaviors.Add( new DrawSurfaceCurveTool_SpatialDeviceBehavior(this, scene.Context) { Priority = 5 }); } // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); scene.SelectionChangedEvent += Scene_SelectionChangedEvent; // restore radius //if (SavedSettings.Restore("DrawSurfaceCurveTool_width") != null) // width = (float)SavedSettings.Restore("DrawSurfaceCurveTool_width"); }
public static void ShowCenteredPopupMessage(string sTitleText, string sText, Cockpit cockpit) { HUDPopupMessage message = new HUDPopupMessage() { Width = 500 * cockpit.GetPixelScale(), Height = 250 * cockpit.GetPixelScale(), TitleTextHeight = 30 * cockpit.GetPixelScale(), TextHeight = 20 * cockpit.GetPixelScale(), BackgroundColor = Colorf.Silver, TextColor = Colorf.VideoBlack, TitleText = sTitleText, Text = sText }; message.Create(); if (FPlatform.IsUsingVR()) { HUDUtil.PlaceInSphere(message, 0.5f, 0, 0); } else { HUDUtil.PlaceInSphere(message, 1.5f, 0, 0); } message.Name = "popup"; cockpit.AddUIElement(message, true); message.OnDismissed += (s, e) => { AnimatedDimiss_Cockpit(message, cockpit, true); }; AnimatedShow(message); }
public SurfaceBrushTool(FScene scene, DMeshSO target) { this.scene = scene; this.target = target; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new SurfaceBrushTool_2DInputBehavior(this, scene.Context) { Priority = 5 }); if (FPlatform.IsUsingVR()) { behaviors.Add( new SurfaceBrushTool_SpatialBehavior(this, scene.Context) { Priority = 5 }); } // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); Indicators = new ToolIndicatorSet(this, scene); }
// Update is called once per frame public void Update() { FPlatform.IncrementFrameCounter(); if (FPlatform.IsWindowResized()) { FUtil.SafeSendAnyEvent(OnWindowResized); } // update our wrappers around various different Input modes InputExtension.Get.Update(); // update cockpit tracking and let UI do per-frame rendering computations if (options.EnableCockpit) { ActiveCockpit.Update(); } // hardcoded Q key quits app if (Input.GetKeyUp(KeyCode.Q)) { Cursor.lockState = CursorLockMode.None; GlobalControl.Quit(); } // run per-frame actions Action execActions = nextFrameActions.GetRunnable(); nextFrameActions.Clear(); execActions(); // can either use spacecontrols or mouse, but not both at same time // [TODO] ask spatial input controller instead, it knows better (?) if (FPlatform.IsUsingVR() && SpatialController.CheckForSpatialInputActive()) { Configure_SpaceControllers(); HandleInput_SpaceControllers(); } else if (FPlatform.IsTouchDevice()) { Configure_TouchInput(); HandleInput_Touch(); } else { Configure_MouseOrGamepad(); HandleInput_MouseOrGamepad(); } // after we have handled input, do per-frame rendering computations if (options.EnableCockpit) { ActiveCockpit.PreRender(); } ToolManager.PreRender(); Scene.PreRender(); }
/// <summary> /// Return a world-space width that corresponds to the given visual angle at the given distance. /// Automatically switches between VR and 2D calculations as appropriate. /// </summary> public static float GetRadiusForVisualAngle(Vector3f vWorldPos, Vector3f vEyePos, float fAngleInDegrees) { if (FPlatform.IsUsingVR()) { return(GetVRRadiusForVisualAngle(vWorldPos, vEyePos, fAngleInDegrees)); } else { return(Get2DRadiusForVisualAngle(vWorldPos, vEyePos, fAngleInDegrees)); } }
public BaseSurfacePointTool(FScene scene) { this.Scene = scene; // do this here ?? behaviors = new InputBehaviorSet(); behaviors.Add( new BaseSurfacePointTool_2DBehavior(scene.Context, ObjectFilter) { Priority = 5 }); if (FPlatform.IsUsingVR()) { behaviors.Add( new BaseSurfacePointTool_SpatialBehavior(scene.Context, ObjectFilter) { Priority = 5 }); } // shut off transform gizmo Scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); }
// Use this for initialization public void Start(SceneOptions options) { this.options = options; DebugUtil.LogLevel = options.LogLevel; FPlatform.InitializeMainThreadID(); // initialize VR platform if VR is active if (gs.VRPlatform.VREnabled) { if (options.Use2DCockpit) { throw new Exception("FContext.Start: cannot use 2D Orthographic Cockpit with VR!"); } if (options.SpatialCameraRig != null) { gs.VRPlatform.Initialize(options.SpatialCameraRig); } } InputExtension.Get.Start(); nextFrameActions = new ActionSet(); // intialize camera stuff camTracker = new CameraTracking(); camTracker.Initialize(this); GetScene(); if (options.SceneInitializer != null) { options.SceneInitializer.Initialize(GetScene()); } if (options.DefaultGizmoBuilder != null) { transformManager = new TransformManager(options.DefaultGizmoBuilder); } else { transformManager = new TransformManager(new AxisTransformGizmoBuilder()); } if (options.EnableTransforms) { transformManager.Initialize(this); } toolManager = new ToolManager(); toolManager.Initialize(this); toolManager.OnToolActivationChanged += OnToolActivationChanged; MouseController.Start(); SpatialController.Start(); // [RMS] hardcode starting cam target point to origin ActiveCamera.SetTarget(Vector3f.Zero); if (options.MouseCameraControls != null) { MouseCameraController = options.MouseCameraControls; } // apply initial transformation to scene ActiveCamera.Manipulator().SceneTranslate(Scene, SceneGraphConfig.InitialSceneTranslate, true); // create behavior sets inputBehaviors = new InputBehaviorSet(); overrideBehaviors = new InputBehaviorSet(); // cockpit needs to go last because UI setup may depend on above cockpitStack = new Stack <Cockpit>(); if (options.EnableCockpit) { PushCockpit(options.CockpitInitializer); } captureMouse = null; captureTouch = null; captureLeft = captureRight = null; bInCameraControl = false; // [RMS] this locks cursor to game unless user presses escape or exits if (FPlatform.IsUsingVR() || options.UseSystemMouseCursor == false) { Cursor.lockState = CursorLockMode.Locked; } // set hacky hackenstein global ActiveContext_HACK = this; startup_checks(); }