/// <summary>
			/// Specify which elements shall be drawn by indexing them, specifying an offset and the number of elements.
			/// </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 elements are interpreted.
			/// </param>
			protected Element(VertexArrayObject vao, PrimitiveType mode)
			{
				if (vao == null)
					throw new ArgumentNullException("vao");
				_VertexArrayObject = vao;
				ElementsMode = mode;
			}
示例#2
0
		private VertexArrayObject CreateVertexArray(NewtonVertex[] array, out ArrayBufferObjectBase interleavedArrayBuffer)
		{
			VertexArrayObject newtonVertexArray = new VertexArrayObject();
			ArrayBufferObjectInterleaved newtonVertexArrayBuffer = new ArrayBufferObjectInterleaved(typeof(NewtonVertex), BufferObjectHint.DynamicGpuDraw);

			if (array != null)
				newtonVertexArrayBuffer.Create(array);
			else
				newtonVertexArrayBuffer.Create(VertexCount);
			newtonVertexArray.SetArray(newtonVertexArrayBuffer, 0, VertexArraySemantic.Position);
			newtonVertexArray.SetArray(newtonVertexArrayBuffer, 1, VertexArraySemantic.Speed);
			newtonVertexArray.SetArray(newtonVertexArrayBuffer, 2, VertexArraySemantic.Acceleration);
			newtonVertexArray.SetArray(newtonVertexArrayBuffer, 3, VertexArraySemantic.Mass);
			newtonVertexArray.SetElementArray(PrimitiveType.Points);

			interleavedArrayBuffer = newtonVertexArrayBuffer;

			return (newtonVertexArray);
		}
			/// <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, specifying an offset and the number of elements.
			/// </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="offsets">
			/// A <see cref="Int32[]"/> that specify the offset applied to the drawn array elements.
			/// </param>
			/// <param name="counts">
			/// A <see cref="Int32[]"/> that specify the number of array elements drawn.
			/// </param>
			public MultiArrayElement(VertexArrayObject vao, PrimitiveType mode, int[] offsets, int[] counts) :
				base(vao, mode)
			{
				if (offsets == null)
					throw new ArgumentNullException("offset");
				if (counts == null)
					throw new ArgumentNullException("count");
				if (offsets.Length == 0)
					throw new ArgumentException("invalid size", "offset");
				if (counts.Length != offsets.Length)
					throw new ArgumentException("no mtaching length with offsets", "count");

				ArrayOffsets = offsets;
				ArrayCounts = counts;
			}
			/// <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>
			/// Specify which elements shall be drawn.
			/// </summary>
			/// <param name="mode">
			/// A <see cref="PrimitiveType"/> that indicates how array elements are interpreted.
			/// </param>
			/// <remarks>
			/// The array elements count is implictly defined as the vertex array length at <see cref="Draw(GraphicsContext)"/>
			/// execution time.
			/// </remarks>
			public ArrayElement(VertexArrayObject vao, PrimitiveType mode) :
				this(vao, mode, 0, 0)
			{
				
			}
			/// <summary>
			/// Specify which elements shall be drawn, specifying an offset and the number of elements.
			/// </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="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 ArrayElement(VertexArrayObject vao, PrimitiveType mode, uint offset, uint count) :
				base(vao, mode)
			{
				ElementOffset = offset;
				ElementCount = count;
			}
 /// <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.
 /// </summary>
 /// <param name="mode">
 /// A <see cref="PrimitiveType"/> that indicates how array elements are interpreted.
 /// </param>
 /// <remarks>
 /// The array elements count is implictly defined as the vertex array length at <see cref="Draw(GraphicsContext)"/>
 /// execution time.
 /// </remarks>
 public ArrayElement(VertexArrayObject vao, PrimitiveType mode) :
     this(vao, mode, 0, 0)
 {
 }
 /// <summary>
 /// Specify which elements shall be drawn, specifying an offset and the number of elements.
 /// </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="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 ArrayElement(VertexArrayObject vao, PrimitiveType mode, uint offset, uint count) :
     base(vao, mode)
 {
     ElementOffset = offset;
     ElementCount  = count;
 }