In case you would display your mesh in wireframe with its colormap as well like the following picture:
you should create the a new custom Mesh-derived class, that overrides method DrawWireframe().
This sample has been created starting from FunctionPlot sample, you will find the new Mesh-derived class called MyMesh, at the bottom of this code.
public partial class Form1 : Form { public Form1() { InitializeComponent(); // viewportLayout1.Unlock(""); // For more details see 'Product Activation' topic in the documentation. } private void Form1_Load(object sender, EventArgs e) { viewportLayout1.DisplayMode = displayType.Wireframe; viewportLayout1.Grid.AutoSize = true; viewportLayout1.Grid.Step = 1; const int rows = 50; const int cols = 50; const double scale = 4; List<PointRGB> vertices = new List<PointRGB>(rows * cols); Mesh surface = new Mesh(); surface.NormalAveragingMode = meshNormalAveragingType.Averaged; for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = i / 5.0; double y = j / 5.0; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; // generates a random color int red = (int)(255 - y * 20); int green = (int)(255 - x * 20); int blue = (int)(-f * 50); // clamps color values lat 0-255 Utility.LimitRange<int>(0, ref red, 255); Utility.LimitRange<int>(0, ref green, 255); Utility.LimitRange<int>(0, ref blue, 255); vertices.Add(new PointRGB(x, y, f, (byte)red, (byte)green, (byte)blue)); } List<SmoothTriangle> triangles = new List<SmoothTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { triangles.Add(new SmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)); triangles.Add(new SmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); MyMesh mesh = new MyMesh(surface);
// you need to turn off your mesh edges mesh.EdgeStyle = meshEdgeStyleType.None; viewportLayout1.Entities.Add(mesh); // fits the model in the viewportLayout1 viewportLayout1.ZoomFit(); } } class MyMesh : Mesh { public MyMesh(Mesh another) : base(another) { } protected override void DrawWireframe(DrawParams drawParams) { gl.PushAttrib(gl.CURRENT_BIT); gl.CallList(drawList); gl.PopAttrib(); } protected override void DrawIsocurves() { //base.DrawIsocurves(); } }
Comments
Please sign in to leave a comment.