Assimp.Mesh.GetUnsignedIndices C# (CSharp) Метод

GetUnsignedIndices() приватный Метод

private GetUnsignedIndices ( ) : uint[]
Результат uint[]
        public uint[] GetUnsignedIndices()
        {
            if (HasFaces)
            {
                List<uint> indices = new List<uint>();
                foreach (Face face in m_faces)
                {
                    if (face.IndexCount > 0 && face.Indices != null)
                    {
                        foreach (uint index in face.Indices)
                        {
                            indices.Add((uint)index);
                        }
                    }
                }

                return indices.ToArray();
            }

            return null;
        }

Usage Example

Пример #1
0
        Mesh ConvertMesh(AssimpMesh M, Material[] Materials)
        {
            Mesh Msh = new Mesh();

            Vector3[] Verts = M.Vertices.Select((V) => new Vector3(V.X, V.Y, V.Z)).ToArray();
            Msh.SetVertices(Verts);

            Vector2[] UVs = M.TextureCoordinateChannels[0].Select((V) => new Vector2(V.X, V.Y)).ToArray();
            if (UVs.Length > 0)
            {
                Msh.SetUVs(UVs);
            }

            Vector4[] Colors = M.VertexColorChannels[0].Select((C) => new Vector4(C.R, C.G, C.B, C.A)).ToArray();
            if (Colors.Length > 0)
            {
                Msh.SetColors(Colors);
            }

            uint[] Indices = M.GetUnsignedIndices();
            if (Indices.Length > 0)
            {
                Msh.SetElements(Indices);
            }

            if (Materials != null)
            {
                Msh.Material = Materials[M.MaterialIndex];
            }

            return(Msh);
        }