/// <summary> /// Sets the vertices of this triangle mesh. /// </summary> public void SetVertices(Vertex[] vertices, TimeStep timeStep, int srcOffset, int dstOffset, int length) { if (vertices == null) { throw new ArgumentNullException("vertices"); } else if (srcOffset < 0) { throw new ArgumentOutOfRangeException("srcOffset"); } else if (dstOffset < 0) { throw new ArgumentOutOfRangeException("dstOffset"); } else if (length < 0) { throw new ArgumentOutOfRangeException("length"); } else if (srcOffset + length > vertices.Length) { throw new ArgumentOutOfRangeException("length"); } else if (dstOffset + length > Description.NumVertices) { throw new ArgumentOutOfRangeException("length"); } else if (!Description.LinearMotion && (timeStep != TimeStep.T0)) { throw new ArgumentOutOfRangeException("timeStep"); } else if (length == 0) { return; } var vertexBufferType = timeStep.AsVertexBuffer(); using (var vertexBuffer = new MappedBuffer <Vertex>(Parent, ID, vertexBufferType)) { for (int t = 0; t < length; ++t) { vertexBuffer[t + dstOffset] = vertices[t + srcOffset]; } } RTC.UpdateBuffer(Parent.NativePtr, ID, vertexBufferType); }
/// <summary> /// Sets the triangles of this triangle mesh. /// </summary> public void SetTriangles(Triangle[] triangles, int srcOffset, int dstOffset, int length) { if (triangles == null) { throw new ArgumentNullException("triangles"); } else if (srcOffset < 0) { throw new ArgumentOutOfRangeException("srcOffset"); } else if (dstOffset < 0) { throw new ArgumentOutOfRangeException("dstOffset"); } else if (length < 0) { throw new ArgumentOutOfRangeException("length"); } else if (srcOffset + length > triangles.Length) { throw new ArgumentOutOfRangeException("srcOffset"); } else if (dstOffset + length > Description.NumTriangles) { throw new ArgumentOutOfRangeException("dstOffset"); } else if (length == 0) { return; } using (var triangleBuffer = new MappedBuffer <Triangle>(Parent, ID, BufferType.IndexBuffer)) { for (int t = 0; t < length; ++t) { triangleBuffer[t + dstOffset] = triangles[t + srcOffset]; } } RTC.UpdateBuffer(Parent.NativePtr, ID, BufferType.IndexBuffer); }