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


C# Skin.AddVertexWeight方法代码示例

本文整理汇总了C#中Skin.AddVertexWeight方法的典型用法代码示例。如果您正苦于以下问题:C# Skin.AddVertexWeight方法的具体用法?C# Skin.AddVertexWeight怎么用?C# Skin.AddVertexWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skin的用法示例。


在下文中一共展示了Skin.AddVertexWeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateControllerList

		///-------------------------------------------------------------------------------------------------
		/// <summary>	Creates controllers to skin each geometry in the collada file. </summary>
		///-------------------------------------------------------------------------------------------------
		void CreateControllerList()
		{
			var boneList = mModelDataProvider.GetBones();

			// if there are no nodes then no skinning is possible
			if (boneList.Count == 0)
			{
				return;
			}

			// create a controller for each geometry
			var geometrySetList = mModelDataProvider.GetGeometries();
			for (int i = 0; i < geometrySetList.Count; i++)
			{
				var geometrySet = geometrySetList[i];

				var skinData = new Skin(geometrySet.Name, listGeometry[i].ID);

				//  create a list of vertex weights from all of the geometry parts
				foreach (var part in geometrySet.Geometry.Parts)
				{
					foreach (var vertex in part.UncompressedVertices)
					{
						var vertex_weight = new Skin.VertexWeight();

						int node1 = vertex.NodeIndex1;
						int node2 = vertex.NodeIndex2;

						// if the bone index count is 0 then the index references the main node list,
						// otherwise it references a local node map for this part
						if (part.NodeMapCount != 0)
						{
							node1 = part.NodeMap[node1];
							node2 = (node2 != -1 ? part.NodeMap[node2].Value : node2);
						}

						vertex_weight.AddWeight(node1, vertex.NodeWeight1);

						// if the first weight is 1 the vertex is weighted to one bone only so the second weight is not needed
						if (vertex.NodeWeight1 != 1)
						{
							vertex_weight.AddWeight(node2, vertex.NodeWeight2);
						}

						skinData.AddVertexWeight(vertex_weight);
					}
				}

				// create the controller element
				CreateSkinController(skinData);
			}
		}
开发者ID:guardian2433,项目名称:open-sauce,代码行数:55,代码来源:ExporterModel.cs


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