本文整理汇总了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();
}