ActiveTextureManagement.TextureConverter.InitImageBuffer C# (CSharp) Метод

InitImageBuffer() публичный статический Метод

public static InitImageBuffer ( ) : void
Результат void
        public static void InitImageBuffer()
        {
            if (imageBuffer == null)
            {
                imageBuffer = new byte[MAX_IMAGE_SIZE];
            }
        }

Usage Example

Пример #1
0
        public static TextureInfoWrapper DDSToTexture(TexInfo Texture, bool mipmaps, bool isCompressed, bool hasAlpha)
        {
            TextureConverter.InitImageBuffer();
            FileStream imgStream = new FileStream(Texture.filename, FileMode.Open, FileAccess.Read);

            imgStream.Position = 0;
            imgStream.Read(imageBuffer, 0, MAX_IMAGE_SIZE);
            imgStream.Close();

            TextureFormat format = TextureFormat.DXT1;

            if (hasAlpha && isCompressed)
            {
                format = TextureFormat.DXT5;
            }
            else if (hasAlpha)
            {
                format = TextureFormat.RGBA32;
            }
            else if (!isCompressed)
            {
                format = TextureFormat.RGB24;
            }

            Texture2D newTex = new Texture2D(Texture.width, Texture.height, format, mipmaps);

            newTex.LoadRawTextureData(imageBuffer);
            newTex.Apply(false, Texture.makeNotReadable);
            newTex.name = Texture.name;

            TextureInfoWrapper newTexInfo = new TextureInfoWrapper(newTex, Texture.isNormalMap, !Texture.makeNotReadable, isCompressed);

            newTexInfo.name = Texture.name;
            return(newTexInfo);
        }
All Usage Examples Of ActiveTextureManagement.TextureConverter::InitImageBuffer