示例#1
0
        private bool copyToAtlas(int row, int column, string file)
        {
            int rowStart    = 1 + (256 + 1) * row;
            int columnStart = 1 + (256 + 1) * column;

            var imageDataLoader = new ImageDataLoader(file);

            if (imageDataLoader.Height != 256 || imageDataLoader.Width != 256)
            {
                return(false);
            }

            for (int i = 0; i < 256; i++)
            {
                for (int j = 0; j < 256; j++)
                {
                    setPixel(columnStart + j, rowStart + i, imageDataLoader.Data[j, i]);
                }
            }

            string fileName    = Path.GetFileName(file);
            Point  topLeft     = new Point(columnStart, rowStart);
            Point  bottomRight = new Point(columnStart + 256, rowStart + 256);

            _textureDictionary[fileName] = CreateUVCoordinates(topLeft, bottomRight);

            return(true);
        }
示例#2
0
        public CubeMap(List <string> faces)
        {
            GL.GenTextures(1, out int textureID);
            _textureID = textureID;

            GL.BindTexture(TextureTarget.TextureCubeMap, _textureID);
            for (int i = 0; i < 6; i++)
            {
                var imageDataLoader = new ImageDataLoader(faces[i]);

                var textureTarget = TextureTarget.TextureCubeMapPositiveX + i;
                GL.TexImage2D(textureTarget, 0, PixelInternalFormat.Rgba,
                              imageDataLoader.Width, imageDataLoader.Height, 0,
                              PixelFormat.Bgra, PixelType.UnsignedByte, imageDataLoader.Data);
            }

            GL.TextureParameter(_textureID, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TextureParameter(_textureID, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            GL.TextureParameter(_textureID, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
            GL.TextureParameter(_textureID, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);
        }
示例#3
0
    public bool LoadImages()
    {
        Bundles = ImageDataLoader.LoadBundles();

        return(true);
    }
示例#4
0
 public void UiEvent_RemoveDownloadedBundles()
 {
     ImageDataLoader.RemoveDownloadedBundles();
 }