public virtual void DrawWireFrame(OpenGL gl) { PointFloat[] pointData = RenderLogics.RectPoint(_pos, _size, _rot); gl.Begin(OpenGL.GL_LINES); gl.Color(1f, 1f, 1f); gl.Vertex(pointData[1].x, pointData[1].y); gl.Vertex(pointData[0].x, pointData[0].y); gl.Vertex(pointData[0].x, pointData[0].y); gl.Vertex(pointData[3].x, pointData[3].y); gl.Vertex(pointData[3].x, pointData[3].y); gl.Vertex(pointData[2].x, pointData[2].y); gl.Vertex(pointData[2].x, pointData[2].y); gl.Vertex(pointData[1].x, pointData[1].y); gl.End(); }
public virtual void Draw(OpenGL gl) { PointFloat[] pointData = RenderLogics.RectPoint(_pos, _size, _rot); _texture.UseTexure(gl); gl.Begin(OpenGL.GL_QUADS); gl.Color(_color[0], _color[1], _color[2]); gl.TexCoord(0, 0); gl.Vertex(pointData[1].x, pointData[1].y); gl.TexCoord(0, 1); gl.Vertex(pointData[0].x, pointData[0].y); gl.TexCoord(1, 1); gl.Vertex(pointData[3].x, pointData[3].y); gl.TexCoord(1, 0); gl.Vertex(pointData[2].x, pointData[2].y); gl.End(); }
private static bool IsInBox(PointFloat pos1, PointFloat pos2, PointFloat size1, PointFloat size2) { if (Math.Abs(pos1.x - pos2.x) + Math.Abs(pos1.y - pos2.y) > 10) { //return false; } bool a = false; PointFloat[] points1 = RenderLogics.RectPoint(pos1, size1, 0.0f); PointFloat[] points2 = RenderLogics.RectPoint(pos2, size2, 0.0f); foreach (PointFloat point1 in points1) { if (InRange(point1.x, points2[3].x, points2[1].x) && InRange(point1.y, points2[3].y, points2[1].y)) { a = true; } } return(a); }