/// <summary> /// Loads the DDS texture. /// </summary> /// <param name="fileName">The name.</param> /// <param name="quality"></param> /// <returns></returns> protected override BaseTexture LoadDDSTexture(string fileName, TextureQuality quality) { var device = MyMinerGame.Static.GraphicsDevice; if (device == null || device.IsDisposed) { return null; } //cannot use profiler because of multithreading //int loadDDSTextureBlock = -1; //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyTexture2D.LoadDDSTexture", ref loadDDSTextureBlock); MyMwcLog.WriteLine(string.Format("Loading DDS texture {0} ...", fileName), SysUtils.LoggingOptions.LOADING_TEXTURES); Texture loadedTexture = null; if (this.flags.HasFlag(TextureFlags.IgnoreQuality)) { quality = TextureQuality.Full; } MyDDSFile.DDSFromFile(fileName, device, true, (int)quality, out loadedTexture); loadedTexture.Tag = this; if (!MyUtils.IsPowerOfTwo(loadedTexture.GetLevelDescription(0).Width) || !MyUtils.IsPowerOfTwo(loadedTexture.GetLevelDescription(0).Height)) { throw new FormatException("Size must be power of two!"); } //cannot use profiler because of multithreading //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(loadDDSTextureBlock); return loadedTexture; }
public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = textureParameters.Texture.ColorSpace.ToColorSpace(textureParameters.ColorSpace, asset.Hint) == ColorSpace.Linear; DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = asset.Hint; GenerateMipmaps = asset.GenerateMipmaps; if (asset.Alpha != AlphaFormat.None) { PremultiplyAlpha = asset.PremultiplyAlpha; } ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
/// <summary> /// Reloads this instance. /// </summary> internal bool Load(TextureQuality quality = 0, bool canBeMissing = false) { // TODO: !PetrM fix skipping mipmaps quality = 0; Debug.Assert(this.LoadState != LoadState.Loaded); bool loaded = false; if (!string.IsNullOrEmpty(ContentDir)) { loaded = Load(ContentDir, quality, canBeMissing); } if (!loaded) { loaded = Load(MyFileSystem.ContentPath, quality, canBeMissing); } if (loaded && this.texture != null) { this.texture.DebugName = this.Name + " (Render)"; this.LoadState = LoadState.Loaded; OnLoaded(); } return(loaded); }
/// <summary> /// Loads the DDS texture. /// </summary> /// <param name="fileName">The name.</param> /// <param name="quality"></param> /// <returns></returns> protected override BaseTexture LoadDDSTexture(string fileName, TextureQuality quality) { var device = MyMinerGame.Static.GraphicsDevice; if (device == null || device.IsDisposed) { return(null); } //cannot use profiler because of multithreading //int loadDDSTextureBlock = -1; //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyTexture2D.LoadDDSTexture", ref loadDDSTextureBlock); MyMwcLog.WriteLine(string.Format("Loading DDS texture {0} ...", fileName), SysUtils.LoggingOptions.LOADING_TEXTURES); Texture loadedTexture = null; if (this.flags.HasFlag(TextureFlags.IgnoreQuality)) { quality = TextureQuality.Full; } MyDDSFile.DDSFromFile(fileName, device, true, (int)quality, out loadedTexture); loadedTexture.Tag = this; if (!MyUtils.IsPowerOfTwo(loadedTexture.GetLevelDescription(0).Width) || !MyUtils.IsPowerOfTwo(loadedTexture.GetLevelDescription(0).Height)) { throw new FormatException("Size must be power of two!"); } //cannot use profiler because of multithreading //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(loadDDSTextureBlock); return(loadedTexture); }
/// <summary> /// Loads the DDS texture. /// </summary> /// <param name="name">The name.</param> /// <param name="quality"></param> /// <returns></returns> protected override SharpDX.Direct3D9.BaseTexture LoadDDSTexture(string name, TextureQuality quality) { try { var device = MyMinerGame.Static.GraphicsDevice; if (device == null || device.IsDisposed) { return(null); } if (this.flags.HasFlag(TextureFlags.IgnoreQuality)) { quality = TextureQuality.Full; } CubeTexture loadedTexture; MyDDSFile.DDSFromFile(name, device, true, (int)quality, out loadedTexture); loadedTexture.Tag = this; return(loadedTexture); } catch (FileNotFoundException) { } catch (Exception ddsException) { Debug.WriteLine(string.Format("W:Texture Cube (DDS) {0}", ddsException.Message)); } return(null); }
public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = textureParameters.Texture.Type.IsSRgb(textureParameters.ColorSpace); DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; ShouldCompress = asset.IsCompressed; DesiredAlpha = asset.Type.Alpha; TextureHint = asset.Type.Hint; InvertY = (asset.Type.Hint == TextureHint.NormalMap) ? ((NormapMapTextureType)asset.Type).InvertY : false; GenerateMipmaps = asset.GenerateMipmaps; if (asset.Type.Alpha != AlphaFormat.None) { PremultiplyAlpha = asset.Type.PremultiplyAlpha; } ColorKeyColor = asset.Type.ColorKeyColor; ColorKeyEnabled = asset.Type.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
/// <summary> /// Loads the DDS texture. /// </summary> /// <param name="name">The name.</param> /// <param name="quality"></param> /// <returns></returns> protected override SharpDX.Direct3D9.BaseTexture LoadDDSTexture(string name, TextureQuality quality) { try { var device = MyMinerGame.Static.GraphicsDevice; if (device == null || device.IsDisposed) { return null; } if (this.flags.HasFlag(TextureFlags.IgnoreQuality)) { quality = TextureQuality.Full; } CubeTexture loadedTexture; MyDDSFile.DDSFromFile(name, device, true, (int)quality, out loadedTexture); loadedTexture.Tag = this; return loadedTexture; } catch (FileNotFoundException) { } catch (Exception ddsException) { Debug.WriteLine(string.Format("W:Texture Cube (DDS) {0}", ddsException.Message)); } return null; }
public static void Initialize(ContentManager content, GraphicsDevice device) { #if __DESKTOP__ TEXTURE_QUALITY = TextureQuality.HD; #else TEXTURE_QUALITY = GetPreferredQuality(device); #endif LoadContent(content); }
public SpriteSheetParameters(SpriteSheetAsset sheetAsset, Dictionary <SpriteInfo, string> imageToTextureUrl, PlatformType platform, GraphicsPlatform graphicsPlatform, GraphicsProfile graphicsProfile, TextureQuality textureQuality) { ImageToTextureUrl = imageToTextureUrl; SheetAsset = sheetAsset; Platform = platform; GraphicsPlatform = graphicsPlatform; GraphicsProfile = graphicsProfile; TextureQuality = textureQuality; }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> static MyTextureManager() { Quality = TextureQuality.Half; m_textures = new Dictionary <string, MyTexture>(); m_loadingQueue = new ConcurrentQueue <MyTexture>(); m_dbgSendTimer = new Timer(1500); m_dbgSendTimer.Elapsed += DbgWatchLoadedTexturesDelayed; Enabled = true; //Task.Factory.StartNew(BackgroundLoader, TaskCreationOptions.LongRunning); }
public static void Initialize(ContentManager content, GraphicsDevice device) { if (MonoSAMGame.IsDesktop()) { TEXTURE_QUALITY = TextureQuality.HD; } else { TEXTURE_QUALITY = GetPreferredQuality(device); } LoadContent(content); }
/// <summary> /// Reloads this instance. /// </summary> internal bool Load(TextureQuality quality = 0) { Debug.Assert(this.LoadState != LoadState.Loaded); MyMwcLog.WriteLine(string.Format("Loading texture {0} ...", this.Name), SysUtils.LoggingOptions.LOADING_TEXTURES); var ddsTexture = new FileInfo(MyMinerGame.Static.RootDirectory + "\\" + this.Name + ".dds"); // System.Diagnostics.Debug.Assert(ddsTexture.Exists); if (ddsTexture.Exists) { this.texture = LoadDDSTexture(ddsTexture.FullName, quality);// : LoadXNATexture(this.Name); } else { var pngTexture = new FileInfo(MyMinerGame.Static.RootDirectory + "\\" + this.Name + ".png"); if (pngTexture.Exists) { this.texture = LoadPNGTexture(pngTexture.FullName);// : LoadXNATexture(this.Name); } else { this.LoadState = LoadState.Error; string s = "Texture " + this.Name + " is missing."; System.Diagnostics.Debug.Assert(pngTexture.Exists, s); return(false); } } if (this.texture == null) { this.LoadState = LoadState.Error; return(false); } this.texture.DebugName = this.Name; this.LoadState = LoadState.Loaded; // if (Name.Contains("Textures\\GUI\\Loading")) // { //} UpdateProperties(texture); MyMwcLog.WriteLine(string.Format("Texture {0} loaded", this.Name), SysUtils.LoggingOptions.LOADING_TEXTURES); OnLoaded(); return(true); }
internal Settings() { HIGHLIGHT_FX = GameSettings.HIGHLIGHT_FX; INFLIGHT_HIGHLIGHT = GameSettings.INFLIGHT_HIGHLIGHT; TEMPERATURE_GAUGES_MODE = GameSettings.TEMPERATURE_GAUGES_MODE; CAMERA_DOUBLECLICK_MOUSELOOK = GameSettings.CAMERA_DOUBLECLICK_MOUSELOOK; ADVANCED_TWEAKABLES = GameSettings.ADVANCED_TWEAKABLES; CONFIRM_MESSAGE_DELETION = GameSettings.CONFIRM_MESSAGE_DELETION; ADVANCED_MESSAGESAPP = GameSettings.ADVANCED_MESSAGESAPP; EXTENDED_BURNTIME = GameSettings.EXTENDED_BURNTIME; ANTI_ALIASING = (AntiAlias)GameSettings.ANTI_ALIASING; TEXTURE_QUALITY = (TextureQuality)GameSettings.TEXTURE_QUALITY; }
/// <summary> /// Loads all settins from player prefs. /// </summary> private void LoadSettings() { PlayerPrefs.GetFloat("MasterVolume", MasterVolume); PlayerPrefs.GetFloat("MusicVolume", MusicVolume); PlayerPrefs.GetFloat("SFXVolume", EffectsVolume); _Resolution = (Resolution)PlayerPrefs.GetInt("Resolution"); _AspectRatio = (AspectRatio)PlayerPrefs.GetInt("AspectRatio"); VSync = PlayerPrefs.GetInt("VSync"); _WindowMode = (WindowMode)PlayerPrefs.GetInt("WindowMode"); _MenuType = (MenuType)PlayerPrefs.GetInt("MenuType"); _TextureQuality = (TextureQuality)PlayerPrefs.GetInt("TextureQuality"); _SchemeIndex = PlayerPrefs.GetInt("GamepadScheme"); Debug.Log("Player Settings Loaded!"); }
bool Load(string contentDir, TextureQuality quality, bool canBeMissing) { string ext = Path.GetExtension(Name); if (String.IsNullOrEmpty(ext)) { Debug.Fail("Texture without extension: " + Name); Name += ".dds"; ext = ".dds"; } string path = Path.Combine(contentDir, Name); if (MyFileSystem.FileExists(path)) { try { if (ext.Equals(".dds", StringComparison.InvariantCultureIgnoreCase)) { this.texture = LoadDDSTexture(path, quality); } else if (ext.Equals(".png", StringComparison.InvariantCultureIgnoreCase)) { this.texture = LoadPNGTexture(path); } else { Debug.Fail("Unsupported texture format: " + path); MyRender.Log.WriteLine(String.Format("Unsupported texture format: {0}", path)); } } catch (SharpDXException e) { MyRender.Log.WriteLine(String.Format("Error decoding texture, file might be corrupt, quality {1}: {0}", path, quality)); } catch (Exception e) { MyRender.Log.WriteLine(String.Format("Error loading texture, quality {1}: {0}", path, quality)); throw new ApplicationException("Error loading texture: " + path, e); } } if (!canBeMissing && this.texture == null) { this.LoadState = LoadState.Error; return(false); } return(true); }
public TextureConvertParameters( UFile sourcePathFromDisk, TextureAsset texture, PlatformType platform, GraphicsPlatform graphicsPlatform, GraphicsProfile graphicsProfile, TextureQuality textureQuality) { SourcePathFromDisk = sourcePathFromDisk; Texture = texture; Platform = platform; GraphicsPlatform = graphicsPlatform; GraphicsProfile = graphicsProfile; TextureQuality = textureQuality; }
public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; IsSRgb = asset.SRgb; DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = asset.Hint; GenerateMipmaps = asset.GenerateMipmaps; PremultiplyAlpha = asset.PremultiplyAlpha; ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
public TextureConvertParameters( UFile sourcePathFromDisk, TextureAsset texture, PlatformType platform, GraphicsPlatform graphicsPlatform, GraphicsProfile graphicsProfile, TextureQuality textureQuality, ColorSpace colorSpace) { SourcePathFromDisk = sourcePathFromDisk; Texture = texture; IsStreamable = texture.IsStreamable; Platform = platform; GraphicsPlatform = graphicsPlatform; GraphicsProfile = graphicsProfile; TextureQuality = textureQuality; ColorSpace = colorSpace; }
public ImportParameters(SpriteSheetAssetCompiler.SpriteSheetParameters spriteSheetParameters) { var asset = spriteSheetParameters.SheetAsset; IsSRgb = asset.SRgb; DesiredSize = new Size2(100, 100); IsSizeInPercentage = true; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = TextureHint.Color; GenerateMipmaps = asset.GenerateMipmaps; PremultiplyAlpha = asset.PremultiplyAlpha; ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = spriteSheetParameters.TextureQuality; GraphicsPlatform = spriteSheetParameters.GraphicsPlatform; GraphicsProfile = spriteSheetParameters.GraphicsProfile; Platform = spriteSheetParameters.Platform; }
public virtual RenderTexture CreateStereoScreen() { float scale = NvrViewer.Instance.StereoScreenScale; int width = (int)recommendedTextureSize[0]; int height = (int)recommendedTextureSize[1]; width = width == 0 ? Screen.width : width; height = height == 0 ? Screen.height : height; bool useDFT = NvrViewer.USE_DTR && !NvrGlobal.supportDtr; float DFT_TextureScale = 0.8f; if (useDFT) { TextureQuality textureQuality = NvrViewer.Instance.TextureQuality; if (textureQuality == TextureQuality.Best) { DFT_TextureScale = 1f; } else if (textureQuality == TextureQuality.Good) { DFT_TextureScale = 0.8f; } else if (textureQuality == TextureQuality.Simple) { DFT_TextureScale = 0.6666666666666666f; } width = (int)(width * DFT_TextureScale); height = (int)(height * DFT_TextureScale); } NvrViewer.Instance.AndroidLog("Creating ss tex " + width + " x " + height + "." + "sInfo : [" + Screen.width + "," + Screen.height + "].DFT_TexScal=" + DFT_TextureScale + ",TexQuality=" + NvrViewer.Instance.TextureQuality.ToString()); var rt = new RenderTexture(width, height, 24, RenderTextureFormat.Default); rt.anisoLevel = 0; rt.antiAliasing = Mathf.Max(QualitySettings.antiAliasing, 1); rt.Create(); return(rt); }
private static int TextureQuality2MasterTextureLimit(TextureQuality textureQuality) { switch (textureQuality) { case TextureQuality.Eighth: return(3); case TextureQuality.Quarter: return(2); case TextureQuality.Half: return(1); case TextureQuality.Full: return(0); default: Debug.LogError("Could not convert texture quality level to int: " + textureQuality + ", defaulting to Half."); return(1); } }
private void EnableDashBoard() { //Debug.Log(CategoryTitle); dashboard.GetComponent <Image>().CrossFadeAlpha(1f, 0.3f, false); CategoryTitle.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Overview.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Inventory.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Config.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Save.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Load.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Exit.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); Language.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); GraphicsQuality.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); TextureQuality.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); FoV.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); QualityValue.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); GQ_LeftArrow.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); GQ_RightArrow.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); LDD_Label.GetComponent <Text>().CrossFadeAlpha(1f, 0.3f, false); DashboardStatus = true; }
public ImportParameters(SpriteSheetAssetCompiler.SpriteSheetParameters spriteSheetParameters) { var asset = spriteSheetParameters.SheetAsset; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = asset.ColorSpace.ToColorSpace(spriteSheetParameters.ColorSpace, TextureHint.Color) == ColorSpace.Linear; DesiredSize = new Size2(100, 100); IsSizeInPercentage = true; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = TextureHint.Color; GenerateMipmaps = asset.GenerateMipmaps; PremultiplyAlpha = asset.PremultiplyAlpha; ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = spriteSheetParameters.TextureQuality; GraphicsPlatform = spriteSheetParameters.GraphicsPlatform; GraphicsProfile = spriteSheetParameters.GraphicsProfile; Platform = spriteSheetParameters.Platform; }
public ImportParameters(TextureConvertParameters textureParameters) { var asset = textureParameters.Texture; // Compute SRgb usage // If Texture is in auto mode, use the global settings, else use the settings overridden by the texture asset. IsSRgb = textureParameters.Texture.ColorSpace.ToColorSpace(textureParameters.ColorSpace, asset.Hint) == ColorSpace.Linear; DesiredSize = new Size2((int)asset.Width, (int)asset.Height); IsSizeInPercentage = asset.IsSizeInPercentage; DesiredFormat = asset.Format; DesiredAlpha = asset.Alpha; TextureHint = asset.Hint; GenerateMipmaps = asset.GenerateMipmaps; PremultiplyAlpha = asset.PremultiplyAlpha; ColorKeyColor = asset.ColorKeyColor; ColorKeyEnabled = asset.ColorKeyEnabled; TextureQuality = textureParameters.TextureQuality; GraphicsPlatform = textureParameters.GraphicsPlatform; GraphicsProfile = textureParameters.GraphicsProfile; Platform = textureParameters.Platform; }
private void DisableDashBoard() { dashboard.GetComponent <Image>().CrossFadeAlpha(0.01f, 0.3f, false); CategoryTitle.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Overview.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Inventory.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Config.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Save.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Load.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Exit.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); PlayedTime.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Reputation.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); Language.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); GraphicsQuality.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); TextureQuality.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); FoV.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); QualityValue.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); GQ_LeftArrow.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); GQ_RightArrow.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); LDD_Label.GetComponent <Text>().CrossFadeAlpha(0.01f, 0.3f, false); LDD_Arrow.GetComponent <Image>().CrossFadeAlpha(0.01f, 0.3f, false); SetUICategoryContent(44); DashboardStatus = false; }
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile, OverrideUpgraderHint overrideHint) { int backBufferWidth = asset.BackBufferWidth ?? 1280; asset.RemoveChild("BackBufferWidth"); int backBufferHeight = asset.BackBufferHeight ?? 720; asset.RemoveChild("BackBufferHeight"); GraphicsProfile profile = asset.DefaultGraphicsProfile ?? GraphicsProfile.Level_9_1; asset.RemoveChild("DefaultGraphicsProfile"); ColorSpace colorSpace = asset.ColorSpace ?? ColorSpace.Linear; asset.RemoveChild("ColorSpace"); DisplayOrientation displayOrientation = asset.DisplayOrientation ?? DisplayOrientation.Default; asset.RemoveChild("DisplayOrientation"); TextureQuality textureQuality = asset.TextureQuality ?? TextureQuality.Fast; asset.RemoveChild("TextureQuality"); var renderingMode = RenderingMode.HDR; if (asset.RenderingMode != null) { if (asset.RenderingMode == "LDR") { renderingMode = RenderingMode.LDR; } } asset.RemoveChild("RenderingMode"); var configurations = new DynamicYamlArray(new YamlSequenceNode()); asset.Defaults = configurations; dynamic renderingSettings = new DynamicYamlMapping(new YamlMappingNode { Tag = "!SiliconStudio.Xenko.Graphics.RenderingSettings,SiliconStudio.Xenko.Graphics" }); renderingSettings.DefaultBackBufferWidth = backBufferWidth; renderingSettings.DefaultBackBufferHeight = backBufferHeight; renderingSettings.DefaultGraphicsProfile = profile; renderingSettings.ColorSpace = colorSpace; renderingSettings.DisplayOrientation = displayOrientation; asset.Defaults.Add(renderingSettings); dynamic editorSettings = new DynamicYamlMapping(new YamlMappingNode { Tag = "!SiliconStudio.Xenko.Assets.EditorSettings,SiliconStudio.Xenko.Assets" }); editorSettings.RenderingMode = renderingMode; asset.Defaults.Add(editorSettings); dynamic textSettings = new DynamicYamlMapping(new YamlMappingNode { Tag = "!SiliconStudio.Xenko.Assets.Textures.TextureSettings,SiliconStudio.Xenko.Assets" }); textSettings.TextureQuality = textureQuality; asset.Defaults.Add(textSettings); dynamic physicsSettings = new DynamicYamlMapping(new YamlMappingNode { Tag = "!SiliconStudio.Xenko.Physics.PhysicsSettings,SiliconStudio.Xenko.Physics" }); asset.Defaults.Add(physicsSettings); var defaultFilters = new DynamicYamlArray(new YamlSequenceNode()); asset.PlatformFilters = defaultFilters; asset.PlatformFilters.Add("PowerVR SGX 54[0-9]"); asset.PlatformFilters.Add("Adreno \\(TM\\) 2[0-9][0-9]"); asset.PlatformFilters.Add("Adreno (TM) 320"); asset.PlatformFilters.Add("Adreno (TM) 330"); asset.PlatformFilters.Add("Adreno \\(TM\\) 4[0-9][0-9]"); asset.PlatformFilters.Add("NVIDIA Tegra"); asset.PlatformFilters.Add("Intel(R) HD Graphics"); asset.PlatformFilters.Add("^Mali\\-4"); asset.PlatformFilters.Add("^Mali\\-T6"); asset.PlatformFilters.Add("^Mali\\-T7"); }
/// <summary> /// Initializes a new instance of the <see cref="CompressingRequest"/> class. /// </summary> /// <param name="format">The compression format.</param> public CompressingRequest(SiliconStudio.Xenko.Graphics.PixelFormat format, TextureQuality quality = TextureQuality.Fast) { this.Format = format; this.Quality = quality; }
/// <summary> /// Do actions based on current active scene. /// </summary> private void SwitchSettings() { switch (CurrentSelection) { case "MenuType": if (gamepad.GetButtonDown("RB")) { if (_MenuType < MenuType.WINDOW) { _MenuType++; } else { _MenuType = 0; } PlayerPrefs.SetInt("MenuType", (int)_MenuType); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { if (_MenuType > MenuType.RADIAL) { _MenuType--; } else { _MenuType = MenuType.WINDOW;; } UpdateTextAndApplySettings(); PlayerPrefs.SetInt("MenuType", (int)_MenuType); PlayerPrefs.Save(); } break; case "WindowMode": if (gamepad.GetButtonDown("RB")) { if (_WindowMode < WindowMode.WINDOWED) { _WindowMode++; } else { _WindowMode = 0; } PlayerPrefs.SetInt("WindowMode", (int)_WindowMode); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { if (_WindowMode > WindowMode.FULLSCREEN) { _WindowMode--; } else { _WindowMode = WindowMode.WINDOWED; } PlayerPrefs.SetInt("WindowMode", (int)_WindowMode); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "Resolution": if (gamepad.GetButtonDown("RB")) { PlayerPrefs.SetInt("Resolution", (int)_Resolution); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { PlayerPrefs.SetInt("Resolution", (int)_Resolution); PlayerPrefs.Save(); } break; case "AspectRatio": if (gamepad.GetButtonDown("RB")) { if (_AspectRatio < AspectRatio.FIVE_FOUR) { _AspectRatio++; } else { _AspectRatio = AspectRatio.SIXTEEN_NINE; } PlayerPrefs.SetInt("AspectRatio", (int)_AspectRatio); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { if (_AspectRatio > AspectRatio.SIXTEEN_NINE) { _AspectRatio--; } else { _AspectRatio = AspectRatio.FIVE_FOUR; } PlayerPrefs.SetInt("AspectRatio", (int)_AspectRatio); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "VSync": if (gamepad.GetButtonDown("RB")) { if (VSync == 0) { VSync = 1; } else if (VSync == 1) { VSync = 0; } PlayerPrefs.SetInt("VSync", VSync); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { if (VSync == 0) { VSync = 1; } else if (VSync == 1) { VSync = 0; } PlayerPrefs.SetInt("VSync", VSync); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "TextureQuality": if (gamepad.GetButtonDown("RB")) { if (_TextureQuality < TextureQuality.ULTRA) { _TextureQuality++; } else { _TextureQuality = 0; } PlayerPrefs.SetInt("TextureQuality", (int)_TextureQuality); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButtonDown("LB")) { if (_TextureQuality > TextureQuality.VERY_LOW) { _TextureQuality--; } else { _TextureQuality = TextureQuality.ULTRA; } PlayerPrefs.SetInt("TextureQuality", (int)_TextureQuality); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "MasterVolume": if (gamepad.GetButton("LB")) { if (MasterVolume > 0) { MasterVolume--; } PlayerPrefs.SetFloat("MasterVolume", MasterVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButton("RB")) { if (MasterVolume < 100) { MasterVolume++; } PlayerPrefs.SetFloat("MasterVolume", MasterVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "MusicVolume": if (gamepad.GetButton("LB")) { if (MusicVolume > 0) { MusicVolume--; } PlayerPrefs.SetFloat("MusicVolume", MusicVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButton("RB")) { if (MusicVolume < 100) { MusicVolume++; } PlayerPrefs.SetFloat("MusicVolume", MusicVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; case "SFXVolume": if (gamepad.GetButton("LB")) { if (EffectsVolume > 0) { EffectsVolume--; } PlayerPrefs.SetFloat("SFXVolume", EffectsVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } else if (gamepad.GetButton("RB")) { if (EffectsVolume < 100) { EffectsVolume++; } PlayerPrefs.SetFloat("SFXVolume", EffectsVolume); UpdateTextAndApplySettings(); PlayerPrefs.Save(); } break; default: break; } }
/// <summary> /// Reloads this instance. /// </summary> internal bool Load(TextureQuality quality = 0, bool canBeMissing = false) { // TODO: !PetrM fix skipping mipmaps quality = 0; Debug.Assert(this.LoadState != LoadState.Loaded); bool loaded = false; if (!string.IsNullOrEmpty(ContentDir)) loaded = Load(ContentDir, quality, canBeMissing); if (!loaded) loaded = Load(MyFileSystem.ContentPath, quality, canBeMissing); if (loaded && this.texture != null) { this.texture.DebugName = this.Name + " (Render)"; this.LoadState = LoadState.Loaded; OnLoaded(); } return loaded; }
public static Texture2D resize(Texture2D input, TextureQuality quality, GraphicsDevice e) { #region declaration_and_assignment Texture2D new_texture; //define the varible that will hold the new texture data Color[] pixelArray_old, pixelArray_new; //define the color array's for the new (and old) texture int new_width, new_height; //define variables for the width and height of the new texture float scaleFactor = 1; if (quality == TextureQuality.high) { scaleFactor = 1; } if (quality == TextureQuality.medium) { scaleFactor = .5f; } if (quality == TextureQuality.low) { scaleFactor = .25f; } if (quality == TextureQuality.lowest) { scaleFactor = .1f; } new_width = Convert.ToInt32(input.Width * scaleFactor); //assign new resolution based on scalefactor new_height = Convert.ToInt32(input.Height * scaleFactor); pixelArray_old = new Color[input.Width * input.Height]; pixelArray_new = new Color[new_width * new_height]; //define the pixel array for the new texture input.GetData<Color>(pixelArray_old); //assign values to the array #endregion int x = 0, y = 0; for (int i = 0; i != pixelArray_new.Length; i++) { pixelArray_new[i] = pixelArray_old[x + y]; x += Convert.ToInt32(1 / scaleFactor); if (x >= input.Width) { y += Convert.ToInt32(input.Width * (1 / scaleFactor)); x = Convert.ToInt32((1 / scaleFactor) - 1); } } new_texture = new Texture2D(e, new_width, new_height); new_texture.SetData<Color>(pixelArray_new); //assign to texture return new_texture; }
/// <summary> /// 设置是否开启纹理的各项异性 /// </summary> /// <param name="bEnable"></param> public static void SetTextureAniso(TextureQuality quality) { QualitySettings.anisotropicFiltering = quality >= TextureQuality.High ? AnisotropicFiltering.ForceEnable : AnisotropicFiltering.Disable; }
/// <summary> /// Loads the DDS texture. /// </summary> /// <param name="name">The name.</param> /// <param name="quality"></param> /// <returns></returns> protected abstract SharpDX.Direct3D9.BaseTexture LoadDDSTexture(string name, TextureQuality quality);
public virtual RenderTexture CreateStereoScreen(int w, int h) { int width = w > 0 ? w : (int)recommendedTextureSize[0]; int height = h > 0 ? h : (int)recommendedTextureSize[1]; width = width == 0 ? Screen.width : width; height = height == 0 ? Screen.height : height; bool useDFT = NxrViewer.USE_DTR && !NxrGlobal.supportDtr; float DFT_TextureScale = 0.8f; if (useDFT) { TextureQuality textureQuality = NxrViewer.Instance.TextureQuality; if (NxrGlobal.offaxisDistortionEnabled) { // textureQuality = TextureQuality.Best; } if (textureQuality == TextureQuality.Best) { DFT_TextureScale = 1f; } else if (textureQuality == TextureQuality.Good) { DFT_TextureScale = 0.75f; } else if (textureQuality == TextureQuality.Simple) { DFT_TextureScale = 0.6666666666666666f; } else if (textureQuality == TextureQuality.Better) { DFT_TextureScale = 0.8f; } width = (int)(width * DFT_TextureScale); height = (int)(height * DFT_TextureScale); } Debug.Log("antiAliasing." + QualitySettings.antiAliasing + "," + (int)NxrViewer.Instance.TextureMSAA); var rt = new RenderTexture(width, height, 24, RenderTextureFormat.Default); rt.anisoLevel = 0; int antiAliasing = Mathf.Max(QualitySettings.antiAliasing, (int)NxrViewer.Instance.TextureMSAA); if (NxrGlobal.isVR9Platform) { antiAliasing = 1; } rt.antiAliasing = antiAliasing < 1 ? 1 : antiAliasing; rt.Create(); NxrViewer.Instance.AndroidLog("Creating ss tex " + width + " x " + height + "." + "sInfo : [" + Screen.width + "," + Screen.height + "].DFT_TexScal=" + DFT_TextureScale + ",TexQuality=" + NxrViewer.Instance.TextureQuality.ToString() + ", Id=" + rt.GetNativeTexturePtr() + ", MSAA=" + rt.antiAliasing); return(rt); }
public static void ChangeQuality(ContentManager content, TextureQuality q) { TEXTURE_QUALITY = q; LoadContent(content); }
/// <summary> /// Reloads this instance. /// </summary> internal bool Load(TextureQuality quality = 0) { Debug.Assert(this.LoadState != LoadState.Loaded); MyMwcLog.WriteLine(string.Format("Loading texture {0} ...", this.Name), SysUtils.LoggingOptions.LOADING_TEXTURES); var ddsTexture = new FileInfo(MyMinerGame.Static.RootDirectory + "\\" + this.Name + ".dds"); // System.Diagnostics.Debug.Assert(ddsTexture.Exists); if (ddsTexture.Exists) { this.texture = LoadDDSTexture(ddsTexture.FullName, quality);// : LoadXNATexture(this.Name); } else { var pngTexture = new FileInfo(MyMinerGame.Static.RootDirectory + "\\" + this.Name + ".png"); if (pngTexture.Exists) { this.texture = LoadPNGTexture(pngTexture.FullName);// : LoadXNATexture(this.Name); } else { this.LoadState = LoadState.Error; string s = "Texture " + this.Name + " is missing."; System.Diagnostics.Debug.Assert(pngTexture.Exists, s); return false; } } if (this.texture == null) { this.LoadState = LoadState.Error; return false; } this.texture.DebugName = this.Name; this.LoadState = LoadState.Loaded; // if (Name.Contains("Textures\\GUI\\Loading")) // { //} UpdateProperties(texture); MyMwcLog.WriteLine(string.Format("Texture {0} loaded", this.Name), SysUtils.LoggingOptions.LOADING_TEXTURES); OnLoaded(); return true; }
bool Load(string contentDir, TextureQuality quality, bool canBeMissing) { string ext = Path.GetExtension(Name); if (String.IsNullOrEmpty(ext)) { Debug.Fail("Texture without extension: " + Name); Name += ".dds"; ext = ".dds"; } string path = Path.Combine(contentDir, Name); if (MyFileSystem.FileExists(path)) { try { if (ext.Equals(".dds", StringComparison.InvariantCultureIgnoreCase)) { this.texture = LoadDDSTexture(path, quality); } else if (ext.Equals(".png", StringComparison.InvariantCultureIgnoreCase)) { this.texture = LoadPNGTexture(path); } else { Debug.Fail("Unsupported texture format: " + path); MyRender.Log.WriteLine(String.Format("Unsupported texture format: {0}", path)); } } catch (SharpDXException ) { MyRender.Log.WriteLine(String.Format("Error decoding texture, file might be corrupt, quality {1}: {0}", path, quality)); } catch (Exception e) { MyRender.Log.WriteLine(String.Format("Error loading texture, quality {1}: {0}", path, quality)); throw new ApplicationException("Error loading texture: " + path, e); } } if (!canBeMissing && this.texture == null) { this.LoadState = LoadState.Error; return false; } return true; }
private void SetUICategoryContent(int Category) { switch (Category) { default: PlayedTime.SetActive(true); Reputation.SetActive(true); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); FoVSliderValue.SetActive(false); break; case 1: PlayedTime.SetActive(true); Reputation.SetActive(true); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); FoVSliderValue.SetActive(false); break; case 2: PlayedTime.SetActive(false); Reputation.SetActive(false); Language.SetActive(true); GraphicsQuality.SetActive(true); TextureQuality.SetActive(true); FoV.SetActive(true); GQ_LeftArrow.SetActive(true); GQ_RightArrow.SetActive(true); LDD.SetActive(true); FoVSliderValue.SetActive(true); break; case 3: PlayedTime.SetActive(false); Reputation.SetActive(false); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); FoVSliderValue.SetActive(false); break; case 4: PlayedTime.SetActive(false); Reputation.SetActive(false); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); FoVSliderValue.SetActive(false); break; case 5: PlayedTime.SetActive(false); Reputation.SetActive(false); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); break; case 44: PlayedTime.SetActive(false); Reputation.SetActive(false); Language.SetActive(false); GraphicsQuality.SetActive(false); TextureQuality.SetActive(false); FoV.SetActive(false); GQ_LeftArrow.SetActive(false); GQ_RightArrow.SetActive(false); LDD.SetActive(false); FoVSliderValue.SetActive(false); break; } }
/// <summary> /// Compresses the specified image into the specified format. /// </summary> /// <remarks> /// If the image is in a compressed format, it will be first decompressed. /// If the compressing library doesn't support BGRA order and the current image format is in this order, the channels R and B will be switched. /// </remarks> /// <param name="image">The image.</param> /// <param name="format">The format.</param> public void Compress(TexImage image, PixelFormat format, TextureQuality quality = TextureQuality.Fast) { if (image.Format == format) return; if (image.Format.IsCompressed()) { Log.Warning("You can't compress an already compressed texture. It will be decompressed first.."); Decompress(image, format.IsSRgb()); } var request = new CompressingRequest(format, quality); ExecuteRequest(image, request); }
/// <summary> /// Initializes a new instance of the <see cref="CompressingRequest"/> class. /// </summary> /// <param name="format">The compression format.</param> public CompressingRequest(Stride.Graphics.PixelFormat format, TextureQuality quality = TextureQuality.Fast) { this.Format = format; this.Quality = quality; }