コード例 #1
0
ファイル: ConfigDialog.cs プロジェクト: WolfgangSt/axiom
        public ConfigDialog()
        {
            Axiom.Core.Root root = Axiom.Core.Root.Instance;
            _renderSystemList = new List<RenderSystem>(root.RenderSystems.Values);
            _currentSystem = _renderSystemList[ 0 ];
            _renderSystems = new ConfigOption("Render System", _currentSystem.Name, false);

            foreach ( RenderSystem rs in root.RenderSystems )
            {
                _renderSystems.PossibleValues.Add(_renderSystems.PossibleValues.Count, rs.ToString());
            }

            BuildOptions();
        }
コード例 #2
0
ファイル: iOSSupport.cs プロジェクト: ryan-bunker/axiom3d
		public override void AddConfig()
		{
			ConfigOption optFullsreen = new ConfigOption( "Full Screen", "No", false );
			ConfigOption optVideoMode = new ConfigOption( "Video Mode", "640 x 320", false );
			ConfigOption optDisplayFrequenzy = new ConfigOption( "Display Frequency", "60", false );
			ConfigOption optFSAA = new ConfigOption( "FSAA", "1", false );
			ConfigOption optRTTMode = new ConfigOption( "RTT Preferred Mode", "FBO", false );
			optFullsreen.PossibleValues.Add( 0, "Yes" );
			optFullsreen.PossibleValues.Add( 1, "No" );

			optFullsreen.Value = optFullsreen.PossibleValues[ 0 ];
			int index = 0;
			foreach ( KeyValuePair<Size, short> mode in _videoModes )
			{
				string resolution = mode.Key.Width + " x " + mode.Key.Height;
				if ( !optVideoMode.PossibleValues.ContainsValue( resolution ) )
					optVideoMode.PossibleValues.Add( index++, resolution );
			}
			index = 0;
			optVideoMode.Value = _currentMode.Key.Width + " x " + _currentMode.Key.Height;

			if ( _sampleLevels.Count > 0 )
			{
				foreach ( string fssa in _sampleLevels )
					optFSAA.PossibleValues.Add( index++, fssa );

				optFSAA.Value = optFSAA.PossibleValues[ 0 ];
			}

			optRTTMode.PossibleValues.Add( 0, "FBO" );
			optRTTMode.PossibleValues.Add( 1, "PBuffer" );
			optRTTMode.PossibleValues.Add( 2, "Copy" );
			optRTTMode.Value = optRTTMode.PossibleValues[ 0 ];

			_options[ optFullsreen.Name ] = optFullsreen;
			_options[ optVideoMode.Name ] = optVideoMode;
			_options[ optDisplayFrequenzy.Name ] = optDisplayFrequenzy;
			_options[ optFSAA.Name ] = optFSAA;
			_options[ optRTTMode.Name ] = optRTTMode;

			RefreshConfig();
		}
コード例 #3
0
ファイル: GLHelper.cs プロジェクト: ryan-bunker/axiom3d
        /// <summary>
        ///		Query the display modes and deal with any other config options.
        /// </summary>
        public override void AddConfig()
        {
            ConfigOption optFullScreen = new ConfigOption("Full Screen", "No", false);
            ConfigOption optVideoMode = new ConfigOption("Video Mode", "800 x 600", false);
            ConfigOption optDisplayFrequency = new ConfigOption("Display Frequency", "", false);
            ConfigOption optColorDepth = new ConfigOption("Color Depth", "", false);
            ConfigOption optFSAA = new ConfigOption("FSAA", "0", false);
            ConfigOption optVSync = new ConfigOption("VSync", "No", false);
            ConfigOption optRTTMode = new ConfigOption("RTT Preferred Mode", "FBO", false);

            // Full Screen
            optFullScreen.PossibleValues.Add(0, "Yes");
            optFullScreen.PossibleValues.Add(1, "No");

            // Video Mode

            #region Video Mode

            Gdi.DEVMODE setting;
            int i = 0;
            int width, height, bpp, freq;
            // get the available OpenGL resolutions
            bool more = User.EnumDisplaySettings(null, i++, out setting);
            // add the resolutions to the config
            while (more)
            {
                _deviceModes.Add(setting);

                width = setting.dmPelsWidth;
                height = setting.dmPelsHeight;
                bpp = setting.dmBitsPerPel;

                // filter out the lower resolutions and dupe frequencies
                if (bpp >= 16 && height >= 480)
                {
                    string query = string.Format("{0} x {1}", width, height);

                    if (!optVideoMode.PossibleValues.Values.Contains(query))
                    {
                        // add a new row to the display settings table
                        optVideoMode.PossibleValues.Add(i, query);
                    }
                    if (optVideoMode.PossibleValues.Count == 1 && String.IsNullOrEmpty(optVideoMode.Value))
                    {
                        optVideoMode.Value = query;
                    }
                }
                // grab the current display settings
                more = User.EnumDisplaySettings(null, i++, out setting);
            }

            #endregion Video Mode

            // FSAA
            foreach (int level in _fsaaLevels)
            {
                optFSAA.PossibleValues.Add(level, level.ToString());
            }

            // VSync
            optVSync.PossibleValues.Add(0, "Yes");
            optVSync.PossibleValues.Add(1, "No");

            // RTTMode
            optRTTMode.PossibleValues.Add(0, "FBO");
            optRTTMode.PossibleValues.Add(1, "PBuffer");
            optRTTMode.PossibleValues.Add(2, "Copy");

            optFullScreen.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optVideoMode.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optDisplayFrequency.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optFSAA.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optVSync.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optColorDepth.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);
            optRTTMode.ConfigValueChanged += new ConfigOption<string>.ValueChanged(_configOptionChanged);

            ConfigOptions.Add(optVideoMode);
            ConfigOptions.Add(optColorDepth);
            ConfigOptions.Add(optDisplayFrequency);
            ConfigOptions.Add(optFullScreen);
            ConfigOptions.Add(optFSAA);
            ConfigOptions.Add(optVSync);
            ConfigOptions.Add(optRTTMode);

            _refreshConfig();
        }
コード例 #4
0
        private void InitConfigOptions()
        {
            var optDevice = new ConfigOption( "Rendering Device", "", false );

            var optVideoMode = new ConfigOption("Video Mode", "800 x 600 @ 32-bit color", false);

            var optFullScreen = new ConfigOption("Full Screen", "No", false);
            optFullScreen.PossibleValues.Add(0, "Yes");
            optFullScreen.PossibleValues.Add(1, "No");

            var optResourceCeationPolicy = new ConfigOption( "Resource Creation Policy", "", false );
            optResourceCeationPolicy.PossibleValues.Add( 0, "Create on all devices" );
            optResourceCeationPolicy.PossibleValues.Add( 1, "Create on active device" );
            switch ( _resourceManager.CreationPolicy )
            {
                case D3D9ResourceManager.ResourceCreationPolicy.CreateOnActiveDevice:
                    optResourceCeationPolicy.Value = "Create on active device";
                    break;
                case D3D9ResourceManager.ResourceCreationPolicy.CreateOnAllDevices:
                    optResourceCeationPolicy.Value = "Create on all devices";
                    break;
                default:
                    optResourceCeationPolicy.Value = "N/A";
                    break;
            }

            var driverList = D3DHelper.GetDriverInfo(_pD3D);
            foreach (var driver in driverList)
            {
                optDevice.PossibleValues.Add(driver.AdapterNumber, driver.DriverDescription);
            }
            // Make first one default
            optDevice.Value = driverList.First().DriverDescription;

            var optVSync = new ConfigOption("VSync", "No", false);
            optVSync.PossibleValues.Add(0, "Yes");
            optVSync.PossibleValues.Add(1, "No");

            var optVSyncInterval = new ConfigOption( "VSync Interval", "1", false );
            optVSyncInterval.PossibleValues.Add(0, "1");
            optVSyncInterval.PossibleValues.Add(1, "2");
            optVSyncInterval.PossibleValues.Add(3, "3");
            optVSyncInterval.PossibleValues.Add(4, "4");

            var optAa = new ConfigOption("FSAA", "None", false);
            optAa.PossibleValues.Add(0, "None");

            var optFPUMode = new ConfigOption("Floating-point mode", "Fastest", false);
#if AXIOM_DOUBLE_PRECISION
            optFPUMode.Value = "Consistent";
#else
            optFPUMode.Value = "Fastest";
#endif
            optFPUMode.PossibleValues.Clear();
            optFPUMode.PossibleValues.Add(0, "Fastest");
            optFPUMode.PossibleValues.Add(1, "Consistent");

            var optNVPerfHUD = new ConfigOption( "Allow NVPerfHUD", "No", false );
            optNVPerfHUD.PossibleValues.Add( 0, "Yes" );
            optNVPerfHUD.PossibleValues.Add( 1, "No" );

            var optSRGB = new ConfigOption( "sRGB Gamma Conversion", "No", false );
            optSRGB.PossibleValues.Add(0, "Yes");
            optSRGB.PossibleValues.Add(1, "No");

            var optMultiDeviceMemHint = new ConfigOption( "Multi device memory hint", "Use minimum system memory", false );
            optMultiDeviceMemHint.PossibleValues.Add(0, "Use minimum system memory");
            optMultiDeviceMemHint.PossibleValues.Add(1, "Auto hardware buffers management");

            // RT options ommited here 

            // Axiom specific registering
            optDevice.ConfigValueChanged += ConfigOptionChanged;
            optVideoMode.ConfigValueChanged += ConfigOptionChanged;
            optFullScreen.ConfigValueChanged += ConfigOptionChanged;
            optResourceCeationPolicy.ConfigValueChanged += ConfigOptionChanged;
            optVSync.ConfigValueChanged += ConfigOptionChanged;
            optVSyncInterval.ConfigValueChanged += ConfigOptionChanged;
            optAa.ConfigValueChanged += ConfigOptionChanged;
            optFPUMode.ConfigValueChanged += ConfigOptionChanged;
            optNVPerfHUD.ConfigValueChanged += ConfigOptionChanged;
            optSRGB.ConfigValueChanged += ConfigOptionChanged;
            optMultiDeviceMemHint.ConfigValueChanged += ConfigOptionChanged;

            ConfigOptions.Add( optDevice );
            ConfigOptions.Add( optVideoMode );
            ConfigOptions.Add( optFullScreen );
            ConfigOptions.Add( optResourceCeationPolicy );
            ConfigOptions.Add( optVSync );
            ConfigOptions.Add( optVSyncInterval );
            ConfigOptions.Add( optAa );
            ConfigOptions.Add( optFPUMode );
            ConfigOptions.Add( optNVPerfHUD );
            ConfigOptions.Add( optSRGB );
            ConfigOptions.Add( optMultiDeviceMemHint );
            // Axiom specific registering

            RefreshD3DSettings();
        }
コード例 #5
0
		/*
				private void _setFSAA( XFG.MultiSampleType fsaa, int level )
				{
					if ( _device == null )
					{
						_fsaaType = fsaa;
						_fsaaQuality = level;
					}
				}
		*/

		private void _initConfigOptions()
		{
			var optDevice = new ConfigOption("Rendering Device", "", false);
			var optVideoMode = new ConfigOption("Video Mode", "800 x 600 @ 32-bit color", false);
			var optFullScreen = new ConfigOption("Full Screen", "No", false);
			var optVSync = new ConfigOption("VSync", "No", false);
			var optAA = new ConfigOption("Anti aliasing", "None", false);
			var optFPUMode = new ConfigOption("Floating-point mode", "Fastest", false);
			var optNVPerfHUD = new ConfigOption("Allow NVPerfHUD", "No", false);
			var optSaveShaders = new ConfigOption("Save Generated Shaders", "No", false);
			var optUseCP = new ConfigOption("Use Content Pipeline", "No", false);

			optDevice.PossibleValues.Clear();

			var driverList = XnaHelper.GetDriverInfo();
			foreach (var driver in driverList)
			{
				if (!optDevice.PossibleValues.ContainsKey(driver.AdapterNumber))
				{
					optDevice.PossibleValues.Add(driver.AdapterNumber, driver.Description);
				}
			}
			if (driverList.Count > 0)
				optDevice.Value = driverList[0].Description;
			else
				optDevice.Value = "No Device";

			optFullScreen.PossibleValues.Add(0, "Yes");
			optFullScreen.PossibleValues.Add(1, "No");

			optVSync.PossibleValues.Add(0, "Yes");
			optVSync.PossibleValues.Add(1, "No");

			optAA.PossibleValues.Add(0, "None");

			optFPUMode.PossibleValues.Clear();
			optFPUMode.PossibleValues.Add(0, "Fastest");
			optFPUMode.PossibleValues.Add(1, "Consistent");

			optNVPerfHUD.PossibleValues.Add(0, "Yes");
			optNVPerfHUD.PossibleValues.Add(1, "No");

			optSaveShaders.PossibleValues.Add(0, "Yes");
			optSaveShaders.PossibleValues.Add(1, "No");

			optUseCP.PossibleValues.Add(0, "Yes");
			optUseCP.PossibleValues.Add(1, "No");

			optFPUMode.ConfigValueChanged += _configOptionChanged;
			optAA.ConfigValueChanged += _configOptionChanged;
			optVSync.ConfigValueChanged += _configOptionChanged;
			optFullScreen.ConfigValueChanged += _configOptionChanged;
			optVideoMode.ConfigValueChanged += _configOptionChanged;
			optDevice.ConfigValueChanged += _configOptionChanged;
			optNVPerfHUD.ConfigValueChanged += _configOptionChanged;
			optSaveShaders.ConfigValueChanged += _configOptionChanged;
			optUseCP.ConfigValueChanged += _configOptionChanged;

			ConfigOptions.Add(optDevice);
			ConfigOptions.Add(optVideoMode);
			ConfigOptions.Add(optFullScreen);
			ConfigOptions.Add(optVSync);
			ConfigOptions.Add(optAA);
			ConfigOptions.Add(optFPUMode);
			ConfigOptions.Add(optNVPerfHUD);
			ConfigOptions.Add(optSaveShaders);
			ConfigOptions.Add(optUseCP);

			_refreshXnaSettings();
		}
コード例 #6
0
		/// <summary>
		///
		/// </summary>
		public override void AddConfig()
		{
			var optFullScreen = new ConfigOption( "Full Screen", "No", false );
			var optVideoMode = new ConfigOption( "Video Mode", "800 x 600", false );
			var optDisplayFrequency = new ConfigOption( "Display Frequency", "", false );
			var optColorDepth = new ConfigOption( "Color Depth", "", false );
			var optFSAA = new ConfigOption( "FSAA", "0", false );
			var optVSync = new ConfigOption( "VSync", "No", false );
			var optRTTMode = new ConfigOption( "RTT Preferred Mode", "FBO", false );

			// Full Screen
			optFullScreen.PossibleValues.Add( 0, "Yes" );
			optFullScreen.PossibleValues.Add( 1, "No" );

			// Video Mode

			#region Video Modes

			// get the available OpenGL resolutions
			DisplayDevice dev = DisplayDevice.Default;

			// add the resolutions to the config
			for ( int q = 0; q < dev.AvailableResolutions.Count; q++ )
			{
				if ( dev.AvailableResolutions[ q ].BitsPerPixel >= 16 )
				{
					int width = dev.AvailableResolutions[ q ].Width;
					int height = dev.AvailableResolutions[ q ].Height;

					// filter out the lower resolutions and dupe frequencies
					if ( width >= 640 && height >= 480 )
					{
						string query = string.Format( "{0} x {1}", width, height );

						if ( !optVideoMode.PossibleValues.Values.Contains( query ) )
						{
							// add a new row to the display settings table
							optVideoMode.PossibleValues.Add( optVideoMode.PossibleValues.Count, query );
						}
						if ( optVideoMode.PossibleValues.Count == 1 && String.IsNullOrEmpty( optVideoMode.Value ) )
						{
							optVideoMode.Value = query;
						}
					}
				}
			}

			#endregion Video Modes

			// FSAA
			GetFSAALevels();
			foreach ( int level in this._fsaaLevels )
			{
				optFSAA.PossibleValues.Add( level, level.ToString() );
			}

			// VSync
			optVSync.PossibleValues.Add( 0, "Yes" );
			optVSync.PossibleValues.Add( 1, "No" );

			// RTTMode
			optRTTMode.PossibleValues.Add( 0, "FBO" );
			optRTTMode.PossibleValues.Add( 1, "PBuffer" );
			optRTTMode.PossibleValues.Add( 2, "Copy" );

			optFullScreen.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optVideoMode.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optDisplayFrequency.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optFSAA.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optVSync.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optColorDepth.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );
			optRTTMode.ConfigValueChanged += new ConfigOption<string>.ValueChanged( _configOptionChanged );

			ConfigOptions.Add( optVideoMode );
			ConfigOptions.Add( optColorDepth );
			ConfigOptions.Add( optDisplayFrequency );
			ConfigOptions.Add( optFullScreen );
			ConfigOptions.Add( optFSAA );
			ConfigOptions.Add( optVSync );
			ConfigOptions.Add( optRTTMode );

			_refreshConfig();
		}
コード例 #7
0
        /// <summary>
        ///		Called in constructor to init configuration.
        /// </summary>
        private void InitConfigOptions()
        {
            Driver driver = D3DHelper.GetDriverInfo();

            foreach (VideoMode mode in driver.VideoModes)
            {
                // add a new row to the display settings table
                displayConfig.FullscreenModes.Add(new Axiom.Configuration.DisplayMode(mode.Width, mode.Height, mode.ColorDepth, true));
            }

            ConfigOption optDevice = new ConfigOption();
            ConfigOption optVideoMode = new ConfigOption();
            ConfigOption optFullScreen = new ConfigOption();
            ConfigOption optVSync = new ConfigOption();
            ConfigOption optAA = new ConfigOption();
            ConfigOption optNVPerfHUD = new ConfigOption();

            optDevice.name = "Rendering Device";

            optVideoMode.name = "Video Mode";
            optVideoMode.currentValue = "800 x 600 @ 32-bit color";
            foreach (VideoMode mode in driver.VideoModes)
                optVideoMode.possibleValues.Add(mode.ToString());

            optFullScreen.name = "Full Screen";
            optFullScreen.possibleValues.Add("Yes");
            optFullScreen.possibleValues.Add("No");
            optFullScreen.currentValue = "Yes";

            optVSync.name = "VSync";
            optVSync.possibleValues.Add("Yes");
            optVSync.possibleValues.Add("No");
            optVSync.currentValue = "Yes";

            optAA.name = "Anti Aliasing";
            optAA.possibleValues.Add("None");
            optAA.currentValue = "None";
            //
            // Query DirectX to get the list of valid multisample quality levels.
            // I am currently limiting us to the Non-maskable types, since we don't
            // have any support at the moment for an app to enable multisample masking,
            // and so providing both masking and non-masking types would just provide
            // redundant, confusing, and possibly slower options to the user.
            //
            // Really, the world creator should decide whether they need maskable
            // multisampling for their visual effects, so the choice of maskable
            // or non-maskable should eventually be available through scripting
            // rather than at the request of the user.
            //
            AdapterDetails details = D3D.Manager.Adapters[driver.AdapterNumber].Information;

            int result;
            int maxAAQuality;
            bool ret;
            // Configuring anti-aliasing before the render target has been created is problematic, since we don't know
            // for sure the surface format or whether we are windowed or not.  We will make guesses and hope for the best...
            ret = D3D.Manager.CheckDeviceMultiSampleType(driver.AdapterNumber, DeviceType.Hardware, Format.X8R8G8B8, false, MultiSampleType.NonMaskable, out result, out maxAAQuality);
            if (ret && (result == (int)ResultCode.Success))
            {
                for (int i = 0; i < maxAAQuality; i++)
                {
                    optAA.possibleValues.Add("Quality " + (i + 1).ToString());
                }
            }

            optNVPerfHUD.name = "Allow NVPerfHUD";
            optNVPerfHUD.possibleValues.Add("Yes");
            optNVPerfHUD.possibleValues.Add("No");
            optNVPerfHUD.currentValue = "No";

            // options[optDevice.name] = optDevice.currentValue;
            options[optVideoMode.name] = optVideoMode;
            options[optFullScreen.name] = optFullScreen;
            options[optVSync.name] = optVSync;
            options[optAA.name] = optAA;
            options[optNVPerfHUD.name] = optNVPerfHUD;
        }
コード例 #8
0
ファイル: ConfigDialog.cs プロジェクト: WolfgangSt/axiom
        private bool ProcessKey( int key )
        {

            if ( key == -1 ) //ESCAPE
            {
                if ( _currentOption == null )
                {
                    // ESC at main menu
                    _result = DialogResult.Cancel;
                    return false;
                }
                else
                {
                    // go back to main menu
                    _currentOption = null;
                    return true;
                }
            }

            if ( key == -2 ) //ENTER
            {
                if ( _currentOption == null )
                {
                    // at main menu
                    if ( _numericInput == -1 )
                    {
                        Axiom.Core.Root.Instance.RenderSystem = _currentSystem;

                        _result = DialogResult.Ok;
                        return false;
                    }
                    else if ( _numericInput >= 0 && _numericInput < _menuItems.Count )
                    {
                        _currentOption = (ConfigOption)_menuItems[ _numericInput ];
                        return true;
                    }

                    return true;
                }
                else if ( _numericInput >= 0 && _numericInput < _currentOption.PossibleValues.Count )
                {
                    // at options menu and having an entered number
                    _currentOption.Value = _currentOption.PossibleValues.Values[ _numericInput ].ToString();

                    if ( _currentOption.Name == "Render System" ) // About to change Renderers
                    {
                        _renderSystems = _currentOption;
                        _currentSystem = _renderSystemList[ _numericInput ];

                        BuildOptions();

                        _currentOption = null;

                        return true;
                    }

                    _currentOption = null;
                }

                return true;
            }

            return true;
        }