本文整理汇总了C#中Resource.DecodeAsVertexElements方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.DecodeAsVertexElements方法的具体用法?C# Resource.DecodeAsVertexElements怎么用?C# Resource.DecodeAsVertexElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource.DecodeAsVertexElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VertexDeclaration
internal VertexDeclaration(Resource.Models.VertexDeclaration declaration)
{
if (declaration.AlterateDecoder == 1)
{
throw new Exception("Don't know how to handle alterate decoder vertex declaration");
}
// Lets convert the RAGE VertexElement declarations to a more DirectX like one...
var rageElements = declaration.DecodeAsVertexElements();
var elements = new List<VertexElement>();
int streamIndex = rageElements[0].StreamIndex;
int offsetInStream = 0;
int[] typeMapping = {0, 15, 0, 16, 0, 1, 2, 3, 5, 4, 14, 0, 0, 0, 0, 0};
int[] usageMapping = {0, 9, 3, 7, 6, 5, 1, 2, 10, 0, 0, 0};
foreach (var rageEl in rageElements)
{
if (rageEl.StreamIndex != streamIndex)
{
streamIndex = rageEl.StreamIndex;
offsetInStream = 0;
}
var el = new VertexElement()
{
Stream = streamIndex,
Type = (VertexElementType) typeMapping[(int) rageEl.Type],
Usage = (VertexElementUsage) usageMapping[(int) rageEl.Usage],
Size = rageEl.Size,
Offset = offsetInStream,
Method = VertexElementMethod.Default,
UsageIndex = rageEl.UsageIndex,
};
offsetInStream += rageEl.Size;
elements.Add(el);
}
elements.Add(VertexElement.End);
Elements = elements.ToArray();
}