protected override void CreateWindow() { Root.Initialize( false, "Axiom Sample Browser" ); var miscParams = new NamedParameterList(); var width = 800; var height = 600; miscParams.Add( "externalWindowInfo", this.GlWindowInfo ); miscParams.Add( "externalGLContext", GLGraphicsContext ); this.RenderWindow = Root.CreateRenderWindow( "AndroidMainWindow", width, height, true, miscParams ); }
public bool Setup( IGraphicsContext glContext, int width, int height ) { // instantiate the Root singleton engine = Root.Instance; // add event handlers for frame events engine.FrameStarted += OnFrameStarted; engine.FrameRenderingQueued += OnFrameRenderingQueued; engine.FrameEnded += OnFrameEnded; Root.Instance.Initialize( false, "Axiom Engine Demo Window" ); NamedParameterList miscParams = new NamedParameterList(); miscParams.Add( "externalWindowInfo", glContext ); miscParams.Add( "externalWindow", true ); window = Root.Instance.CreateRenderWindow( "Droid.Demo", width, height, true, miscParams ); TechDemoListener rwl = new TechDemoListener( window ); WindowEventMonitor.Instance.RegisterListener( window, rwl ); SetupResources(); ChooseSceneManager(); CreateCamera(); CreateViewports(); this.viewport.BackgroundColor = ColorEx.SteelBlue; // set default mipmap level TextureManager.Instance.DefaultMipmapCount = 5; // Create any resource listeners (for loading screens) this.CreateResourceListener(); // Load resources this.LoadResources(); ShowDebugOverlay( true ); //CreateGUI(); //input = SetupInput(); // call the overridden CreateScene method CreateScene(); return true; }
public override RenderWindow CreateWindow( bool autoCreateWindow, GLES2RenderSystem renderSystem, string windowTitle ) { LogManager.Instance.Write( "\tGLSupport CreateWindow called" ); RenderWindow window = null; if ( autoCreateWindow ) { var miscParams = new NamedParameterList(); bool fullscreen = true; int w = 800, h = 600; if ( Options.ContainsKey( "Display Frequency" ) ) { miscParams.Add( "displayFrequency", Options[ "Display Frequency" ] ); } window = renderSystem.CreateRenderWindow( windowTitle, w, h, fullscreen, miscParams ); } return window; }
public override RenderWindow CreateWindow(bool autoCreateWindow, GLES2RenderSystem renderSystem, string windowTitle) { LogManager.Instance.Write("\tGLSupport CreateWindow called"); RenderWindow window = null; if (autoCreateWindow) { var miscParams = new NamedParameterList(); bool fullscreen = true; int w = 800, h = 600; if (Options.ContainsKey("Display Frequency")) { miscParams.Add("displayFrequency", Options["Display Frequency"]); } window = renderSystem.CreateRenderWindow(windowTitle, w, h, fullscreen, miscParams); } return(window); }
/// <summary> /// Create an Entity (instance of a discrete mesh). /// </summary> /// <param name="name">The name to be given to the entity (must be unique).</param> /// <param name="meshName">The name of the mesh to load. Will be loaded if not already.</param> /// <returns></returns> public virtual Entity CreateEntity( string name, string meshName ) { NamedParameterList param = new NamedParameterList(); param.Add( "mesh", meshName ); return (Entity)this.CreateMovableObject( name, EntityFactory.TypeName, param ); }
/// <summary> /// Creates a billboard set which can be uses for particles, sprites, etc. /// </summary> /// <param name="name"></param> /// <param name="poolSize"></param> /// <returns></returns> public virtual BillboardSet CreateBillboardSet( string name, int poolSize ) { NamedParameterList param = new NamedParameterList(); param.Add( "poolSize", poolSize.ToString() ); return (BillboardSet)this.CreateMovableObject( name, BillboardSetFactory.TypeName, param ); }
public override RenderWindow CreateWindow(bool autoCreateWindow, GLRenderSystem renderSystem, string windowTitle) { RenderWindow autoWindow = null; if (autoCreateWindow) { int width = 640; int height = 480; int bpp = 32; bool fullscreen = false; ConfigOption optVM = ConfigOptions["Video Mode"]; string vm = optVM.Value; int pos = vm.IndexOf('x'); if (pos == -1) throw new Exception("Invalid Video Mode provided"); width = int.Parse(vm.Substring(0, vm.IndexOf("x"))); height = int.Parse(vm.Substring(vm.IndexOf("x") + 1)); fullscreen = (ConfigOptions["Full Screen"].Value == "Yes"); NamedParameterList miscParams = new NamedParameterList(); ConfigOption opt; opt = ConfigOptions["Color Depth"]; if (opt != null) miscParams.Add("colorDepth", opt.Value); opt = ConfigOptions["VSync"]; if (opt != null) { miscParams.Add("vsync", opt.Value); if (Wgl.IsExtensionSupported("wglSwapIntervalEXT")) Wgl.wglSwapIntervalEXT(StringConverter.ParseBool(opt.Value) ? 1 : 0); } opt = ConfigOptions["FSAA"]; if (opt != null) miscParams.Add("fsaa", opt.Value); // create a default form to use for a rendering target //DefaultForm form = CreateDefaultForm( windowTitle, 0, 0, width, height, fullscreen ); // create the window with the default form as the target autoWindow = renderSystem.CreateRenderWindow(windowTitle, width, height, fullscreen, miscParams); // set the default form's renderwindow so it can access it internally //form.RenderWindow = autoWindow; // show the window //form.Show(); } return autoWindow; }
public override RenderWindow Initialize( bool autoCreateWindow, string windowTitle ) { LogManager.Instance.Write( "[D3D9] : Subsystem Initializing" ); // Axiom specific WindowEventMonitor.Instance.MessagePump = Win32MessageHandling.MessagePump; // Init using current settings this._activeD3DDriver = this._driverList[ ConfigOptions[ "Rendering Device" ].Value ]; if ( this._activeD3DDriver == null ) { throw new ArgumentException( "Problems finding requested Direct3D driver!" ); } driverVersion.Major = this._activeD3DDriver.AdapterIdentifier.DriverVersion.Major; driverVersion.Minor = this._activeD3DDriver.AdapterIdentifier.DriverVersion.Minor; driverVersion.Release = this._activeD3DDriver.AdapterIdentifier.DriverVersion.MajorRevision; driverVersion.Build = this._activeD3DDriver.AdapterIdentifier.DriverVersion.MinorRevision; // Create the device manager. this._deviceManager = new D3D9DeviceManager(); // Create the texture manager for use by others textureManager = new D3D9TextureManager(); // Also create hardware buffer manager this._hardwareBufferManager = new D3D9HardwareBufferManager(); // Create the GPU program manager this._gpuProgramManager = new D3D9GpuProgramManager(); // Create & register HLSL factory this._hlslProgramFactory = new D3D9HLSLProgramFactory(); RenderWindow autoWindow = null; if ( autoCreateWindow ) { var fullScreen = ( ConfigOptions[ "Full Screen" ].Value == "Yes" ); D3D9VideoMode videoMode = null; var vm = ConfigOptions[ "Video Mode" ].Value; var width = int.Parse( vm.Substring( 0, vm.IndexOf( "x" ) ) ); var height = int.Parse( vm.Substring( vm.IndexOf( "x" ) + 1, vm.IndexOf( "@" ) - ( vm.IndexOf( "x" ) + 1 ) ) ); var bpp = int.Parse( vm.Substring( vm.IndexOf( "@" ) + 1, vm.IndexOf( "-" ) - ( vm.IndexOf( "@" ) + 1 ) ) ); foreach ( var currVideoMode in this._activeD3DDriver.VideoModeList ) { var temp = currVideoMode.Description; var colorDepth = int.Parse( temp.Substring( temp.IndexOf( "@" ) + 1, temp.IndexOf( "-" ) - ( temp.IndexOf( "@" ) + 1 ) ) ); // In full screen we only want to allow supported resolutions, so temp and opt->second.currentValue need to // match exactly, but in windowed mode we can allow for arbitrary window sized, so we only need // to match the colour values if ( fullScreen && ( temp == vm ) || !fullScreen && ( colorDepth == bpp ) ) { videoMode = currVideoMode; break; } } if ( videoMode == null ) { throw new AxiomException( "Can't find requested video mode." ); } // sRGB window option ConfigOption opt; if ( !ConfigOptions.TryGetValue( "sRGB Gamma Conversion", out opt ) ) { throw new AxiomException( "Can't find sRGB option!" ); } var hwGamma = opt.Value == "Yes"; var miscParams = new NamedParameterList(); miscParams.Add( "title", windowTitle ); // Axiom only? miscParams.Add( "colorDepth", bpp ); miscParams.Add( "FSAA", this._fsaaSamples ); miscParams.Add( "FSAAHint", this._fsaaHint ); miscParams.Add( "vsync", vSync ); miscParams.Add( "vsyncInterval", vSyncInterval ); miscParams.Add( "useNVPerfHUD", this._useNVPerfHUD ); miscParams.Add( "gamma", hwGamma ); miscParams.Add( "monitorIndex", this._activeD3DDriver.AdapterNumber ); // create the render window autoWindow = CreateRenderWindow( windowTitle, width, height, fullScreen, miscParams ); // If we have 16bit depth buffer enable w-buffering. Contract.Requires( autoWindow != null ); wBuffer = ( autoWindow.ColorDepth == 16 ); } LogManager.Instance.Write( "***************************************" ); LogManager.Instance.Write( "*** D3D9 : Subsystem Initialized OK ***" ); LogManager.Instance.Write( "***************************************" ); // call superclass method base.Initialize( autoCreateWindow, windowTitle ); // Configure SharpDX DX.Configuration.ThrowOnShaderCompileError = true; #if DEBUG DX.Configuration.EnableObjectTracking = true; #endif return autoWindow; }
public override RenderWindow CreateWindow(bool autoCreateWindow, GLRenderSystem renderSystem, string windowTitle) { RenderWindow autoWindow = null; if (autoCreateWindow) { int width = 640; int height = 480; int bpp = 32; bool fullscreen = false; ConfigOption optVM = ConfigOptions["Video Mode"]; string vm = optVM.Value; int pos = vm.IndexOf('x'); if (pos == -1) { throw new Exception("Invalid Video Mode provided"); } width = int.Parse(vm.Substring(0, vm.IndexOf("x"))); height = int.Parse(vm.Substring(vm.IndexOf("x") + 1)); fullscreen = (ConfigOptions["Full Screen"].Value == "Yes"); NamedParameterList miscParams = new NamedParameterList(); ConfigOption opt; opt = ConfigOptions["Color Depth"]; if (opt != null) { miscParams.Add("colorDepth", opt.Value); } opt = ConfigOptions["VSync"]; if (opt != null) { miscParams.Add("vsync", opt.Value); if (Wgl.IsExtensionSupported("wglSwapIntervalEXT")) { Wgl.wglSwapIntervalEXT(StringConverter.ParseBool(opt.Value) ? 1 : 0); } } opt = ConfigOptions["FSAA"]; if (opt != null) { miscParams.Add("fsaa", opt.Value); } // create a default form to use for a rendering target //DefaultForm form = CreateDefaultForm( windowTitle, 0, 0, width, height, fullscreen ); // create the window with the default form as the target autoWindow = renderSystem.CreateRenderWindow(windowTitle, width, height, fullscreen, miscParams); // set the default form's renderwindow so it can access it internally //form.RenderWindow = autoWindow; // show the window //form.Show(); } return(autoWindow); }
/// <summary> /// Create an Entity (instance of a discrete mesh). /// </summary> /// <param name="name">The name to be given to the entity (must be unique).</param> /// <param name="mesh">The mesh to use.</param> /// <returns></returns> public virtual Entity CreateEntity( string name, Mesh mesh ) { var param = new NamedParameterList(); param.Add( "mesh", mesh ); return (Entity)CreateMovableObject( name, EntityFactory.TypeName, param ); }
public override RenderWindow Initialize(bool autoCreateWindow, string windowTitle) { LogManager.Instance.Write("[D3D9] : Subsystem Initializing"); // Axiom specific WindowEventMonitor.Instance.MessagePump = Win32MessageHandling.MessagePump; // Init using current settings this._activeD3DDriver = this._driverList[ConfigOptions["Rendering Device"].Value]; if (this._activeD3DDriver == null) { throw new ArgumentException("Problems finding requested Direct3D driver!"); } driverVersion.Major = this._activeD3DDriver.AdapterIdentifier.DriverVersion.Major; driverVersion.Minor = this._activeD3DDriver.AdapterIdentifier.DriverVersion.Minor; driverVersion.Release = this._activeD3DDriver.AdapterIdentifier.DriverVersion.MajorRevision; driverVersion.Build = this._activeD3DDriver.AdapterIdentifier.DriverVersion.MinorRevision; // Create the device manager. this._deviceManager = new D3D9DeviceManager(); // Create the texture manager for use by others textureManager = new D3D9TextureManager(); // Also create hardware buffer manager this._hardwareBufferManager = new D3D9HardwareBufferManager(); // Create the GPU program manager this._gpuProgramManager = new D3D9GpuProgramManager(); // Create & register HLSL factory this._hlslProgramFactory = new D3D9HLSLProgramFactory(); RenderWindow autoWindow = null; if (autoCreateWindow) { var fullScreen = (ConfigOptions["Full Screen"].Value == "Yes"); D3D9VideoMode videoMode = null; var vm = ConfigOptions["Video Mode"].Value; var width = int.Parse(vm.Substring(0, vm.IndexOf("x"))); var height = int.Parse(vm.Substring(vm.IndexOf("x") + 1, vm.IndexOf("@") - (vm.IndexOf("x") + 1))); var bpp = int.Parse(vm.Substring(vm.IndexOf("@") + 1, vm.IndexOf("-") - (vm.IndexOf("@") + 1))); foreach (var currVideoMode in this._activeD3DDriver.VideoModeList) { var temp = currVideoMode.Description; var colorDepth = int.Parse(temp.Substring(temp.IndexOf("@") + 1, temp.IndexOf("-") - (temp.IndexOf("@") + 1))); // In full screen we only want to allow supported resolutions, so temp and opt->second.currentValue need to // match exactly, but in windowed mode we can allow for arbitrary window sized, so we only need // to match the colour values if (fullScreen && (temp == vm) || !fullScreen && (colorDepth == bpp)) { videoMode = currVideoMode; break; } } if (videoMode == null) { throw new AxiomException("Can't find requested video mode."); } // sRGB window option ConfigOption opt; if (!ConfigOptions.TryGetValue("sRGB Gamma Conversion", out opt)) { throw new AxiomException("Can't find sRGB option!"); } var hwGamma = opt.Value == "Yes"; var miscParams = new NamedParameterList(); miscParams.Add("title", windowTitle); // Axiom only? miscParams.Add("colorDepth", bpp); miscParams.Add("FSAA", this._fsaaSamples); miscParams.Add("FSAAHint", this._fsaaHint); miscParams.Add("vsync", vSync); miscParams.Add("vsyncInterval", vSyncInterval); miscParams.Add("useNVPerfHUD", this._useNVPerfHUD); miscParams.Add("gamma", hwGamma); miscParams.Add("monitorIndex", this._activeD3DDriver.AdapterNumber); // create the render window autoWindow = CreateRenderWindow(windowTitle, width, height, fullScreen, miscParams); // If we have 16bit depth buffer enable w-buffering. Contract.Requires(autoWindow != null); wBuffer = (autoWindow.ColorDepth == 16); } LogManager.Instance.Write("***************************************"); LogManager.Instance.Write("*** D3D9 : Subsystem Initialized OK ***"); LogManager.Instance.Write("***************************************"); // call superclass method base.Initialize(autoCreateWindow, windowTitle); // Configure SharpDX DX.Configuration.ThrowOnShaderCompileError = true; #if DEBUG DX.Configuration.EnableObjectTracking = true; #endif return(autoWindow); }
/// <summary> /// Initialize the rendering engine. /// </summary> /// <param name="autoCreateWindow">If true, a default window is created to serve as a rendering target.</param> /// <param name="windowTitle">Text to display on the window caption if not fullscreen.</param> /// <returns>A RenderWindow implementation specific to this RenderSystem.</returns> /// <remarks>All subclasses should call this method from within thier own intialize methods.</remarks> public override RenderWindow Initialize(bool autoCreateWindow, string windowTitle) { LogManager.Instance.Write("[XNA] : Subsystem Initializing"); #if !( XBOX || XBOX360 || SILVERLIGHT || WINDOWS_PHONE ) WindowEventMonitor.Instance.MessagePump = Win32MessageHandling.MessagePump; #endif _activeDriver = XnaHelper.GetDriverInfo()[ConfigOptions["Rendering Device"].Value]; if (_activeDriver == null) { throw new ArgumentException("Problems finding requested Xna driver!"); } RenderWindow renderWindow = null; // register the HLSL program manager //HighLevelGpuProgramManager.Instance.AddFactory(new HLSLProgramFactory()); StateManager = new StateManagement(); if (autoCreateWindow) { #if SILVERLIGHT var width = (int)XnaRenderWindow.DrawingSurface.ActualWidth; var height = (int)XnaRenderWindow.DrawingSurface.ActualHeight; #else var width = 800; var height = 600; #endif var bpp = 32; var fullScreen = false; var optVM = ConfigOptions["Video Mode"]; var vm = optVM.Value; width = int.Parse(vm.Substring(0, vm.IndexOf("x"))); height = int.Parse(vm.Substring(vm.IndexOf("x") + 1, vm.IndexOf("@") - (vm.IndexOf("x") + 1))); bpp = int.Parse(vm.Substring(vm.IndexOf("@") + 1, vm.IndexOf("-") - (vm.IndexOf("@") + 1))); #if !(XBOX || XBOX360) fullScreen = (ConfigOptions["Full Screen"].Value == "Yes"); #endif var miscParams = new NamedParameterList(); miscParams.Add("title", windowTitle); miscParams.Add("colorDepth", bpp); //miscParams.Add( "FSAA", this._fsaaType ); miscParams.Add("FSAAQuality", _fsaaQuality); miscParams.Add("vsync", _vSync); miscParams.Add("useNVPerfHUD", _useNVPerfHUD); // create the render window renderWindow = CreateRenderWindow("Main Window", width, height, fullScreen, miscParams); } new XnaMaterialManager(); LogManager.Instance.Write("[XNA] : Subsystem Initialized successfully."); return renderWindow; }
public override RenderWindow Initialize(bool autoCreateWindow, string windowTitle) { LogManager.Instance.Write("[D3D9] : Subsystem Initializing"); // Axiom specific WindowEventMonitor.Instance.MessagePump = Win32MessageHandling.MessagePump; // Init using current settings _activeD3DDriver = D3DHelper.GetDriverInfo(_pD3D)[ConfigOptions["Rendering Device"].Value]; if (_activeD3DDriver == null) throw new ArgumentException("Problems finding requested Direct3D driver!"); driverVersion.Major = _activeD3DDriver.AdapterIdentifier.DriverVersion.Major; driverVersion.Minor = _activeD3DDriver.AdapterIdentifier.DriverVersion.Minor; driverVersion.Release = _activeD3DDriver.AdapterIdentifier.DriverVersion.MajorRevision; driverVersion.Build = _activeD3DDriver.AdapterIdentifier.DriverVersion.MinorRevision; // Create the device manager. _deviceManager = new D3D9DeviceManager(); // Create the texture manager for use by others textureManager = new D3DTextureManager(); // Also create hardware buffer manager _hardwareBufferManager = new D3DHardwareBufferManager(); // Create the GPU program manager _gpuProgramManager = new D3DGpuProgramManager(); _hlslProgramFactory = new HLSLProgramFactory(); RenderWindow renderWindow = null; if (autoCreateWindow) { var fullScreen = (ConfigOptions["Full Screen"].Value == "Yes"); var optVm = ConfigOptions["Video Mode"]; var vm = optVm.Value; var width = int.Parse(vm.Substring(0, vm.IndexOf("x"))); var height = int.Parse(vm.Substring(vm.IndexOf("x") + 1, vm.IndexOf("@") - (vm.IndexOf("x") + 1))); var bpp = int.Parse(vm.Substring(vm.IndexOf("@") + 1, vm.IndexOf("-") - (vm.IndexOf("@") + 1))); // sRGB window option ConfigOption opt; var hwGamma = ConfigOptions.TryGetValue("sRGB Gamma Conversion", out opt) && (opt.Value == "Yes"); var miscParams = new NamedParameterList(); miscParams.Add("title", windowTitle); // Axiom only? miscParams.Add("colorDepth", bpp); miscParams.Add("FSAA", _fsaaSamples); miscParams.Add("FSAAHint", _fsaaHint); miscParams.Add("vsync", vSync); miscParams.Add("vsyncInterval", vSyncInterval); miscParams.Add("useNVPerfHUD", _useNVPerfHUD); miscParams.Add("gamma", hwGamma); miscParams.Add("monitorIndex", _activeD3DDriver.AdapterNumber); // create the render window renderWindow = CreateRenderWindow("Main Window", width, height, fullScreen, miscParams); // If we have 16bit depth buffer enable w-buffering. Debug.Assert(renderWindow != null); wBuffer = (renderWindow.ColorDepth == 16); } LogManager.Instance.Write("***************************************"); LogManager.Instance.Write("*** D3D9 : Subsystem Initialized OK ***"); LogManager.Instance.Write("***************************************"); // call superclass method base.Initialize( autoCreateWindow, windowTitle ); // Configure SlimDX SlimDX.Configuration.ThrowOnError = true; SlimDX.Configuration.AddResultWatch(ResultCode.DeviceLost, ResultWatchFlags.AlwaysIgnore); SlimDX.Configuration.AddResultWatch(ResultCode.WasStillDrawing, ResultWatchFlags.AlwaysIgnore); #if DEBUG SlimDX.Configuration.DetectDoubleDispose = false; SlimDX.Configuration.EnableObjectTracking = true; #else SlimDX.Configuration.DetectDoubleDispose = false; SlimDX.Configuration.EnableObjectTracking = false; #endif return renderWindow; }
/// <summary> /// /// </summary> /// <param name="autoCreateWindow"></param> /// <param name="renderSystem"></param> /// <param name="windowTitle"></param> /// <returns></returns> public override RenderWindow CreateWindow( bool autoCreateWindow, GLRenderSystem renderSystem, string windowTitle ) { RenderWindow autoWindow = null; if ( autoCreateWindow ) { int width = 800; int height = 600; int bpp = 32; bool fullScreen = false; ConfigOption optVM = ConfigOptions[ "Video Mode" ]; string vm = optVM.Value; int pos = vm.IndexOf( 'x' ); if ( pos == -1 ) { throw new Exception( "Invalid Video Mode provided" ); } width = int.Parse( vm.Substring( 0, vm.IndexOf( "x" ) ) ); height = int.Parse( vm.Substring( vm.IndexOf( "x" ) + 1 ) ); fullScreen = ( ConfigOptions[ "Full Screen" ].Value == "Yes" ); var miscParams = new NamedParameterList(); ConfigOption opt; opt = ConfigOptions[ "Color Depth" ]; if ( opt != null && opt.Value != null && opt.Value.Length > 0 ) { miscParams.Add( "colorDepth", opt.Value ); } opt = ConfigOptions[ "VSync" ]; if ( opt != null && opt.Value != null && opt.Value.Length > 0 ) { miscParams.Add( "vsync", opt.Value ); //TODO : renderSystem.WaitForVerticalBlank = (bool)opt.Value; } opt = ConfigOptions[ "FSAA" ]; if ( opt != null && opt.Value != null && opt.Value.Length > 0 ) { miscParams.Add( "fsaa", opt.Value ); } miscParams.Add( "title", windowTitle ); // create the window with the default form as the target autoWindow = renderSystem.CreateRenderWindow( windowTitle, width, height, fullScreen, miscParams ); } return autoWindow; }