// Rebinds the texture to accomidate the gui component public void rebindTexture(TexCoord topLeft, TexCoord bottomRight) { texcoords[0]= new TexCoord(topLeft.u, 1f-topLeft.v); texcoords[1]= new TexCoord(topLeft.u, 1f-bottomRight.v); texcoords[2]= new TexCoord(bottomRight.u, 1f-bottomRight.v); texcoords[3]= new TexCoord(bottomRight.u, 1f-topLeft.v); }
public GUISprite(Point2f pos, Size2f size) { vertices= new Point3f[4]; texcoords= new TexCoord[4]; colors= new Color[4]; faces= new ushort[6]; vertices[0]= new Point3f(pos.x, pos.y, 0f); vertices[1]= new Point3f(pos.x, pos.y+size.height, 0f); vertices[2]= new Point3f(pos.x+size.width, pos.y+size.height, 0f); vertices[3]= new Point3f(pos.x+size.width, pos.y, 0f); texcoords[0]= new TexCoord(0f, 0f); texcoords[1]= new TexCoord(0f, 1f); texcoords[2]= new TexCoord(1f, 1f); texcoords[3]= new TexCoord(1f, 0f); applyColor(new Color(255, 255, 255, 255)); faces[0]= 0; faces[1]= 1; faces[2]= 3; faces[3]= 1; faces[4]= 2; faces[5]= 3; bvolume= new BVRectangle(pos, pos+size); comp= null; tb= new Rectangle(0f, 0f, 1f, 1f); }
public QMesh(Point3f[] v, TexCoord[] uvs, Color c, ushort[] f) : base() { vertices= v; texcoords= uvs; colors= new Color[v.Length]; applyColor(c); faces= f; }
internal QMesh(Point3f[] v, TexCoord[] t, Color[] c, ushort[] f, Matrix m, Texture tx, string n, Bone[] pmBones, bool outline) : base(Matrix.IDENTITY, pmBones) { vertices= v; texcoords= t; colors= c; faces= f; pMatrix= m; pTexture= tx; name= n; bRenderOutline= outline; }
public GUISprite() { vertices= new Point3f[4]; texcoords= new TexCoord[4]; colors= new Color[4]; faces= new ushort[6]; for(int i= 0; i< vertices.Length; i++) vertices[i]= Point3f.ORIGIN; texcoords[0]= new TexCoord(0f, 0f); texcoords[1]= new TexCoord(0f, 1f); texcoords[2]= new TexCoord(1f, 1f); texcoords[3]= new TexCoord(1f, 0f); colors[0]= new Color(1f); colors[1]= new Color(1f); colors[2]= new Color(1f); colors[3]= new Color(1f); faces[0]= 0; faces[1]= 1; faces[2]= 3; faces[3]= 1; faces[4]= 2; faces[5]= 3; bvolume= null; }
// Sets the texture bounds for rendering without calling the event internal void setTextureBounds(Rectangle rect) { tb= rect; if(texture.WIDTH!= 0 && texture.HEIGHT!= 0) { texcoords[0]= new TexCoord(rect.x, rect.y, texture); texcoords[1]= new TexCoord(rect.x, rect.y+rect.height, texture); texcoords[2]= new TexCoord(rect.x+rect.width, rect.y+rect.height, texture); texcoords[3]= new TexCoord(rect.x+rect.width, rect.y, texture); } }
// Finds if the two texture coordinates are equal public bool equals(TexCoord texCoord) { return (u== texCoord.u && v== texCoord.v); }