本文整理汇总了C#中ISource.GetStride方法的典型用法代码示例。如果您正苦于以下问题:C# ISource.GetStride方法的具体用法?C# ISource.GetStride怎么用?C# ISource.GetStride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISource
的用法示例。
在下文中一共展示了ISource.GetStride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMeshStream
private IMeshStream CreateMeshStream(ISource source, string semantic)
{
var floatArray = source as FloatArraySource;
if (floatArray != null)
{
bool swapY = (semantic == Streams.TexCoord);
if (source.GetStride() == 3)
{
var arrayMeshStream = new ArrayMeshStream<Float3>(source.GetCount(), streamConverterFactory);
for (int i = 0; i < arrayMeshStream.Count; ++i)
{
var y = floatArray[i * 3 + 1];
if (swapY) y = 1.0f - y;
arrayMeshStream[i] = new Float3(floatArray[i * 3 + 0], y, floatArray[i * 3 + 2]);
}
return arrayMeshStream;
}
else if (source.GetStride() == 2)
{
var arrayMeshStream = new ArrayMeshStream<Float2>(source.GetCount(), streamConverterFactory);
for (int i = 0; i < arrayMeshStream.Count; ++i)
{
var y = floatArray[i * 2 + 1];
if (swapY) y = 1.0f - y;
arrayMeshStream[i] = new Float2(floatArray[i * 2 + 0], y);
}
return arrayMeshStream;
}
else if (source.GetStride() == 4)
{
var arrayMeshStream = new ArrayMeshStream<Float4>(source.GetCount(), streamConverterFactory);
for (int i = 0; i < arrayMeshStream.Count; ++i)
{
var y = floatArray[i * 4 + 1];
if (swapY) y = 1.0f - y;
arrayMeshStream[i] = new Float4(floatArray[i * 4 + 0], y, floatArray[i * 4 + 2], floatArray[i * 4 + 3]);
}
return arrayMeshStream;
}
}
else
{
throw new NotImplementedException();
}
throw new NotImplementedException();
}