/// <summary> /// Set a buffer object which specify the element arrays. /// </summary> /// <param name="mode"> /// A <see cref="Primitive"/> that specify how arrays elements are interpreted. /// </param> /// <param name="bufferObject"> /// A <see cref="ElementBufferObject"/> that specify a sequence of indices that defines the /// array element sequence. /// </param> public void SetElementArray(PrimitiveType mode, ElementBufferObject bufferObject) { if (bufferObject == null) { throw new ArgumentNullException("bufferObject"); } // Store element array _Elements.Add(new IndexedElement(this, mode, bufferObject)); }
/// <summary> /// Specify which elements shall be drawn by indexing them, specifying an offset and the number of element indices. /// </summary> /// <param name="vao"> /// The <see cref="VertexArrayObject"/> to which this element belongs to. /// </param> /// <param name="mode"> /// A <see cref="PrimitiveType"/> that indicates how array elements are interpreted. /// </param> /// <param name="indices"> /// A <see cref="ElementBufferObject"/> containing the indices of the drawn vertices. /// </param> /// <param name="offset"> /// A <see cref="UInt32"/> that specify the offset applied to the drawn elements indices. /// </param> /// <param name="count"> /// A <see cref="UInt32"/> that specify the number of element indices drawn. /// </param> /// <exception cref="ArgumentNullException"> /// Exception thrown if <paramref name="indices"/> is null. /// </exception> public IndexedElement(VertexArrayObject vao, PrimitiveType mode, ElementBufferObject indices, uint offset, uint count) : base(vao, mode, offset, count) { if (indices == null) { throw new ArgumentNullException("indices"); } ArrayIndices = indices; ArrayIndices.IncRef(); }
public void SetPatchArray(uint patchCount, ElementBufferObject bufferObject, uint offset, uint count) { if (patchCount < 3) { throw new ArgumentException("invalid", "patchCount"); } if (_PatchElement != null) { throw new InvalidOperationException("only one patch element is supported"); } _PatchElement = new PatchAttributeElement(patchCount, bufferObject, offset, count); }
/// <summary> /// Set a buffer object which specify the element arrays. /// </summary> /// <param name="mode"> /// A <see cref="PrimitiveType"/> that specify how arrays elements are interpreted. /// </param> /// <param name="bufferObject"> /// A <see cref="ElementBufferObject"/> that specify a sequence of indices that defines the /// array element sequence. /// </param> /// <param name="offset"> /// A <see cref="UInt32"/> that specify the offset applied to the drawn elements indices. /// </param> /// <param name="count"> /// A <see cref="UInt32"/> that specify the number of element indices drawn. /// </param> public void SetElementArray(PrimitiveType mode, ElementBufferObject bufferObject, uint offset, uint count) { if (bufferObject == null) { throw new ArgumentNullException("bufferObject"); } if (bufferObject.RestartIndexEnabled && (count != 0)) { throw new ArgumentException("invalid count", "count"); } // Store element array _Elements.Add(new IndexedElement(this, mode, bufferObject, offset, count)); }
/// <summary> /// Copy from an ArrayBufferObject with an indirection defined by an index (polygon tessellation). /// </summary> /// <param name="buffer"></param> /// <param name="indices"></param> /// <param name="count"></param> /// <param name="offset"></param> /// <param name="stride"></param> public void Copy(ArrayBufferObject buffer, ElementBufferObject indices, uint count, uint offset, uint stride) { uint[] indicesArray; switch (indices.ElementsType) { case DrawElementsType.UnsignedByte: indicesArray = Array.ConvertAll <byte, uint>((byte[])indices.ToArray(), delegate(byte item) { return((uint)item); }); break; case DrawElementsType.UnsignedShort: indicesArray = Array.ConvertAll <ushort, uint>((ushort[])indices.ToArray(), delegate(ushort item) { return((uint)item); }); break; case DrawElementsType.UnsignedInt: indicesArray = (uint[])indices.ToArray(); break; default: throw new InvalidOperationException(String.Format("element type {0} not supportted", indices.ElementsType)); } Copy(buffer, indicesArray, count, offset, stride); }
/// <summary> /// Specify which elements shall be drawn by indexing them, specifying an offset and the number of elements. /// </summary> /// <param name="patchCount"> /// A <see cref="UInt32"/> that specify how many vertices has a single patch. /// </param> /// <param name="indices"> /// A <see cref="ElementBufferObject"/> containing the indices of the drawn vertices. If it null, no indices are /// used for drawing; instead, <paramref name="count"/> contiguos array elements are drawns, starting from /// <paramref name="offset"/>. If it is not null, <paramref name="count"/> indices are drawn starting from /// <paramref name="offset"/>. /// </param> /// <param name="offset"> /// A <see cref="UInt32"/> that specify the offset applied to the drawn array elements. /// </param> /// <param name="count"> /// A <see cref="UInt32"/> that specify the number of array elements drawn. /// </param> public PatchAttributeElement(uint patchCount, ElementBufferObject indices, uint offset, uint count) : base(PrimitiveType.Patches, indices, offset, count) { PatchCount = patchCount; }
/// <summary> /// Specify which elements shall be drawn by indexing them. /// </summary> /// <param name="patchCount"> /// A <see cref="UInt32"/> that specify how many vertices has a single patch. /// </param> /// <param name="indices"> /// A <see cref="ElementBufferObject"/> containing the indices of the drawn vertices. If it null, no indices are /// used for drawing; instead, all array elements are drawns, starting from the first one. If it is not null, all /// indices are drawn starting from the first one. /// </param> public PatchAttributeElement(uint patchCount, ElementBufferObject indices) : this(patchCount, indices, 0, 0) { }
public void SetPatchArray(uint patchCount, ElementBufferObject bufferObject, uint offset, uint count) { if (patchCount < 3) throw new ArgumentException("invalid", "patchCount"); if (_PatchElement != null) throw new InvalidOperationException("only one patch element is supported"); _PatchElement = new PatchAttributeElement(patchCount, bufferObject, offset, count); }
/// <summary> /// Set a buffer object which specify the element arrays. /// </summary> /// <param name="mode"> /// A <see cref="PrimitiveType"/> that specify how arrays elements are interpreted. /// </param> /// <param name="bufferObject"> /// A <see cref="ElementBufferObject"/> that specify a sequence of indices that defines the /// array element sequence. /// </param> /// <param name="offset"> /// A <see cref="UInt32"/> that specify the offset applied to the drawn elements indices. /// </param> /// <param name="count"> /// A <see cref="UInt32"/> that specify the number of element indices drawn. /// </param> public void SetElementArray(PrimitiveType mode, ElementBufferObject bufferObject, uint offset, uint count) { if (bufferObject == null) throw new ArgumentNullException("bufferObject"); if (bufferObject.RestartIndexEnabled && (count != 0)) throw new ArgumentException("invalid count", "count"); // Store element array _Elements.Add(new IndexedElement(this, mode, bufferObject, offset, count)); }
/// <summary> /// Set a buffer object which specify the element arrays. /// </summary> /// <param name="mode"> /// A <see cref="Primitive"/> that specify how arrays elements are interpreted. /// </param> /// <param name="bufferObject"> /// A <see cref="ElementBufferObject"/> that specify a sequence of indices that defines the /// array element sequence. /// </param> public void SetElementArray(PrimitiveType mode, ElementBufferObject bufferObject) { if (bufferObject == null) throw new ArgumentNullException("bufferObject"); // Store element array _Elements.Add(new IndexedElement(this, mode, bufferObject)); }
/// <summary> /// Specify which elements shall be drawn by indexing them, specifying an offset and the number of element indices. /// </summary> /// <param name="mode"> /// A <see cref="PrimitiveType"/> that indicates how array elements are interpreted. /// </param> /// <param name="indices"> /// A <see cref="ElementBufferObject"/> containing the indices of the drawn vertices. /// </param> /// <exception cref="ArgumentNullException"> /// Exception thrown if <paramref name="indices"/> is null. /// </exception> /// <remarks> /// The element indices count is implictly defined by <paramref name="indices"/> at <see cref="Draw(GraphicsContext)"/> /// execution time. /// </remarks> public IndexedElement(VertexArrayObject vao, PrimitiveType mode, ElementBufferObject indices) : this(vao, mode, indices, 0, 0) { }
/// <summary> /// Specify which elements shall be drawn by indexing them, specifying an offset and the number of element indices. /// </summary> /// <param name="vao"> /// The <see cref="VertexArrayObject"/> to which this element belongs to. /// </param> /// <param name="mode"> /// A <see cref="PrimitiveType"/> that indicates how array elements are interpreted. /// </param> /// <param name="indices"> /// A <see cref="ElementBufferObject"/> containing the indices of the drawn vertices. /// </param> /// <param name="offset"> /// A <see cref="UInt32"/> that specify the offset applied to the drawn elements indices. /// </param> /// <param name="count"> /// A <see cref="UInt32"/> that specify the number of element indices drawn. /// </param> /// <exception cref="ArgumentNullException"> /// Exception thrown if <paramref name="indices"/> is null. /// </exception> public IndexedElement(VertexArrayObject vao, PrimitiveType mode, ElementBufferObject indices, uint offset, uint count) : base(vao, mode, offset, count) { if (indices == null) throw new ArgumentNullException("indices"); ArrayIndices = indices; ArrayIndices.IncRef(); }
/// <summary> /// Copy from an ArrayBufferObject with an indirection defined by an index (polygon tessellation). /// </summary> /// <param name="buffer"></param> /// <param name="indices"></param> /// <param name="count"></param> public void Copy(ArrayBufferObject buffer, ElementBufferObject indices, uint count) { Copy(buffer, indices, count, 0, 1); }