// draw the material. static public void DrawMat(MatEx mat, GlViewPortEx viewPort) { viewPort.SetDrawColor(Color.White); viewPort.SetLineWidth(1); if (mat.GetMatType() == MAT_TYPE_EX.MAT_EX_RECT) { RectMatEx rectMat = (RectMatEx)mat; Rect2DEx rect2D = rectMat.GetBoundaryRect(); Polygon2DEx poly = new Polygon2DEx(); poly.AddPoint(new Point2DEx(rect2D.GetXMin(), rect2D.GetYMin())); poly.AddPoint(new Point2DEx(rect2D.GetXMax(), rect2D.GetYMin())); poly.AddPoint(new Point2DEx(rect2D.GetXMax(), rect2D.GetYMax())); poly.AddPoint(new Point2DEx(rect2D.GetXMin(), rect2D.GetYMax())); viewPort.DrawPolygon(poly); } else if (mat.GetMatType() == MAT_TYPE_EX.MAT_EX_POLY) { PolyMatEx polyMat = (PolyMatEx)mat; Polygon2DEx poly = polyMat.GetMatPolygon(); viewPort.DrawPolygon(poly); // draw the useless holes. Poly2DListEx uselessHoles = polyMat.GetUselessHoleList(); for (int i = 0; i < uselessHoles.Size(); i++) { viewPort.DrawPolygon(uselessHoles.GetPolygonByIndex(i)); } } }