/// <summary> /// Gets all points contained within a <see cref="Mesh"/>. /// </summary> /// <param name="mesh">The <see cref="Mesh"/> to get points from.</param> /// <returns>An array of points defined by the object.</returns> private static Vector3[] GetPoints(Mesh mesh) { DataStream vertexStream = mesh.LockVertexBuffer(LockFlags.ReadOnly); var points = D3DX.GetVectors(vertexStream, mesh.VertexCount, mesh.VertexFormat); mesh.UnlockVertexBuffer(); vertexStream.Dispose(); return(points); }
/// <summary> /// Gets all points contained within a <see cref="VertexBuffer"/>. /// </summary> /// <param name="buffer">The <see cref="VertexBuffer"/> to get points from.</param> /// <param name="vertexCount">The total number of vertex contained within <paramref name="buffer"/>.</param> /// <returns>An array of points defined by the object.</returns> private static Vector3[] GetPoints(VertexBuffer buffer, int vertexCount) { DataStream vertexStream = buffer.Lock(0, buffer.Description.SizeInBytes, LockFlags.ReadOnly); var points = D3DX.GetVectors(vertexStream, vertexCount, buffer.Description.SizeInBytes / vertexCount); buffer.Unlock(); vertexStream.Dispose(); return(points); }