public G3DAdapter(IG3D g3D) { //g3D.Validate(); G3D = g3D; FaceSizes = g3D.FaceSizes(); PointsPerFace = g3D.HasFixedFaceSize() ? g3D.FirstFaceSize() : 0; Vertices = g3D.VertexAttribute.ToVector3s(); Indices = g3D.CornerVertexIndices(); NumFaces = g3D.FaceCount(); FaceIndices = g3D.FaceIndices(); MaterialIds = g3D.MaterialIds(); }
public static IArray <int> FaceIndices(this IG3D g3d) => g3d.FaceIndexAttribute?.ToInts() ?? (g3d.HasFixedFaceSize() ? g3d.CornerVertexIndices().Indices().Stride(g3d.FirstFaceSize()) : g3d.FaceSizes().Accumulate((x, y) => x + y));