当前位置: 首页>>代码示例>>C#>>正文


C# Mesh.GetUVs方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:alex-carlson,项目名称:PixelitisGGJ,代码行数:101,代码来源:z_SplatSet.cs

示例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);
		}
开发者ID:alex-carlson,项目名称:PixelitisGGJ,代码行数:29,代码来源:z_MeshUtility.cs


注:本文中的UnityEngine.Mesh.GetUVs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。