Art LoadArtInternal(BitmapBuffer tex) { AssertIsOpen(true); Art a = new Art(this); ArtLooseTextureAssociation[a] = tex; ManagedArts.Add(a); return a; }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { //TEST: d3d shouldnt ever use this, it was a gl hack. maybe we can handle it some other way in gl (fix the projection? take a render-to-texture arg to the gui view transforms?) fy = false; float u0, v0, u1, v1; if (fx) { u0 = art.u1; u1 = art.u0; } else { u0 = art.u0; u1 = art.u1; } if (fy) { v0 = art.v1; v1 = art.v0; } else { v0 = art.v0; v1 = art.v1; } float[] data = new float[32] { x, y, u0, v0, CornerColors[0].R, CornerColors[0].G, CornerColors[0].B, CornerColors[0].A, x + art.Width, y, u1, v0, CornerColors[1].R, CornerColors[1].G, CornerColors[1].B, CornerColors[1].A, x, y + art.Height, u0, v1, CornerColors[2].R, CornerColors[2].G, CornerColors[2].B, CornerColors[2].A, x + art.Width, y + art.Height, u1, v1, CornerColors[3].R, CornerColors[3].G, CornerColors[3].B, CornerColors[3].A, }; Texture2d tex = art.BaseTexture; PrepDrawSubrectInternal(tex); fixed(float *pData = &data[0]) { Owner.BindArrayData(pData); Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); } }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { float u0, v0, u1, v1; if (fx) { u0 = art.u1; u1 = art.u0; } else { u0 = art.u0; u1 = art.u1; } if (fy) { v0 = art.v1; v1 = art.v0; } else { v0 = art.v0; v1 = art.v1; } float[] data = new float[32] { x, y, u0, v0, CornerColors[0].R, CornerColors[0].G, CornerColors[0].B, CornerColors[0].A, x + art.Width, y, u1, v0, CornerColors[1].R, CornerColors[1].G, CornerColors[1].B, CornerColors[1].A, x, y + art.Height, u0, v1, CornerColors[2].R, CornerColors[2].G, CornerColors[2].B, CornerColors[2].A, x + art.Width, y + art.Height, u1, v1, CornerColors[3].R, CornerColors[3].G, CornerColors[3].B, CornerColors[3].A, }; Texture2d tex = art.BaseTexture; PrepDrawSubrectInternal(tex); fixed(float *pData = &data[0]) { Owner.BindArrayData(pData); Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); } }
public void DrawFlipped(Art art, bool xflip, bool yflip) { DrawInternal(art, 0, 0, art.Width, art.Height, xflip, yflip); }
public void Draw(Art art, float x, float y, float width, float height) { DrawInternal(art, x, y, width, height, false, false); }
public void Draw(Art art, Vector2 pos) { DrawInternal(art, pos.X, pos.Y, art.Width, art.Height, false, false); }
public void Draw(Art art) { DrawInternal(art, 0, 0, art.Width, art.Height, false, false); }
public void Draw(Art art, float x, float y) { DrawInternal(art, x, y, art.Width, art.Height, false, false); }
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h) { Art art = new Art(null); art.Width = w; art.Height = h; art.u0 = art.v0 = 0; art.u1 = art.v1 = 1; art.BaseTexture = tex; DrawInternal(art, x, y, w, h, false, tex.IsUpsideDown); }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { //TEST: d3d shouldnt ever use this, it was a gl hack. maybe we can handle it some other way in gl (fix the projection? take a render-to-texture arg to the gui view transforms?) fy = false; float u0, v0, u1, v1; if (fx) { u0 = art.u1; u1 = art.u0; } else { u0 = art.u0; u1 = art.u1; } if (fy) { v0 = art.v1; v1 = art.v0; } else { v0 = art.v0; v1 = art.v1; } float[] data = new float[32] { x,y, u0,v0, CornerColors[0].R, CornerColors[0].G, CornerColors[0].B, CornerColors[0].A, x+art.Width,y, u1,v0, CornerColors[1].R, CornerColors[1].G, CornerColors[1].B, CornerColors[1].A, x,y+art.Height, u0,v1, CornerColors[2].R, CornerColors[2].G, CornerColors[2].B, CornerColors[2].A, x+art.Width,y+art.Height, u1,v1, CornerColors[3].R, CornerColors[3].G, CornerColors[3].B, CornerColors[3].A, }; Texture2d tex = art.BaseTexture; PrepDrawSubrectInternal(tex); fixed (float* pData = &data[0]) { Owner.BindArrayData(pData); Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); } }
unsafe void DrawInternal(Art art, float x, float y, float w, float h) { DrawInternal(art.BaseTexture, x, y, w, h, art.u0, art.v0, art.u1, art.v1); }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { float u0,v0,u1,v1; if(fx) { u0 = art.u1; u1 = art.u0; } else { u0 = art.u0; u1 = art.u1; } if(fy) { v0 = art.v1; v1 = art.v0; } else { v0 = art.v0; v1 = art.v1; } float[] data = new float[32] { x,y, u0,v0, CornerColors[0].R, CornerColors[0].G, CornerColors[0].B, CornerColors[0].A, x+art.Width,y, u1,v0, CornerColors[1].R, CornerColors[1].G, CornerColors[1].B, CornerColors[1].A, x,y+art.Height, u0,v1, CornerColors[2].R, CornerColors[2].G, CornerColors[2].B, CornerColors[2].A, x+art.Width,y+art.Height, u1,v1, CornerColors[3].R, CornerColors[3].G, CornerColors[3].B, CornerColors[3].A, }; Texture2d tex = art.BaseTexture; PrepDrawSubrectInternal(tex); fixed (float* pData = &data[0]) { Owner.BindArrayData(pData); Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); } }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { }