文檔首頁>>VectorDraw Developer Framework使用教程>>VDF常見問題整理(六):如何實現(xiàn)混合渲染模式?
VDF常見問題整理(六):如何實現(xiàn)混合渲染模式?
VectorDraw Developer Framework(VDF)是一個用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何才能在繪制數(shù)字時混合渲染模式?能否有代碼示例實現(xiàn)如下目標(biāo):
-
使用Wire3D渲染繪制vdPolyface。
-
使用Shade / Hide / ShadeOn / Render模式渲染繪制所有其他圖形。
答:
想要實現(xiàn)目標(biāo)可以采用以下代碼:
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(); } } }