本文整理汇总了C#中pb_Object.SewUVs方法的典型用法代码示例。如果您正苦于以下问题:C# pb_Object.SewUVs方法的具体用法?C# pb_Object.SewUVs怎么用?C# pb_Object.SewUVs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_Object
的用法示例。
在下文中一共展示了pb_Object.SewUVs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectFacesAuto
/**
* Projects UVs on all passed faces, automatically updating the sharedIndicesUV table
* as required (only associates vertices that share a seam).
*/
public static void ProjectFacesAuto(pb_Object pb, pb_Face[] faces)
{
int[] ind = pb_Face.AllTrianglesDistinct(faces);
Vector3[] verts = pbUtil.ValuesWithIndices(pb.vertices, ind);
/* get average face normal */
Vector3 nrm = Vector3.zero;
foreach(pb_Face face in faces)
nrm += pb_Math.Normal(pb, face);
nrm /= (float)faces.Length;
/* project uv coordinates */
Vector2[] uvs = pb_Math.PlanarProject(verts, nrm);
/* re-assign new projected coords back into full uv array */
Vector2[] rebuiltUVs = pb.uv;
for(int i = 0; i < ind.Length; i++)
rebuiltUVs[ind[i]] = uvs[i];
/* and set the msh uv array using the new coordintaes */
pb.SetUV(rebuiltUVs);
pb.msh.uv = rebuiltUVs;
/* now go trhough and set all adjacent face groups to use matching element groups */
foreach(pb_Face f in faces)
{
f.elementGroup = -1;
SplitUVs(pb, f.distinctIndices);
}
// pb_IntArray[] sharedIndices = pb.sharedIndices;
pb.SewUVs(pb_Face.AllTrianglesDistinct(faces), .001f);
// foreach(pb_Face f in faces)
// {
// foreach(pb_Edge e in f.edges)
// {
// foreach(pb_Face f2 in faces)
// {
// if(f2 == f) continue;
// int index = f2.edges.IndexOf(e, sharedIndices);
// // Found an aligned edge
// if( index > -1 )
// {
// if(f.elementGroup < 0)
// {
// if(f2.elementGroup < 0)
// {
// f.elementGroup = pb.UnusedElementGroup(0);
// f2.elementGroup = f.elementGroup;
// }
// else
// {
// f.elementGroup = f2.elementGroup;
// }
// }
// else
// {
// if(f2.elementGroup < 0)
// f2.elementGroup = f.elementGroup;
// else
// {
// foreach(pb_Face iter in System.Array.FindAll(faces, element => element.elementGroup == f2.elementGroup))
// iter.elementGroup = f.elementGroup;
// }
// }
// }
// }
// }
// }
}