Exemplo n.º 1
0
        // サブメッシュの登録
        private void EntrySubMeshForMesh(Mesh mesh)
        {
            MeshList         meshList = meshSection.meshList;
            MeshMaterialList matList  = meshSection.matList;

            mesh.subMeshCount = matList.MaterialCount;                  // サブメッシュの数をここで設定

            /*
             * for (int i = 0; i < meshList.MeshCount; i++) {
             *      mesh.SetTriangles(meshList.mesh[i], matList.materialIndex[i]);
             * }*/

            for (int i = 0; i < matList.MaterialCount; i++)
            {
                List <int> submesh = new List <int>();
                for (int j = 0; j < meshList.MeshCount; j++)
                {
                    if (i == matList.materialIndex[j])
                    {
                        foreach (int num in meshList.mesh[j])
                        {
                            submesh.Add(num);
                        }
                    }
                }
                int[] buf = new int[submesh.Count];
                submesh.CopyTo(buf);
                mesh.SetTriangles(buf, i);
            }
        }
Exemplo n.º 2
0
        public MeshSection(StreamReader sr, string name)
        {
            this.name = name;
            vtxList   = new VertexList(sr);
            meshList  = new MeshList(sr, vtxList);

            // 他の何かがある場合
            // 閉じるまで繰り返し
            string read = sr.ReadLine();

            while (!Regex.IsMatch(read, "}"))
            {
                if (Regex.IsMatch(read, "MeshMaterialList"))
                {
                    matList = new MeshMaterialList(sr);
                }
                else if (Regex.IsMatch(read, "MeshNormals"))
                {
                    normList = new MeshNormalList(sr);
                }
                else if (Regex.IsMatch(read, "MeshTextureCoords"))
                {
                    uvList = new MeshTextureCoordList(sr);
                }
                read = sr.ReadLine();
            }
        }
Exemplo n.º 3
0
		public MeshSection(StreamReader sr, string name) {
			this.name = name;
			vtxList = new VertexList(sr);
			meshList = new MeshList(sr, vtxList);
			
			// 他の何かがある場合 
			// 閉じるまで繰り返し 
			string read = sr.ReadLine();
			while (!Regex.IsMatch(read, "}")) {
				if (Regex.IsMatch(read, "MeshMaterialList") ){
					matList = new MeshMaterialList(sr);
				} else if (Regex.IsMatch(read, "MeshNormals")) {
					normList = new MeshNormalList(sr);
				} else if (Regex.IsMatch(read, "MeshTextureCoords")) {
					uvList = new MeshTextureCoordList(sr);
				}
				read = sr.ReadLine();
			}
		}