コード例 #1
0
        public static short[] GetInds(this ModelMesh mesh)
        {
            MeshDataContainer data = mesh.GetMeshData();

            if (data == null)
            {
                return(null);
            }
            if (data.Indices == null)
            {
                IEnumerable <short> i_verts = null;
                for (int p = 0; p < mesh.MeshParts.Count; ++p)
                {
                    if (i_verts == null)
                    {
                        i_verts = mesh.MeshParts[p].GetInds();
                    }
                    else
                    {
                        i_verts = i_verts.Concat(mesh.MeshParts[p].GetInds());
                    }
                }
                data.Indices = i_verts.ToArray();
            }
            return(data.Indices);
        }
コード例 #2
0
        public static VertexPositionColorTexture[] GetVerts(this ModelMesh mesh)
        {
            MeshDataContainer data = mesh.GetMeshData();

            if (data == null)
            {
                return(null);
            }
            if (data.Vertices == null)
            {
                IEnumerable <VertexPositionColorTexture> i_verts = null;
                for (int p = 0; p < mesh.MeshParts.Count; ++p)
                {
                    if (i_verts == null)
                    {
                        i_verts = mesh.MeshParts[p].GetVerts();
                    }
                    else
                    {
                        i_verts = i_verts.Concat(mesh.MeshParts[p].GetVerts());
                    }
                }
                data.Vertices = i_verts.ToArray();
            }
            return(data.Vertices);
        }