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));
public static IArray <int> FaceSizes(this IG3D g3d) => g3d.HasFixedFaceSize() ? g3d.FaceCount().Select(i => g3d.FirstFaceSize()) : g3d.FaceSizeAttribute.ToInts();
public static int FaceCount(this IG3D g3d) => g3d.HasFixedFaceSize() ? g3d.CornerVertexIndices().Count / g3d.FirstFaceSize() : g3d.FaceSizeAttribute.ToInts().Count;