文档彩票走势图>>VectorDraw Developer Framework使用教程>>VDF常见问题整理(六):如何实现混合渲染模式?
VDF常见问题整理(六):如何实现混合渲染模式?
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw Developer Framework试用版下载
问:
如何才能在绘制数字时混合渲染模式?能否有代码示例实现如下目标:
-
使用Wire3D渲染绘制vdPolyface。
-
使用Shade / Hide / ShadeOn / Render模式渲染绘制所有其他图形。
答:
想要实现目标可以采用以下代码:
private void Form1_Load(object sender, EventArgs e) { vdFramedControl1.BaseControl.ActiveDocument.New(); if (vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdSphere(new gPoint(0, 0, 0), 3.0d, 6, 6)) { vdFramedControl1.BaseControl.ActiveDocument.Model.Entities[vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.Count - 1].Label = "WIRE3D"; // the sphere will be drawn as Wire3D } vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdBox3d(new gPoint(5, 0, 0), 3.0d, 4.0d, 2.0d, 0.0d); vdFramedControl1.BaseControl.ActiveDocument.ZoomExtents(); vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(false); vdFramedControl1.BaseControl.ActiveDocument.GlobalRenderProperties.CustomRenderTypeName = "VectorDraw.Render.opengllist#VectorDraw.Professional.dll"; vdFramedControl1.BaseControl.ActiveDocument.OnDrawFigure += new vdDocument.FigureDrawEventHandler(ActiveDocument_OnDrawFigure); } void ActiveDocument_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel) { vdPolyface pface = sender as vdPolyface; if (pface != null) { if (pface.Label == "WIRE3D")// You can check here by Label/XProperty/Handle/Type/Layer etc { vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(true); VectorDraw.Render.vdRender.Mode RMode = render.RenderMode; render.RenderMode = VectorDraw.Render.vdRender.Mode.Wire3d; pface.Draw(render); render.RenderMode = RMode; cancel = true; vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Pop(); } } }