示例#1
0
        public void EditorThread_CreateScene(IRenderSurface renderSurface, EInputClass cameraInputClass)
        {
            IsCreated = true;
            OnEngineThread(() =>
            {
                Input.RegisterListener(EngineThread_OnInputEvent, cameraInputClass);
                // Create a new renderer scene with our viewport
                SSceneViewInfo viewInfo       = new SSceneViewInfo();
                viewInfo.Fov                  = FieldOfView;
                viewInfo.ScreenFar            = ScreenFar;
                viewInfo.ScreenNear           = ScreenNear;
                viewInfo.FitProjectionToScene = true;
                viewInfo.ViewMatrix           = Matrix.Invert(m_cameraTransform.WorldMatrix);
                viewInfo.ViewLocation         = m_cameraTransform.Position;
                viewInfo.CreateBoundingFrustum();

                m_renderScene = CRenderer.Instance.CreateRenderScene(renderSurface);
                if (m_renderScene != null)
                {
                    m_renderScene.OnDoFrame += EngineThread_Update;
                    m_renderScene.UpdateViewInfo(in viewInfo);
                    m_ambientLight                    = new CAmbientLight();
                    m_ambientLight.LightColor         = Vector4.One * 0.2f;
                    m_directionalLight                = new CDirectionalLight();
                    m_directionalLight.LightDirection = new Vector3(0.3f, -0.7f, 0.0f);
                    m_directionalLight.LightColor     = Vector4.One * 0.8f;
                    m_renderScene.LightManager.AddLight(m_ambientLight);
                    m_renderScene.LightManager.AddLight(m_directionalLight);
                }
            });
        }
示例#2
0
 public static void UnregisterListener(ProcessInputEvents callback, EInputClass inputClass = EInputClass.Default)
 {
     lock (m_listenerMutex)
     {
         if (m_bIsIterating)
         {
             m_iterationRemovals.Add(new SInputListenerAction(inputClass, callback));
         }
         else
         {
             m_inputListeners[(int)inputClass].callbacks.Remove(callback);
         }
     }
 }
示例#3
0
 public SInputListenerAction(EInputClass inputClass, ProcessInputEvents callback)
 {
     this.inputClass = inputClass;
     this.callback   = callback;
 }
示例#4
0
 public static bool IsInputClassActive(EInputClass inputClass)
 {
     return(m_inputListeners[(int)inputClass].bIsActive);
 }
示例#5
0
 public static void SetInputClassActive(EInputClass inputClass, bool bIsActive)
 {
     m_inputListeners[(int)inputClass].bIsActive = bIsActive;
 }