本文整理汇总了C#中Vector3D.ToVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.ToVector2方法的具体用法?C# Vector3D.ToVector2怎么用?C# Vector3D.ToVector2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3D
的用法示例。
在下文中一共展示了Vector3D.ToVector2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractVertices
private IEnumerable<PosNormalTexTanSkinned> ExtractVertices(Mesh mesh, IReadOnlyDictionary<uint, List<VertexWeight>> vertToBoneWeights, bool flipTexY)
{
var verts = new List<PosNormalTexTanSkinned>();
for (var i = 0; i < mesh.VertexCount; i++) {
var pos = mesh.HasVertices ? mesh.Vertices[i].ToVector3() : new Vector3();
_min = Vector3.Minimize(_min, pos);
_max = Vector3.Maximize(_max, pos);
var norm = mesh.HasNormals ? mesh.Normals[i] : new Vector3D();
var tan = mesh.HasTangentBasis ? mesh.Tangents[i] : new Vector3D();
var texC = new Vector3D();
if (mesh.HasTextureCoords(0)) {
var coord = mesh.GetTextureCoords(0)[i];
if (flipTexY) {
coord.Y = -coord.Y;
}
texC = coord;
}
var weights = vertToBoneWeights[(uint) i].Select(w => w.Weight).ToArray();
var boneIndices = vertToBoneWeights[(uint) i].Select(w => (byte) w.VertexID).ToArray();
var v = new PosNormalTexTanSkinned(pos, norm.ToVector3(), texC.ToVector2(), tan.ToVector3(), weights.First(), boneIndices);
verts.Add(v);
}
return verts;
}