protected override void OnInitialization(Graphics3DConfiguration config) { if (GraphicsDirect3D9.Device != null) throw new Graphics3DStateException("Cannot do device initialization: Device already initialized!"); GraphicsDirect3D9.Device = new Device(new Direct3D(), 0, DeviceType.Hardware, config.Target, CreateFlags.HardwareVertexProcessing, Direct3DConverter9.ConvertToPresentParameters(config)); }
protected override void OnInitialization(Graphics3DConfiguration config) { if (GraphicsDirect3D9.Device != null) { throw new Graphics3DStateException("Cannot do device initialization: Device already initialized!"); } GraphicsDirect3D9.Device = new Device(new Direct3D(), 0, DeviceType.Hardware, config.Target, CreateFlags.HardwareVertexProcessing, Direct3DConverter9.ConvertToPresentParameters(config)); }
/// <summary> /// Initialize a graphics 3d system from a plugin. <b>Do not call initialize on the returned Graphics3DDevice! Already called by this method!</b> /// </summary> /// <param name="config">Configuration for Graphics 3D Engine</param> /// <param name="systemName">Name of the low layer system (e. g. Direct3D9, ...)</param> /// <returns>A Graphics3DDevice object. Represent an instance of the graphics 3d engine</returns> /// <exception cref="Graphics3DSystemNotFoundException">Is thrown if no system with the given system name was found</exception> public static Graphics3DDevice InitializeSystem(Graphics3DConfiguration config, String systemName) { if (!layerList.ContainsKey(systemName)) throw new Graphics3DSystemNotFoundException("Cannot find system: " + systemName); Configuration = config; Implementors = layerList[systemName].LayerImplementor; Graphics3DDevice device = layerList[systemName].Device; device.Initialize(config); CurrentDeviceType = systemName; return device; }
/// <summary> /// Initialize a graphics 3d system from a plugin. <b>Do not call initialize on the returned Graphics3DDevice! Already called by this method!</b> /// </summary> /// <param name="config">Configuration for Graphics 3D Engine</param> /// <param name="systemName">Name of the low layer system (e. g. Direct3D9, ...)</param> /// <returns>A Graphics3DDevice object. Represent an instance of the graphics 3d engine</returns> /// <exception cref="Graphics3DSystemNotFoundException">Is thrown if no system with the given system name was found</exception> public static Graphics3DDevice InitializeSystem(Graphics3DConfiguration config, String systemName) { if (!layerList.ContainsKey(systemName)) { throw new Graphics3DSystemNotFoundException("Cannot find system: " + systemName); } Configuration = config; Implementors = layerList[systemName].LayerImplementor; Graphics3DDevice device = layerList[systemName].Device; device.Initialize(config); CurrentDeviceType = systemName; return(device); }
public static PresentParameters ConvertToPresentParameters(Graphics3DConfiguration configuration) { PresentParameters pp = new PresentParameters(); pp.BackBufferCount = 1; //TODO pp.BackBufferFormat = ConvertToFormat(configuration.ScreenConfiguration.ColorMode); pp.BackBufferHeight = configuration.ScreenConfiguration.Height; pp.BackBufferWidth = configuration.ScreenConfiguration.Width; pp.EnableAutoDepthStencil = true; pp.FullScreenRefreshRateInHertz = 0; //TODO pp.Multisample = MultisampleType.None; //TODO pp.MultisampleQuality = 0; pp.PresentationInterval = PresentInterval.One; //TODO pp.SwapEffect = SwapEffect.Discard; pp.Windowed = !configuration.ScreenConfiguration.FullScreen; pp.DeviceWindowHandle = configuration.Target; pp.AutoDepthStencilFormat = Format.D24S8; return pp; }
static void Main() { Form win = new Form(); win.KeyDown += ((sender, e) => { win.Close(); }); win.Width = G3D_WIDTH; win.Height = G3D_HEIGHT; win.StartPosition = FormStartPosition.CenterScreen; win.Text = "Graphics 3D - Demo"; Graphics3DConfiguration config = new Graphics3DConfiguration(); config.Target = win.Handle; config.ScreenConfiguration.ColorMode = ColorMode.Bit32; config.ScreenConfiguration.FullScreen = true; config.ScreenConfiguration.Height = G3D_HEIGHT; config.ScreenConfiguration.Width = G3D_WIDTH; Graphics3DApplication.Initialize += new Action<Graphics3DDevice>(Graphics3DApplication_Initialize); Graphics3DApplication.Dispose += new Action<Graphics3DDevice>(Graphics3DApplication_Dispose); Graphics3DApplication.Run(win, Graphics3DSystem.InitializeSystem(config, "Direct3D9")); }
public static PresentParameters ConvertToPresentParameters(Graphics3DConfiguration configuration) { PresentParameters pp = new PresentParameters(); pp.BackBufferCount = 1; //TODO pp.BackBufferFormat = ConvertToFormat(configuration.ScreenConfiguration.ColorMode); pp.BackBufferHeight = configuration.ScreenConfiguration.Height; pp.BackBufferWidth = configuration.ScreenConfiguration.Width; pp.EnableAutoDepthStencil = true; pp.FullScreenRefreshRateInHertz = 0; //TODO pp.Multisample = MultisampleType.None; //TODO pp.MultisampleQuality = 0; pp.PresentationInterval = PresentInterval.One; //TODO pp.SwapEffect = SwapEffect.Discard; pp.Windowed = !configuration.ScreenConfiguration.FullScreen; pp.DeviceWindowHandle = configuration.Target; pp.AutoDepthStencilFormat = Format.D24S8; return(pp); }
public static void Run(Graphics3DConfiguration config, String systemName) { Run(new Form(), config, systemName); }
public static void Run(Form form, Graphics3DConfiguration config, String systemName) { Run(form, Graphics3DSystem.InitializeSystem(config, systemName)); }
protected abstract void OnInitialization(Graphics3DConfiguration config);
internal void Initialize(Graphics3DConfiguration config) { OnInitialization(config); Graphics3DSystem.Implementors.MaterialImplementor.SetMaterial( MaterialCreator.CreateDefaultMaterial().Create()); }