SubMeshVertex[] GenerateSubMeshVertices(Pair <ChannelTypes, SourceItem>[] inputs, int vertexCount, int[] indices, int startIndex) { SubMeshVertex[] itemVertices = new SubMeshVertex[vertexCount]; int currentIndex = startIndex; for (int nVertex = 0; nVertex < itemVertices.Length; nVertex++) { SubMeshVertex vertex = new SubMeshVertex(); foreach (Pair <ChannelTypes, SourceItem> input in inputs) { ChannelTypes channelType = input.First; SourceItem source = input.Second; int indexValue = indices[currentIndex]; currentIndex++; switch (channelType) { case ChannelTypes.POSITION: vertex.position = source.GetItemVec3(indexValue); break; case ChannelTypes.NORMAL: vertex.normal = source.GetItemVec3(indexValue); break; case ChannelTypes.TEXCOORD0: vertex.texCoord0 = source.GetItemVec2(indexValue); break; case ChannelTypes.TEXCOORD1: vertex.texCoord1 = source.GetItemVec2(indexValue); break; case ChannelTypes.TEXCOORD2: vertex.texCoord2 = source.GetItemVec2(indexValue); break; case ChannelTypes.TEXCOORD3: vertex.texCoord3 = source.GetItemVec2(indexValue); break; case ChannelTypes.COLOR: { Vec3 c = source.GetItemVec3(indexValue);; vertex.color = new ColorValue(c.X, c.Y, c.Z, 1); } break; //maybe need use "TEXTANGENT". //case ChannelTypes.TANGENT: // vertex.tangent = source.GetItemVec3( indexValue ); // break; } } itemVertices[nVertex] = vertex; } return(itemVertices); }