private static VideoConfig TryLoadRegistry() { RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Yias\\SharpWoW\\Video"); if (key == null) { return(null); } VideoConfig ret = new VideoConfig(); ret.loadFromRegistry(key); return(ret); }
private static VideoConfig LoadDefault() { VideoConfig ret = new VideoConfig() { Multisampling = MultisampleType.None, MultisampleQuality = 0, Filtering = TextureFilterMode.Bilinear, Anisotropy = 0, Adapter = Game.GameManager.GraphicsThread.GraphicsManager.Direct3D.GetAdapterIdentifier(0), DepthStencilFormat = Format.D16 }; return(ret); }
public static VideoConfig Load(bool useRegistry, bool useDialog) { if (useRegistry == false && useDialog == false) { return(LoadDefault()); } if (useDialog == false) { return(TryLoadRegistry()); } if (useRegistry != false) { try { VideoConfig cfg = TryLoadRegistry(); if (cfg != null) { return(cfg); } } catch (Exception) { } } UI.Dialogs.DeviceDialog dvd = new UI.Dialogs.DeviceDialog(); dvd.ShowDialog(); var ret = new VideoConfig() { MultisampleQuality = (uint)dvd.MultisampleQuality, Multisampling = dvd.Multisampling, Filtering = dvd.FilterMode, Anisotropy = dvd.Anisotropy, Adapter = dvd.SelectedAdapter.Details, DepthStencilFormat = dvd.DepthStencil }; return(ret); }
public void CreateDevice(bool useRegistry, bool showDialog = true) { Direct3D = new SlimDX.Direct3D9.Direct3D(); VideoConfig cfg = VideoConfig.Load(useRegistry, showDialog); CurrentConfig = cfg; mPresentParams = new PresentParameters() { AutoDepthStencilFormat = cfg.DepthStencilFormat, EnableAutoDepthStencil = true, BackBufferFormat = Format.A8R8G8B8, BackBufferHeight = mRenderWindow.ClientSize.Height, BackBufferWidth = mRenderWindow.ClientSize.Width, DeviceWindowHandle = mRenderWindow.Handle, Windowed = true, Multisample = cfg.Multisampling, MultisampleQuality = (int)cfg.MultisampleQuality }; Device = new Device(Direct3D, cfg.Adapter.Adapter, DeviceType.Hardware, mRenderWindow.Handle, CreateFlags.HardwareVertexProcessing, mPresentParams ); VideoResourceMgr = new VideoResourceManager(); mActiveCamera = new PerspectiveCamera(); Device.SetTransform(TransformState.World, Matrix.Identity); Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear); Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear); Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear); if (DeviceLoaded != null) { DeviceLoaded(); } }
public static VideoConfig Load(bool useRegistry, bool useDialog) { if (useRegistry == false && useDialog == false) return LoadDefault(); if (useDialog == false) return TryLoadRegistry(); if (useRegistry != false) { try { VideoConfig cfg = TryLoadRegistry(); if (cfg != null) return cfg; } catch (Exception) { } } UI.Dialogs.DeviceDialog dvd = new UI.Dialogs.DeviceDialog(); dvd.ShowDialog(); var ret = new VideoConfig() { MultisampleQuality = (uint)dvd.MultisampleQuality, Multisampling = dvd.Multisampling, Filtering = dvd.FilterMode, Anisotropy = dvd.Anisotropy, Adapter = dvd.SelectedAdapter.Details, DepthStencilFormat = dvd.DepthStencil }; return ret; }
private static VideoConfig TryLoadRegistry() { RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Yias\\SharpWoW\\Video"); if (key == null) return null; VideoConfig ret = new VideoConfig(); ret.loadFromRegistry(key); return ret; }
private static VideoConfig LoadDefault() { VideoConfig ret = new VideoConfig() { Multisampling = MultisampleType.None, MultisampleQuality = 0, Filtering = TextureFilterMode.Bilinear, Anisotropy = 0, Adapter = Game.GameManager.GraphicsThread.GraphicsManager.Direct3D.GetAdapterIdentifier(0), DepthStencilFormat = Format.D16 }; return ret; }