本文整理汇总了C#中VertexBuffer.All方法的典型用法代码示例。如果您正苦于以下问题:C# VertexBuffer.All方法的具体用法?C# VertexBuffer.All怎么用?C# VertexBuffer.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexBuffer
的用法示例。
在下文中一共展示了VertexBuffer.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupVertexOutput
/// <summary>
/// Setups vertex (stream) output.
/// </summary>
/// <param name="vertexBuffers">Vertex buffer to write data.</param>
/// <param name="offset">Offset where to start writing data. -1 means append.</param>
public void SetupVertexOutput ( VertexBuffer[] vertexBuffers, int[] offsets )
{
if (vertexBuffers==null || offsets==null ) {
lock (deviceContext) {
deviceContext.StreamOutput.SetTargets( null );
}
return;
}
if (vertexBuffers.Length>4) {
throw new ArgumentException("Length of 'vertexBuffers' must be less or equal 4");
}
if (vertexBuffers.Length!=offsets.Length) {
throw new ArgumentException("Lengths of 'vertexBuffers' and 'offsets' must be the same.");
}
if ( !offsets.All( e => (e<0) || (e%4==0) ) ) {
throw new ArgumentException("SetupVertexOutput: Offsets must be multiple of 4.");
}
if ( !vertexBuffers.All( vb => vb.Options==VertexBufferOptions.VertexOutput) ) {
throw new GraphicsException("SetupVertexOutput: Vertex buffer must be created with enabled vertex output.");
}
var outputBinding = vertexBuffers.Zip( offsets, (vb,offset) => new StreamOutputBufferBinding( vb.Buffer, offset ) ).ToArray();
lock (deviceContext) {
deviceContext.StreamOutput.SetTargets( outputBinding );
}
}