本文整理汇总了C#中UnityEngine.Mesh.GetUVs方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.GetUVs方法的具体用法?C# Mesh.GetUVs怎么用?C# Mesh.GetUVs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Mesh
的用法示例。
在下文中一共展示了Mesh.GetUVs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: z_SplatSet
public z_SplatSet(Mesh mesh, z_MeshChannel[] channelMap)
{
List<Vector4> uv0 = new List<Vector4>(),
uv2 = new List<Vector4>(),
uv3 = new List<Vector4>(),
uv4 = new List<Vector4>();
mesh.GetUVs(0, uv0);
mesh.GetUVs(1, uv2);
mesh.GetUVs(2, uv3);
mesh.GetUVs(3, uv4);
Color32[] color = mesh.colors32;
Vector4[] tangent = mesh.tangents;
int vertexCount = mesh.vertexCount;
int channelCount = channelMap.Length;
this.channelMap = channelMap;
this.weights = z_Util.Fill<z_SplatWeight>((index) => { return new z_SplatWeight(channelCount * 4); }, vertexCount);
for(int n = 0; n < channelCount; n++)
{
int index = n * COMPONENTS_PER_ATTRIBUTE;
switch(channelMap[n])
{
case z_MeshChannel.UV0:
{
if(uv0 == null || uv0.Count != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, uv0[i]);
break;
}
case z_MeshChannel.UV2:
{
if(uv2 == null || uv2.Count != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, uv2[i]);
break;
}
case z_MeshChannel.UV3:
{
if(uv3 == null || uv3.Count != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, uv3[i]);
break;
}
case z_MeshChannel.UV4:
{
if(uv4 == null || uv4.Count != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, uv4[i]);
break;
}
case z_MeshChannel.COLOR:
{
if(color == null || color.Length != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, color[i]);
break;
}
case z_MeshChannel.TANGENT:
{
if(tangent == null || tangent.Length != vertexCount)
goto case z_MeshChannel.NULL;
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, tangent[i]);
break;
}
case z_MeshChannel.NULL:
{
for(int i = 0; i < vertexCount; i++)
this.weights[i].Set(index, Color32_Black);
break;
//.........这里部分代码省略.........
示例2: Copy
/**
* Copy @src mesh values to @dest
*/
public static void Copy(Mesh dest, Mesh src)
{
dest.Clear();
dest.vertices = src.vertices;
List<Vector4> uvs = new List<Vector4>();
src.GetUVs(0, uvs); dest.SetUVs(0, uvs);
src.GetUVs(1, uvs); dest.SetUVs(1, uvs);
src.GetUVs(2, uvs); dest.SetUVs(2, uvs);
src.GetUVs(3, uvs); dest.SetUVs(3, uvs);
dest.normals = src.normals;
dest.tangents = src.tangents;
dest.boneWeights = src.boneWeights;
dest.colors = src.colors;
dest.colors32 = src.colors32;
dest.bindposes = src.bindposes;
dest.subMeshCount = src.subMeshCount;
for(int i = 0; i < src.subMeshCount; i++)
dest.SetIndices(src.GetIndices(i), src.GetTopology(i), i);
dest.name = z_Util.IncrementPrefix("z", src.name);
}