/// <summary> /// Reads a <see cref="MODEL"/> instance from a <see cref="Stream"/> representing a GLB file /// </summary> /// <param name="stream">The source <see cref="Stream"/>.</param> /// <param name="settings">Optional settings.</param> /// <returns>A <see cref="MODEL"/> instance.</returns> public static MODEL ReadGLB(Stream stream, ReadSettings settings = null) { Guard.NotNull(stream, nameof(stream)); Guard.IsTrue(stream.CanRead, nameof(stream)); var context = IO.ReadContext .Create(f => throw new NotSupportedException()); if (settings != null) { settings.CopyTo(context); } return(context.ReadBinarySchema2(stream)); }
/// <summary> /// Reads a <see cref="MODEL"/> instance from a path pointing to a GLB or a GLTF file /// </summary> /// <param name="filePath">A valid file path.</param> /// <param name="settings">Optional settings.</param> /// <returns>A <see cref="MODEL"/> instance.</returns> public static MODEL Load(string filePath, ReadSettings settings = null) { Guard.FilePathMustExist(filePath, nameof(filePath)); var context = IO.ReadContext.CreateFromFile(filePath); if (settings != null) { settings.CopyTo(context); } using (var s = File.OpenRead(filePath)) { return(context.ReadSchema2(s)); } }
public ReadSettings(ReadSettings other) { Guard.NotNull(other, nameof(other)); other.CopyTo(this); }
public ReadContext WithSettingsFrom(ReadSettings settings) { settings?.CopyTo(this); return(this); }