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


C# pb_Object.Extrude方法代码示例

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


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

示例1: Start

		/**
		 * Creates the icosphere, and loads all the cache information.
		 */
		void Start()
		{
			audioSource = GetComponent<AudioSource>();

			if( audioSource.clip == null )
				missingClipWarning.SetActive(true);

			// Create a new icosphere.
			ico = pb_ShapeGenerator.IcosahedronGenerator(icoRadius, icoSubdivisions);

			// Shell is all the faces on the new icosphere.
			pb_Face[] shell = ico.faces;
				
			// Materials are set per-face on pb_Object meshes.  pb_Objects will automatically
			// condense the mesh to the smallest set of subMeshes possible based on materials.
			foreach(pb_Face f in shell)
				f.SetMaterial( material );

			pb_Face[] connectingFaces;

			// Extrude all faces on the icosphere by a small amount.  The third boolean parameter
			// specifies that extrusion should treat each face as an individual, not try to group
			// all faces together.
			ico.Extrude(shell, startingExtrusion, false, out connectingFaces);

			// ToMesh builds the mesh positions, submesh, and triangle arrays.  Call after adding
			// or deleting vertices, or changing face properties.
			ico.ToMesh();

			// Refresh builds the normals, tangents, and UVs.
			ico.Refresh();

			outsides = new FaceRef[shell.Length];
			Dictionary<int, int> lookup = ico.sharedIndices.ToDictionary();

			// Populate the outsides[] cache.  This is a reference to the tops of each extruded column, including
			// copies of the sharedIndices.
			for(int i = 0; i < shell.Length; ++i)
				outsides[i] = new FaceRef( 	shell[i],
											pb_Math.Normal(ico, shell[i]),
											ico.sharedIndices.AllIndicesWithValues(lookup, shell[i].distinctIndices).ToArray()
											);

			// Store copy of positions array un-modified
			original_vertices = new Vector3[ico.vertices.Length];
			System.Array.Copy(ico.vertices, original_vertices, ico.vertices.Length);

			// displaced_vertices should mirror icosphere mesh vertices.
			displaced_vertices = ico.vertices;

			icoMesh = ico.msh;
			icoTransform = ico.transform;

			faces_length = (float)outsides.Length;

			// Build the waveform ring.
			icoPosition = icoTransform.position;
			waveform.SetVertexCount(WAVEFORM_SAMPLES);

			if( bounceWaveform )
				waveform.transform.parent = icoTransform;

			audioSource.Play();
		}
开发者ID:DannyBoyThomas,项目名称:Project-Z,代码行数:67,代码来源:IcoBumpin.cs


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