/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="numMipMaps"></param> /// <param name="gamma"></param> /// <param name="priority"></param> /// <returns></returns> public Texture Load(string name, TextureType type, int numMipMaps, float gamma, bool isAlpha) { // does this texture exist already? Texture texture = GetByName(name); if (texture == null) { // create a new texture texture = (Texture)Create(name); texture.TextureType = type; if (numMipMaps == -1) { texture.NumMipMaps = defaultNumMipMaps; } else { texture.NumMipMaps = numMipMaps; } // set bit depth and gamma texture.Gamma = gamma; if (isAlpha) { texture.Format = PixelFormat.A8; } texture.Enable32Bit(is32Bit); } // The old code called the base class load method, but now we just call texture.Load() // base.Load(texture, 1); texture.Load(); return(texture); }
/// <summary> /// Populate an incoming list with shadow texture references as requested /// in the configuration list. /// </summary> public void GetShadowTextures(List <ShadowTextureConfig> configList, List <Texture> listToPopulate) { listToPopulate.Clear(); List <Texture> usedTextures = new List <Texture>(); foreach (ShadowTextureConfig config in configList) { bool found = false; foreach (Texture tex in textureList) { // Skip if already used this one if (usedTextures.Contains(tex)) { continue; } if (config.width == tex.Width && config.height == tex.Height && config.format == tex.Format) { // Ok, a match listToPopulate.Add(tex); usedTextures.Add(tex); found = true; break; } } if (!found) { // Create a new texture string baseName = "Axiom/ShadowTexture"; string targName = baseName + count++; Texture shadowTex = TextureManager.Instance.CreateManual( targName, TextureType.TwoD, config.width, config.height, 1, 0, config.format, TextureUsage.RenderTarget); // Ensure texture loaded shadowTex.Load(); listToPopulate.Add(shadowTex); usedTextures.Add(shadowTex); textureList.Add(shadowTex); } } }