Example #1
0
        // in egocentric camera system the "eye" is moving up/down, which means the scene moves in opposite direction
        public void SceneRateControlledEgogentricPan(FScene scene, fCamera cam, Vector2f curPos, RateControlInfo rc)
        {
            float dt = (FPlatform.RealTime() - rc.lastTime);

            rc.lastTime = FPlatform.RealTime();

            float delta_y = (curPos.y - rc.startPos.y);

            rc.curSpeedY =
                rc_update_speed(delta_y, rc.rampUpRadius, rc.deadZoneRadius, rc.maxAccel, rc.maxSpeed, dt, rc.curSpeedY);
            float delta_x = (curPos.x - rc.startPos.x);

            rc.curSpeedX =
                rc_update_speed(delta_x, rc.rampUpRadius, rc.deadZoneRadius, rc.maxAccel, rc.maxSpeed, dt, rc.curSpeedX);


            Frame3f  camFrame = cam.GetWorldFrame();
            Vector3f forward  = camFrame.Z;
            Vector3f up       = camFrame.Y;

            if (rc.StayLevel)
            {
                forward = new Vector3(forward.x, 0.0f, forward.z);
                forward.Normalize();
                up = Vector3.up;
            }
            Vector3f right       = Vector3.Cross(up, forward);
            Vector3f curScenePos = scene.RootGameObject.GetPosition();
            Vector3f newScenePos = curScenePos - dt * (rc.curSpeedY * up + rc.curSpeedX * right);

            scene.RootGameObject.SetPosition(newScenePos);
        }
Example #2
0
        static public GameObject EmitDebugLine(string name, Vector3f start, Vector3f end, float diameter, Colorf startColor, Colorf endColor,
                                               GameObject parent = null, bool bIsInWorldPos = true)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugLine(name, start, end, diameter, startColor, endColor, parent, bIsInWorldPos); });
                return(null);
            }

            GameObject line = new GameObject();

            line.SetName(name);
            line.transform.position = (bIsInWorldPos) ? start : Vector3f.Zero;
            line.AddComponent <LineRenderer>();
            LineRenderer lr = line.GetComponent <LineRenderer>();

            lr.material   = MaterialUtil.CreateParticlesMaterial();
            lr.startColor = startColor;
            lr.endColor   = endColor;
            lr.startWidth = lr.endWidth = diameter;
            lr.SetPosition(0, start);
            lr.SetPosition(1, end);

            if (parent != null)
            {
                lr.useWorldSpace = bIsInWorldPos;
                line.transform.SetParent(parent.transform, bIsInWorldPos);
            }

            return(line);
        }
Example #3
0
        // in egocentric camera system the "eye" is moving up/down, which means the scene moves in opposite direction
        public void SceneRateControlledEgogentricPan(FScene scene, Camera cam, Vector2 curPos, RateControlInfo rc)
        {
            float dt = (FPlatform.RealTime() - rc.lastTime);

            rc.lastTime = FPlatform.RealTime();

            float delta_y = (curPos.y - rc.startPos.y);

            rc.curSpeedY =
                rc_update_speed(delta_y, rc.rampUpRadius, rc.deadZoneRadius, rc.maxAccel, rc.maxSpeed, dt, rc.curSpeedY);
            float delta_x = (curPos.x - rc.startPos.x);

            rc.curSpeedX =
                rc_update_speed(delta_x, rc.rampUpRadius, rc.deadZoneRadius, rc.maxAccel, rc.maxSpeed, dt, rc.curSpeedX);


            Vector3 forward, up;

            if (rc.StayLevel)
            {
                forward = new Vector3(cam.transform.forward.x, 0.0f, cam.transform.forward.z);
                forward.Normalize();
                up = Vector3.up;
            }
            else
            {
                forward = cam.gameObject.transform.forward;
                up      = cam.gameObject.transform.up;
            }
            Vector3 right       = Vector3.Cross(up, forward);
            Vector3 curScenePos = scene.RootGameObject.transform.position;
            Vector3 newScenePos = curScenePos - dt * (rc.curSpeedY * up + rc.curSpeedX * right);

            scene.RootGameObject.transform.position = newScenePos;
        }
Example #4
0
        public float GetPixelScale()
        {
            AxisAlignedBox2f uiBounds    = GetOrthoViewBounds();
            AxisAlignedBox2f pixelBounds = GetPixelViewBounds();
            float            fScale      = uiBounds.MaxDim / pixelBounds.MaxDim;

#if UNITY_STANDALONE_OSX
            if (UnityEngine.Screen.dpi > 100.0f && FPlatform.InUnityEditor() == false)
            {
                fScale /= 2.0f;
            }
#endif
#if UNITY_IOS || UNITY_ANDROID
            if (FPlatform.GetDeviceType() != FPlatform.fDeviceType.IPad)
            {
                fScale *= 0.8f;
            }
#endif
            if (FPlatform.InUnityEditor())
            {
                fScale *= FPlatform.EditorUIScaleFactor;
            }
            else
            {
                fScale *= FPlatform.UIScaleFactor;
            }
            return(fScale);
        }
Example #5
0
        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);
        }
Example #6
0
        // called by FContext.PushCockpit()
        public void Start(ICockpitInitializer setup)
        {
            // create invisible plane for cockpit
            gameobject = GameObjectFactory.CreateParentGO("cockpit");

            onCameraGO = GameObjectFactory.CreateParentGO("cockpit_camera");
            gameobject.AddChild(onCameraGO, false);

            // add hud animation controller
            gameobject.AddComponent <UnityPerFrameAnimationBehavior>().Animator = HUDAnimator;

            // create HUD
            try {
                setup.Initialize(this);
            } catch (Exception e) {
                // if hud setup fails we still want to keep going
                DebugUtil.Log(2, "[Cockpit.Start] exception in initializer: {0}\nTrace:\n{1}", e.Message, e.StackTrace);
                if (FPlatform.InUnityEditor())
                {
                    throw;
                }
            }

            // position in front of camera
            UpdateTracking(true);
        }
Example #7
0
 override public bool EndCapture(InputEvent e)
 {
     if (FindHitGO(e.ray))
     {
         if (sent_click == false)
         {
             // on first click we reset timer
             on_clicked();
             sent_click      = true;
             last_click_time = FPlatform.RealTime();
         }
         else
         {
             float delta = FPlatform.RealTime() - last_click_time;
             if (delta < double_click_delay)
             {
                 // if this second click comes fast enough, send doubleclick instead
                 on_double_clicked();
                 sent_click      = false;
                 last_click_time = 0.0f;
             }
             else
             {
                 // send single-click and reset timer
                 on_clicked();
                 sent_click      = true;
                 last_click_time = FPlatform.RealTime();
             }
         }
     }
     return(true);
 }
Example #8
0
        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);
        }
Example #9
0
 override public bool EndCapture(InputEvent e)
 {
     if (FindHitGO(e.ray))
     {
         if (sent_click == false)
         {
             // on first click we reset timer
             FUtil.SafeSendEvent(OnClicked, this, e);
             sent_click      = true;
             last_click_time = FPlatform.RealTime();
         }
         else
         {
             float delta = FPlatform.RealTime() - last_click_time;
             if (delta < SceneGraphConfig.ActiveDoubleClickDelay)
             {
                 // if this second click comes fast enough, send doubleclick instead
                 FUtil.SafeSendEvent(OnDoubleClicked, this, e);
                 sent_click      = false;
                 last_click_time = 0.0f;
             }
             else
             {
                 // send single-click and reset timer
                 FUtil.SafeSendEvent(OnClicked, this, e);
                 sent_click      = true;
                 last_click_time = FPlatform.RealTime();
             }
         }
     }
     return(true);
 }
Example #10
0
        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");
        }
Example #11
0
        static public GameObject EmitDebugAABB(string name, Vector3 center, Vector3f dims, Color color, GameObject inCoords = null)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugAABB(name, center, dims, color, inCoords); });
                return(null);
            }

            if (inCoords != null)
            {
                Transform curt = inCoords.transform;
                while (curt != null)
                {
                    center = curt.TransformPoint(center);
                    curt   = curt.parent;
                }
            }
            GameObject box = GameObject.CreatePrimitive(PrimitiveType.Cube);

            box.SetName(name);
            box.transform.position   = center;
            box.transform.localScale = dims;
            box.GetComponent <MeshRenderer> ().material.color = color;
            return(box);
        }
Example #12
0
        // 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();
        }
Example #13
0
 public void Clear()
 {
     for (int i = 0; i < vHistory.Count; ++i)
     {
         vHistory[i].Cull();
     }
     vHistory = new List <IChangeOp>();
     iCurrent = 0;
     FPlatform.SuggestGarbageCollection();
 }
Example #14
0
 /// <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));
     }
 }
Example #15
0
 public RateControlInfo(Vector2f startPos)
 {
     lastTime       = FPlatform.RealTime();
     maxSpeed       = 5.0f;
     maxAccel       = 10.5f;
     angleMultipler = 4.0f;
     curSpeedX      = curSpeedY = 0.0f;
     rampUpRadius   = 10.0f;
     deadZoneRadius = 1.0f;
     StayLevel      = true;
     this.startPos  = startPos;
 }
Example #16
0
 public SceneOptions()
 {
     EnableDefaultLighting = true;
     EnableCockpit         = true;
     EnableTransforms      = true;
     CockpitInitializer    = null;
     SceneInitializer      = null;
     MouseCameraControls   = null;
     UseSystemMouseCursor  = false;
     Use2DCockpit          = false;
     ConstantSize2DCockpit = false;
     // default logging level is to be verbose in editor
     LogLevel = FPlatform.InUnityEditor() ? 1 : 0;
 }
Example #17
0
        public bool HandleShortcuts()
        {
            if (Input.GetKeyUp(KeyCode.Escape))
            {
                controller.PopCockpit(true);
                return(true);
            }
            else if (Input.GetKeyUp(KeyCode.Return))
            {
                if (OnReturn != null)
                {
                    OnReturn();
                }
                return(true);
            }
            else if (Input.GetKeyDown(KeyCode.Backspace))
            {
                deleteTime = FPlatform.RealTime() + 0.5f;
                if (entryField.Text.Length > 0)
                {
                    entryField.Text = entryField.Text.Substring(0, entryField.Text.Length - 1);
                }
                return(true);
            }
            else if (Input.GetKey(KeyCode.Backspace))
            {
                if (entryField.Text.Length > 0 && FPlatform.RealTime() - deleteTime > 0.05f)
                {
                    entryField.Text = entryField.Text.Substring(0, entryField.Text.Length - 1);
                    deleteTime      = FPlatform.RealTime();
                }
                return(true);
            }
            else if (Input.GetKeyDown(KeyCode.V) && Input.GetKey(KeyCode.LeftControl))
            {
                //entryField.Text = "https://www.dropbox.com/s/momif47x1erb2fp/test_bunny.obj?raw=1";
                return(true);
            }
            else if (Input.anyKeyDown)
            {
                if (Input.inputString.Length > 0 && FileSystemUtils.IsValidFilenameString(Input.inputString))
                {
                    entryField.Text += Input.inputString;
                    return(true);
                }
            }

            return(false);
        }
        public bool HandleShortcuts()
        {
            if (Input.GetKeyUp(KeyCode.Q))
            {
                FPlatform.QuitApplication();
                return(true);
            }
            else if (Input.GetKeyUp("escape"))
            {
                FPlatform.QuitApplication();
                return(true);
            }

            return(false);
        }
Example #19
0
        public override void PreRender()
        {
            if (IsEditing)
            {
                // cursor blinks every 0.5s
                float dt = FPlatform.RealTime() - start_active_time;
                cursor.SetVisible((int)(2 * dt) % 2 == 0);

                // DO NOT DO THIS EVERY FRAME!!!
                BoxModel.MoveTo(cursor, this.Bounds2D.CenterLeft, -Height * 0.1f);
                Vector2f cursorPos = textMesh.TextObject.GetCursorPosition(cursor_position);
                BoxModel.Translate(cursor, cursorPos);
            }
            else
            {
                cursor.SetVisible(false);
            }
        }
Example #20
0
        static public fGameObject EmitDebugMesh(string name, DMesh3 meshIn, Colorf color, GameObject parent = null, bool bIsInWorldPos = true)
        {
            DMesh3 mesh = new DMesh3(meshIn);

            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugMesh(name, mesh, color, parent, bIsInWorldPos); });
                return(null);
            }
            fMeshGameObject fMeshGO = GameObjectFactory.CreateMeshGO(name, new fMesh(mesh), false, true);

            fMeshGO.SetMaterial(MaterialUtil.CreateStandardMaterialF(color));
            if (parent != null)
            {
                parent.AddChild(fMeshGO, bIsInWorldPos);
            }
            return(fMeshGO);
        }
Example #21
0
        /// <summary>
        /// Returns dpi-independent pixel scaling factor. Mainly intended to be used
        /// for sizing UI elements.
        /// This function multiplies by FPlatform.PixelScaleFactor.
        /// </summary>
        public float GetPixelScale(bool bDpiIndependent = true)
        {
            AxisAlignedBox2f uiBounds    = GetOrthoViewBounds();
            AxisAlignedBox2f pixelBounds =
                (bDpiIndependent) ? GetPixelViewBounds_DpiIndependent() : GetPixelViewBounds_Absolute();
            float fScale = uiBounds.Height / pixelBounds.Height;

            // use ValidScreenDimensionRange to manipulate scale here?

            if (FPlatform.InUnityEditor())
            {
                fScale *= FPlatform.EditorPixelScaleFactor;
            }
            else
            {
                fScale *= FPlatform.PixelScaleFactor;
            }
            return(fScale);
        }
Example #22
0
        static public void EmitDebugFrame(string name, Frame3f f, float fAxisLength, float diameter = 0.05f)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugFrame(name, f, fAxisLength, diameter); });
                return;
            }

            GameObject frame = new GameObject(name);
            GameObject x     = EmitDebugLine(name + "_x", f.Origin, f.Origin + fAxisLength * f.X, diameter, Color.red);

            x.transform.parent = frame.transform;
            GameObject y = EmitDebugLine(name + "_y", f.Origin, f.Origin + fAxisLength * f.Y, diameter, Color.green);

            y.transform.parent = frame.transform;
            GameObject z = EmitDebugLine(name + "_z", f.Origin, f.Origin + fAxisLength * f.Z, diameter, Color.blue);

            z.transform.parent = frame.transform;
        }
Example #23
0
        static public GameObject EmitDebugFrame(string name, Frame3f f, float fAxisLength, float diameter = 0.05f, GameObject parent = null)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugFrame(name, f, fAxisLength, diameter); });
                return(null);
            }

            GameObject frameObj = new GameObject(name);

            /*GameObject x = */ EmitDebugLine(name + "_x", f.Origin, f.Origin + fAxisLength * f.X, diameter, Color.red, frameObj, false);
            /*GameObject y = */ EmitDebugLine(name + "_y", f.Origin, f.Origin + fAxisLength * f.Y, diameter, Color.green, frameObj, false);
            /*GameObject z = */ EmitDebugLine(name + "_z", f.Origin, f.Origin + fAxisLength * f.Z, diameter, Color.blue, frameObj, false);
            if (parent != null)
            {
                frameObj.transform.SetParent(parent.transform, false);
            }
            return(frameObj);
        }
        public override Capture UpdateCapture(InputState input, CaptureData data)
        {
            //CaptureControl.doSurroundCapture = false;
#if false
            if (input.bLeftMenuButtonPressed)
            {
                press_time = FPlatform.RealTime();
                if (input.bLeftShoulderDown)
                {
                    CaptureControl.EnableSurroundCapture = true;
                }
                else
                {
                    CaptureControl.EnableSurroundCapture = false;
                }
            }
            else if (input.bLeftMenuButtonReleased)
            {
                if (in_video_capture)
                {
                    CaptureControl.EndVideoCapture();
                    string s = string.Format("Captured {0} video!", CaptureControl.EnableSurroundCapture ? "360" : "WideAngle");
                    HUDUtil.ShowToastPopupMessage(s, FContext.ActiveContext_HACK.ActiveCockpit);
                    in_video_capture = false;
                    press_time       = 0;
                }
                else if (FPlatform.RealTime() - press_time > 1.0f)
                {
                    CaptureControl.BeginVideoCapture();
                    in_video_capture = true;
                }
                else
                {
                    CaptureControl.CaptureScreen();
                    string s = string.Format("Captured {0} screenshot!", CaptureControl.EnableSurroundCapture ? "360" : "WideAngle");
                    HUDUtil.ShowToastPopupMessage(s, FContext.ActiveContext_HACK.ActiveCockpit);
                }
            }
#endif
            return(Capture.Ignore);
        }
Example #25
0
        void begin_editing()
        {
            // start capturing input
            if (OverrideDefaultInputHandling == false)
            {
                HUDTextEntryTarget entry = new HUDTextEntryTarget(this);
                if (Parent.Context.RequestTextEntry(entry))
                {
                    active_entry = entry;
                    FUtil.SafeSendEvent(OnBeginTextEditing, this);
                    bgMesh.SetMaterial(activeBackgroundMaterial);
                    start_active_time = FPlatform.RealTime();
                    cursor_position   = text.Length;

                    entry.OnTextEditingEnded += (s, e) => {
                        bgMesh.SetMaterial(backgroundMaterial);
                        active_entry = null;
                        FUtil.SafeSendEvent(OnEndTextEditing, this);
                    };
                }
            }
        }
Example #26
0
        static public GameObject EmitDebugSphere(string name, Vector3 position, float diameter, Color color, GameObject parent = null, bool bIsInWorldPos = true)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugSphere(name, position, diameter, color, parent, bIsInWorldPos); });
                return(null);
            }

            GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);

            sphere.SetName(name);
            sphere.transform.position   = position;
            sphere.transform.localScale = new Vector3(diameter, diameter, diameter);
            sphere.GetComponent <MeshRenderer> ().material.color = color;

            if (parent != null)
            {
                sphere.transform.SetParent(parent.transform, bIsInWorldPos);
            }

            return(sphere);
        }
Example #27
0
        public virtual void Update()
        {
            if (deregister == true)
            {
                return;
            }

            float dt = FPlatform.RealTime() - start_time;

            if (dt >= Duration)
            {
                dt         = Duration;
                deregister = true;
            }

            tweenF(dt / Duration);

            if (deregister && OnCompletedF != null)
            {
                OnCompletedF();
            }
        }
Example #28
0
        override public bool EndCapture(InputEvent e)
        {
            if (Parent == null)
            {
                DebugUtil.Log(2, "HUDLabel.EndCapture: our parent went invalid while we were capturing!");
                return(true);
            }

            if (FindHitGO(e.ray))
            {
                if (sent_click == false)
                {
                    // on first click we reset timer
                    FUtil.SafeSendEvent(OnClicked, this, new EventArgs());
                    sent_click      = true;
                    last_click_time = FPlatform.RealTime();
                }
                else
                {
                    float delta = FPlatform.RealTime() - last_click_time;
                    if (delta < double_click_delay)
                    {
                        // if this second click comes fast enough, send doubleclick instead
                        FUtil.SafeSendEvent(OnDoubleClicked, this, new EventArgs());
                        sent_click      = false;
                        last_click_time = 0.0f;
                    }
                    else
                    {
                        // send single-click and reset timer
                        FUtil.SafeSendEvent(OnClicked, this, new EventArgs());
                        sent_click      = true;
                        last_click_time = FPlatform.RealTime();
                    }
                }
            }
            return(true);
        }
Example #29
0
        static public fGameObject EmitDebugBox(string name, Box3d box, Colorf color, GameObject parent = null, bool bIsInWorldPos = true)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugBox(name, box, color, parent, bIsInWorldPos); });
                return(null);
            }
            TrivialBox3Generator boxgen = new TrivialBox3Generator()
            {
                Box = box, NoSharedVertices = true, Clockwise = true
            };

            boxgen.Generate();
            DMesh3          mesh    = boxgen.MakeDMesh();
            fMeshGameObject fMeshGO = GameObjectFactory.CreateMeshGO(name, new fMesh(mesh), false, true);

            fMeshGO.SetMaterial(MaterialUtil.CreateStandardMaterialF(color));
            if (parent != null)
            {
                parent.AddChild(fMeshGO, bIsInWorldPos);
            }
            return(fMeshGO);
        }
Example #30
0
        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);
        }