Exemplo n.º 1
0
    MeshResource CreateMeshResource(uint id, List <Vector3> uverts, List <Vector3> unormals, List <int> indices)
    {
        SimpleMesh mesh = new SimpleMesh(id, MeshDrawType.Triangles,
                                         MeshComponentFlag.Vertex | MeshComponentFlag.Normal | MeshComponentFlag.Index);

        for (int i = 0; i < uverts.Count; ++i)
        {
            mesh.AddVertex(Tes.Maths.Vector3Ext.FromUnity(uverts[i]));
        }

        for (int i = 0; i < unormals.Count; ++i)
        {
            mesh.AddNormal(Tes.Maths.Vector3Ext.FromUnity(unormals[i]));
        }

        mesh.AddIndices(indices);

        return(mesh);
    }