public void Parse(ConfigurationSection sect) { string dayTexFile = sect.GetString("DayTexture", null); if (dayTexFile != null) { FileLocation fl = FileSystem.Instance.Locate(dayTexFile, FileLocateRules.Default); dayTex = CubeTexture.FromStream(device, fl.GetStream, Usage.None, Pool.Managed); } string nightTexFile = sect.GetString("NightTexture", null); if (nightTexFile != null) { FileLocation fl = FileSystem.Instance.Locate(nightTexFile, FileLocateRules.Default); nightTex = CubeTexture.FromStream(device, fl.GetStream, Usage.None, Pool.Managed); } }
/// <summary> /// 从ResourceLocation加载天空盒纹理 /// </summary> /// <param name="dayTexture"></param> /// <param name="nightTexture"></param> public void LoadTexture(ResourceLocation dayTexture, ResourceLocation nightTexture) { if (dayTexture != null) { if (dayTex != null) { dayTex.Dispose(); dayTex = null; } this.dayTex = CubeTexture.FromStream(device, dayTexture.GetStream, Usage.None, Pool.Managed); } if (nightTexture != null) { if (nightTex != null) { nightTex.Dispose(); nightTex = null; } this.nightTex = CubeTexture.FromStream(device, nightTexture.GetStream, Usage.None, Pool.Managed); } }