예제 #1
0
        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();
        }
예제 #2
0
 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));
예제 #3
0
 public static IArray <int> FaceSizes(this IG3D g3d)
 => g3d.HasFixedFaceSize()
         ? g3d.FaceCount().Select(i => g3d.FirstFaceSize())
         : g3d.FaceSizeAttribute.ToInts();
예제 #4
0
 public static int FaceCount(this IG3D g3d)
 => g3d.HasFixedFaceSize()
         ? g3d.CornerVertexIndices().Count / g3d.FirstFaceSize()
         : g3d.FaceSizeAttribute.ToInts().Count;