翻譯|使用教程|編輯:鮑佳佳|2021-05-17 11:59:33.263|閱讀 243 次
概述:本文主要講述如何創建帶有材質圖像并映射TexCoords的vdPolyface
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導出。
下載VectorDraw Developer Framework(VDF)
問:如何使用材料圖像和貼圖TexCoords創建vdPolyface?
創建帶有材質圖像并映射TexCoords的vdPolyface
解決方案
例子:
假設我們創建了一個圖像'textcoords.png'看起來像 寬度xheigth = 2598x1732(縱橫比/高度= 1.5)
遵循創建新的vdPolyface的代碼,該vdPolyface表示1x1x1大小的盒子 并將圖像的各個部分映射到每個面孔 注意:假設圖像坐標為左下= 0,0和右上= 1,1
//盒子角點 gPoints pts = new gPoints(); //底點 pts.Add(new gPoint(0,0,0)); pts.Add(new gPoint(1,0,0)); pts.Add(new gPoint(1,1,0)); pts.Add(new gPoint(0,1,0)); //最高點 pts.Add(new gPoint(0,0,1)); pts.Add(new gPoint(1,0,1)); pts.Add(new gPoint(1,1,1)); pts.Add(new gPoint(0,1,1)); Int32Array facelist = new Int32Array(new int [] { //注意:更改 1,2,3,4,-1,//底部 5,6,7,8,-1,//頂部 1,2,6,5,-1,//前 3,4,8,7,-1,//返回 4,1,5,8,-1,//左 2,3,7,6,-1,//右 }); //注意:假設圖像坐標為左下= 0,0和右上= 1,1 // --->(相對于圖像左下方的紋理坐標) // 0.0 0.33 0.66 1.0 // // 1 | ---- | ---- | ---- | // | -A-- | -B-- | -C-- | //0.5 | ---- || ---- | ---- | // | -D-- | -E-- | -F-- | // 0 | ---- | ---- | ---- | DoubleArray texcoords = new DoubleArray(new double [] { 0.0,0.5,0.33,0.5,0.33,1.0,0.0,1.0,//底部一個字母 0.33,0.5,0.66,0.5,0.66,1.0,0.33,1.0,//頂B字母 0.66,0.5,1.0,0.5,1.0,1.0,0.66,1.0,//前C字母 0.0,0.0,0.33,0.0,0.33,0.5,0.0,0.5,//后退D字母 0.33,0.0,0.66,0.0,0.66,0.5,0.33,0.5,//左E字母 0.66,0.0,1.0,0.0,1.0,0.5,0.66,0.5,//右F字母 }); vdPolyface pf =新的vdPolyface(doc,pts,facelist){TexCoords = texcoords}; vdColor pfcolor =新的vdColor(Color.Blue); pfcolor.MaterialImage = doc.Images.Add(@“ textcoords.png”); pf.PenColor = pfcolor; doc.Model.Entities.AddItem(pf); doc.RenderMode = vdRender.Mode.Render; doc.Redraw(true);
=======================================================
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯系咨詢相關問題。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: