如果我們能時時刻刻都在學習,從觀察、聆聽、注視和行動中學習,那么你會發(fā)現(xiàn),學習是不斷進展,永無過去 | 學習技術(shù)不是發(fā)財之道 | 學習技術(shù),因為崇尚科學與真理
模板MeshMaterialList 定義如下:
template MeshMaterialList{ < F6F23F42-7686-11CF-8F52-0040333594A3 > DWORD nMaterials; //材質(zhì)個數(shù) DWORD nFaceIndexes; //面索引個數(shù) array DWORD faceIndexes[nFaceIndexes]; //面索引列表 [Material <3D82AB4D-62DA-11CF-AB39-0020AF71E433>] //約定只能包含Material模板}
模板Material 定義如下:
template Material{ < 3D82AB4D-62DA-11CF-AB39-0020AF71E433 > ColorRGBA faceColor; //面的顏色 FLOAT power; // specular color 指數(shù) ColorRGB specularColor; ColorRGB emissiveColor; [...]}
模板ColorRGBA 定義如下:
template ColorRGBA{ < 35FF44E0-6C7C-11cf-8F52-0040333594A3 > float red; float green; float blue; float alpha;}
模板ColorRGB 定義如下:
template ColorRGB
{
< D3E16E81-7835-11cf-8F52-0040333594A3 >
float red;
float green;
float blue;
}
模板TextureFilename 定義如下:
template TextureFilename { < A42790E1-7810-11cf-8F52-0040333594A3 > string filename; //紋理圖片文件名}
模板MeshTextureCoords 定義如下:
template MeshTextureCoords{ < F6F23F40-7686-11cf-8F52-0040333594A3 > DWORD nTextureCoords; //紋理坐標個數(shù) array Coords2d textureCoords[nTextureCoords] ; //紋理坐標數(shù)組}
模板Coords2d 定義如下:
template Coords2d{ < F6F23F44-7686-11cf-8F52-0040333594A3 > float u; float v;} 我們在原有模型的基礎上添加兩個材質(zhì)Material YelloImage {1.000000;1.000000; 0.000000;1.000000;; 0.000000; 0.000000;0.000000;0.000000;;0.000000;0.000000;0.000000;; TextureFilename{ "Herbert.png";}}
Material PurpleImage{1.000000; 0.000000; 1.000000; 1.000000;; //顏色: R G B A 0.000000;0.000000; 0.000000; 0.000000;;0.000000; 0.000000; 0.000000;;
TextureFilename{ "Candy.png";}}在 Mesh 里面嵌入 MeshMaterialList、MeshNormals、MeshTextureCoords。完整代碼如下:
cube_material.xxof 0302txt 0064
Header{1;0;1;}
Material YelloImage {1.000000;1.000000; 0.000000;1.000000;; //顏色: R G B A 0.000000; // specular color 指數(shù)0.000000;0.000000;0.000000;; // specularColor0.000000;0.000000;0.000000;; // emissiveColor
TextureFilename{ "Herbert.png";}}
TextureFilename{ "Candy.png";}}
Mesh Cube_material{8; //8 個頂點 2.0;-2.0; 2.0;, 2.0;-2.0;-2.0;,-2.0;-2.0;-2.0;,-2.0;-2.0; 2.0;, 2.0; 2.0; 2.0;, 2.0; 2.0;-2.0;,-2.0; 2.0;-2.0;,-2.0; 2.0; 2.0;;
12; // 12 個面3;0,2,1;,3;0,3,2;,3;4,5,6;,3;4,6,7;,3;0,1,5;,3;0,5,4;,3;3,7,6;,3;3,6,2;,3;1,2,6;,3;1,6,5;,3;0,4,7;,3;0,7,3;;
MeshMaterialList{2; //材質(zhì)個數(shù)12; //面?zhèn)€數(shù)0, 0, 0, 0, 0, 0,1, 1, 1, 1, 1, 1;;{YelloImage}{PurpleImage}}
MeshNormals{8; //8個法線向量 1.0;-1.0; 1.0;, 1.0;-1.0;-1.0;,-1.0;-1.0;-1.0;,-1.0;-1.0; 1.0;, 1.0; 1.0; 1.0;, 1.0; 1.0;-1.0;,-1.0; 1.0;-1.0;,-1.0; 1.0; 1.0;;
12; //12個面3;0,2,1;, //12個面中每個頂點對應一個向量索引3;0,3,2;,3;4,5,6;,3;4,6,7;,3;0,1,5;,3;0,5,4;,3;3,7,6;,3;3,6,2;,3;1,2,6;,3;1,6,5;,3;0,4,7;,3;0,7,3;;
MeshTextureCoords{8; //8個紋理坐標0.0; 0.0;0.0; 1.0;0.0; 0.0;0.0; 1.0;
1.0; 0.0;1.0; 1.0;1.0; 0.0;1.0; 1.0;;}
Copyright Copyright Herbert