/// <summary> /// Initializes a new instance of the <see cref="GorgonIndexBufferInfo"/> class. /// </summary> /// <param name="info">A <see cref="IGorgonIndexBufferInfo"/> to copy settings from.</param> /// <param name="newName">[Optional] The new name for the buffer.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="info"/> parameter is <b>null</b>.</exception> public GorgonIndexBufferInfo(IGorgonIndexBufferInfo info, string newName = null) { if (info == null) { throw new ArgumentNullException(nameof(info)); } Name = string.IsNullOrEmpty(newName) ? info.Name : newName; Usage = info.Usage; Use16BitIndices = info.Use16BitIndices; IndexCount = info.IndexCount; Binding = info.Binding; }
/// <summary> /// Initializes a new instance of the <see cref="GorgonIndexBuffer" /> class, initialized with <see cref="int"/> values for 32 bit index buffers. /// </summary> /// <param name="graphics">The <see cref="GorgonGraphics"/> object used to create and manipulate the buffer.</param> /// <param name="info">Information used to create the buffer.</param> /// <param name="initialData">The initial data used to populate the buffer.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="graphics"/>, <paramref name="info"/> or the <paramref name="initialData"/> parameters are <b>null</b>.</exception> public GorgonIndexBuffer(GorgonGraphics graphics, IGorgonIndexBufferInfo info, GorgonNativeBuffer <int> initialData = null) : base(graphics) { _info = new GorgonIndexBufferInfo(info ?? throw new ArgumentNullException(nameof(info))); Initialize(initialData ?? throw new ArgumentNullException(nameof(initialData))); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonIndexBuffer" /> class. /// </summary> /// <param name="graphics">The <see cref="GorgonGraphics"/> object used to create and manipulate the buffer.</param> /// <param name="info">Information used to create the buffer.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="graphics"/>, or the <paramref name="info"/> parameters are <b>null</b>.</exception> public GorgonIndexBuffer(GorgonGraphics graphics, IGorgonIndexBufferInfo info) : base(graphics) { _info = new GorgonIndexBufferInfo(info ?? throw new ArgumentNullException(nameof(info))); Initialize <byte>(null); }