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); }
// Resizes the sprite to accomidate the gui component public void resize(Point2i pt, Size2i size) { vertices[0]= new Point3f(pt.x, pt.y, 0f); vertices[1]= new Point3f(pt.x, pt.y+size.height, 0f); vertices[2]= new Point3f(pt.x+size.width, pt.y+size.height, 0f); vertices[3]= new Point3f(pt.x+size.width, pt.y, 0f); bvolume= new BVBox(pt.toPoint3f(), (pt+size).toPoint3f()); }
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; }
public Rectangle(Point2f pmPos, Size2f pmSize) { pPos= pmPos; pSize= pmSize; bvolume= new BVRectangle(pPos, pPos+pSize); }
// Resets the bounding volume private void resetBVolume() { bvolume= new BVRectangle(pPos, pPos+pSize); }
// Finds if the two bounding volumes intersect each other public override bool intersects(ref BoundingVolume collider) { if(collider== null) return false; if(collider is BVCircle) { // Variables BVCircle circ= (BVCircle)collider; return intersects(ref circ); } if(collider is BVRectangle) { // Variables BVRectangle rect= (BVRectangle)collider; return intersects(ref rect); } return false; }
public LMesh(BoundingVolume bv) : this(bv, new Color(1f, 0f, 0f)) { }
public LMesh(BoundingVolume bv, Color c) : this(bv.points, c, bv.getRendableLineIndices()) { }
// Finds if the two bounding volumes intersect each other public override bool intersects(ref BoundingVolume collider) { return false; }
// Sets the bounds for rendering without calling the event internal void setBounds(Rectangle rect) { vertices[0]= new Point3f(rect.x, rect.y, 0f); vertices[1]= new Point3f(rect.x, rect.y+rect.height, 0f); vertices[2]= new Point3f(rect.x+rect.width, rect.y+rect.height, 0f); vertices[3]= new Point3f(rect.x+rect.width, rect.y, 0f); bvolume= new BVRectangle(rect.x, rect.y, rect.width, rect.height); }
// Finds if the two bounding volumes intersect each other public override bool intersects(ref BoundingVolume collider) { if(collider== null) return false; if(collider is BVCylinder) { // Variables BVCylinder cyln= (BVCylinder)collider; return intersects(ref cyln); } if(collider is BVBox) { // Variables BVBox bbox= (BVBox)collider; return intersects(ref bbox); } return false; }
public virtual bool intersects(BoundingVolume collider) { return intersects(ref collider); }
// Finds if the two bounding volumes intersect each other public abstract bool intersects(ref BoundingVolume collider);
public Circle(Point2f pmPos, float pmRadius) { pPos= pmPos; pRadius= Math.Abs(pmRadius); bvolume= new BVCircle(pPos, pmRadius); }
// Resets the bounding volume public void resetBVolume() { bvolume= new BVCircle(pPos, pRadius); }