Beispiel #1
0
        public void LoadVbos()
        {
            vbos = new Vbo[row * col];
            ushort[] elements = { 0, 1, 2, 1, 2, 3 };

            for (int i = 0, k = 0; i < row; i++)
            {
                for (int j = 0; j < col && k < count; j++, k++)
                {
                    vbos[i] = new Vbo(new Vertex[]
                    {
                        new Vertex(new Vector2(j * (width + spacing), i * (height + spacing)), new Vector2(j * (width + spacing) / (float)spriteWidth, i * (height + spacing) / (float)spriteHeight)),
                        new Vertex(new Vector2((j + 1) * (width + spacing) - spacing, i * (height + spacing)), new Vector2(((j + 1) * (width + spacing) - spacing) / (float)spriteWidth, i * (height + spacing) / (float)spriteHeight)),
                        new Vertex(new Vector2(j * (width + spacing), (i + 1) * (height + spacing) - spacing), new Vector2(j * (width + spacing) / (float)spriteWidth, ((i + 1) * (height + spacing) - spacing) / (float)spriteHeight)),
                        new Vertex(new Vector2((j + 1) * (width + spacing) - spacing, (i + 1) * (height + spacing) - spacing), new Vector2(((j + 1) * (width + spacing) - spacing) / (float)spriteWidth, ((i + 1) * (height + spacing) - spacing) / (float)spriteHeight))
                    }, elements);
                }
            }
        }
Beispiel #2
0
 public SpriteFrame(Vbo vbo, uint texture)
     : this()
 {
     this.vbo = vbo;
     this.texture = texture;
 }