コード例 #1
0
        ///// <summary>
        ///// Retrieves an appropriate multi sample format from the manager.
        ///// </summary>
        //private static MultiSampleType GetMultiSampleType(int adapter)
        //{
        //  if (Manager.CheckDeviceMultiSampleType(adapter, DeviceType, Format.X8R8G8B8, !FullScreen, MultiSampleType.FourSamples))
        //    return MultiSampleType.FourSamples;
        //  else if (Manager.CheckDeviceMultiSampleType(adapter, DeviceType, Format.X8R8G8B8, !FullScreen, MultiSampleType.TwoSamples))
        //    return MultiSampleType.TwoSamples;
        //  else if (Manager.CheckDeviceMultiSampleType(adapter, DeviceType, Format.X8R8G8B8, !FullScreen, MultiSampleType.NonMaskable))
        //    return MultiSampleType.NonMaskable;
        //  else
        //    return MultiSampleType.None;
        //}

        public static void PerformDeviceReset(int sizeX, int sizeY)
        {
            int res;

            MdxRender.Device.CheckCooperativeLevel(out res);

            //clean up unmanaged resources
            fontFPS.OnLostDevice();
            DebugFont.OnLostDevice();
            tagPool.OnLostDevice();
            console.OnLostDevice();
            SelectTool.OnLostDevice();
            Billboard.OnLostDevice();
            foreach (SceneState scene in scenes)
            {
                scene.Instance.OnDeviceLost();
            }

            //reset the device with new viewport dimensions
            pp.BackBufferWidth  = sizeX;
            pp.BackBufferHeight = sizeY;
            //MdxRender.Device.Reset(pp);

            //re-create unmanaged resources
            fontFPS.OnResetDevice();
            DebugFont.OnResetDevice();
            tagPool.OnResetDevice();
            console.OnResetDevice();
            SelectTool.OnResetDevice();
            Billboard.OnResetDevice();
            foreach (SceneState scene in scenes)
            {
                scene.Instance.OnDeviceReset();
            }

            //re-init any state variables we need
            SetupDevice();
            UpdateViewTransform();
            MdxRender.Device.Transform.World = Matrix.Identity;
            MdxRender.Device.Transform.View  = camera.GetViewMatrix();
        }
コード例 #2
0
 public void SetupCamera()
 {
     MdxRender.Device.Transform.View = camera.GetViewMatrix();
     camera.CalculateViewFrustum();
 }