string[] chars = line.Split(' ')
//根据第一个字符来判断数据的类型
switch(chars[0])
{
case "v":
//处理顶点
this.vertexArrayList.Add(new Vector3(
ConvertToFloat(chars[1]),
ConvertToFloat(chars[2]),
ConvertToFloat(chars[3]))
)
break
case "vn":
//处理法线
this.normalArrayList.Add(new Vector3(
ConvertToFloat(chars[1]),
ConvertToFloat(chars[2]),
ConvertToFloat(chars[3]))
)
break
case "vt":
//处理UV
this.uvArrayList.Add(new Vector3(
ConvertToFloat(chars[1]),
ConvertToFloat(chars[2]))
)
break
case "f":
//处理面
GetTriangleList(chars)
break
}
}