本文整理汇总了C#中Builder.AddNormal方法的典型用法代码示例。如果您正苦于以下问题:C# Builder.AddNormal方法的具体用法?C# Builder.AddNormal怎么用?C# Builder.AddNormal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder.AddNormal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parseLine
private static void parseLine(Builder builder, string line)
{
string strippedLine;
if (isEmptyOrComment(line, out strippedLine))
return;
var splitLine = strippedLine.Split(
whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
var keyword = splitLine[0];
var parameterCount = splitLine.Length - 1;
switch (keyword)
{
case "v":
{
if (parameterCount != 4 && parameterCount != 3)
throw new InvalidDataException(
"Vertex must have 3 or 4 coordinates.");
builder.AddVertex(parseVertex(splitLine));
break;
}
case "vt":
{
if (parameterCount != 3 && parameterCount != 2)
throw new InvalidDataException(
"UV Coordinate must have 2 or 3 coordinates.");
builder.AddUV(parseUV(splitLine));
break;
}
case "vn":
{
if (parameterCount != 3)
throw new InvalidDataException(
"Normal must have 3 coordinates.");
builder.AddNormal(parseNormal(splitLine));
break;
}
case "f":
{
if (parameterCount < 3)
throw new InvalidDataException(
"Face must have at least 3 positions.");
builder.AddFace(parseFace(splitLine));
break;
}
default:
{
throw new InvalidDataException(
string.Format("Unknown keyword '{0}'.", keyword));
}
}
}