示例#1
0
        public static BaseTexture FromPool(string name)
        {
            if (BaseTexture.ExistsInPool(name))
            {
                return(null);
            }

            return(BaseTexture.TexturePool[name]);
        }
示例#2
0
        public static BaseTexture FromBuffer(BaseDevice device, BaseTextureDesc desc, uint[] buffer, bool resample = false)
        {
            if (BaseTexture.ExistsInPool(desc.Name))
            {
                return(BaseTexture.TexturePool[desc.Name]);
            }

            var texture = ( BaseTexture )Activator.CreateInstance(device.TextureType, device, desc);

            texture.Initialise(buffer);
            texture.Upload(resample);

            return(texture);
        }
示例#3
0
        public static BaseTexture FromBuffer(BaseDevice device, string identifier, uint[] buffer, int width, int height, bool hasMipMap, bool hasAlpha, string filter = "GL_LINEAR_MIPMAP_NEAREST", string blendMode = "", bool isLightMap = false)
        {
            if (BaseTexture.ExistsInPool(identifier))
            {
                return(BaseTexture.TexturePool[identifier]);
            }

            var desc = ( BaseTextureDesc )Activator.CreateInstance(device.TextureDescType);

            desc.Name       = identifier;
            desc.HasAlpha   = hasAlpha;
            desc.Width      = width;
            desc.Height     = height;
            desc.HasMipMap  = hasMipMap;
            desc.Filter     = filter;
            desc.BlendMode  = blendMode;
            desc.IsLightMap = isLightMap;

            return(BaseTexture.FromBuffer(device, desc, buffer));
        }