本文整理汇总了C#中pb_Object.SplitUVs方法的典型用法代码示例。如果您正苦于以下问题:C# pb_Object.SplitUVs方法的具体用法?C# pb_Object.SplitUVs怎么用?C# pb_Object.SplitUVs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_Object
的用法示例。
在下文中一共展示了pb_Object.SplitUVs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAutoUV
/**
* Sets the passed faces to use Auto or Manual UVs, and (if previously manual) splits any vertex connections.
*/
public static void SetAutoUV(pb_Object pb, pb_Face[] faces, bool auto)
{
if(auto)
{
faces = System.Array.FindAll(faces, x => x.manualUV).ToArray(); // only operate on faces that were previously manual
pb.SplitUVs( pb_Face.AllTriangles(faces) );
Vector2[][] uv_origins = new Vector2[faces.Length][];
for(int i = 0; i < faces.Length; i++)
uv_origins[i] = pb.GetUVs(faces[i].distinctIndices);
for(int f = 0; f < faces.Length; f++)
{
faces[f].uv.Reset();
faces[f].manualUV = !auto;
faces[f].elementGroup = -1;
}
pb.RefreshUV(faces);
for(int i = 0; i < faces.Length; i++)
{
pb_Transform2D transform = MatchCoordinates(pb.GetUVs(faces[i].distinctIndices), uv_origins[i]);
faces[i].uv.offset = -transform.position;
faces[i].uv.rotation = transform.rotation;
if( Mathf.Abs(transform.scale.sqrMagnitude - 2f) > .1f )
faces[i].uv.scale = transform.scale;
}
}
else
{
foreach(pb_Face f in faces)
{
f.textureGroup = -1;
f.manualUV = !auto;
}
}
}