public static void FaceGetNumInnerLoops( FaceRef faceRef, out long count) { ThrowOut( SUFaceGetNumInnerLoops( faceRef.intPtr, out count), "Could not get number of inner loops."); }
public static void FaceGetOuterLoop( FaceRef faceRef, LoopRef loopRef) { ThrowOut( FaceGetOuterLoop( faceRef.intPtr, out loopRef.intPtr), "Could not get outer loop."); }
public static void FaceGetNumEdges( FaceRef faceRef, out long numEdges) { ThrowOut( SUFaceGetNumEdges( faceRef.intPtr, out numEdges), "Could not get number of edges."); }
public static void FaceGetFrontMaterial( FaceRef faceRef, MaterialRef materialRef) { ThrowOut( SUFaceGetFrontMaterial( faceRef.intPtr, out materialRef.intPtr), "Could not get face front material"); }
public static void FaceCreate( FaceRef faceRef, Point3D[] vertices, LoopInputRef outerLoop) { ThrowOut( SUFaceCreate( out faceRef.intPtr, vertices, ref outerLoop.intPtr), "Could not create face."); }
public static void FaceGetUVHelper( FaceRef faceRef, bool front, bool back, TextureWriterRef textureWriterRef, UVHelperRef uvHelperRef) { ThrowOut( SUFaceGetUVHelper( faceRef.intPtr, front, back, textureWriterRef.intPtr, out uvHelperRef.intPtr), "Could not get UVHelper."); }
public static void FaceGetEdges( FaceRef faceRef, long len, EdgeRef[] edgeRefs, out long count) { IntPtr[] intPtrs = new IntPtr[edgeRefs.Length]; ThrowOut( SUFaceGetEdges( faceRef.intPtr, len, intPtrs, out count), "Could not get face edges."); for (int i = 0; i < edgeRefs.Length; ++i) { edgeRefs[i] = new EdgeRef(); edgeRefs[i].intPtr = intPtrs[i]; } }
public static void EntitiesGetFaces( EntitiesRef entitiesRef, long len, FaceRef[] faceRefs, out long count) { IntPtr[] intPtrs = new IntPtr[faceRefs.Length]; ThrowOut( SUEntitiesGetFaces( entitiesRef.intPtr, len, intPtrs, out count), "Could not get entities faces."); for (int i = 0; i < faceRefs.Length; ++i) { faceRefs[i] = new FaceRef(); faceRefs[i].intPtr = intPtrs[i]; } }
public static void FaceGetInnerLoops( FaceRef faceRef, long len, LoopRef[] loopRefs, out long count) { IntPtr[] intPtrs = new IntPtr[loopRefs.Length]; ThrowOut( SUFaceGetInnerLoops( faceRef.intPtr, len, intPtrs, out count), "Could not get inner loops."); for (int i = 0; i < loopRefs.Length; ++i) { loopRefs[i] = new LoopRef(); loopRefs[i].intPtr = intPtrs[i]; } }
private void Start() { audioSource = GetComponent <AudioSource>(); if (audioSource.clip == null) { missingClipWarning.SetActive(value: true); } ico = pb_ShapeGenerator.IcosahedronGenerator(icoRadius, icoSubdivisions); pb_Face[] faces = ico.faces; pb_Face[] array = faces; foreach (pb_Face pb_Face in array) { pb_Face.material = material; } ico.Extrude(faces, ExtrudeMethod.IndividualFaces, startingExtrusion); ico.ToMesh(); ico.Refresh(); outsides = new FaceRef[faces.Length]; Dictionary <int, int> lookup = ico.sharedIndices.ToDictionary(); for (int j = 0; j < faces.Length; j++) { outsides[j] = new FaceRef(faces[j], pb_Math.Normal(ico, faces[j]), ico.sharedIndices.AllIndicesWithValues(lookup, faces[j].distinctIndices).ToArray()); } original_vertices = new Vector3[ico.vertices.Length]; Array.Copy(ico.vertices, original_vertices, ico.vertices.Length); displaced_vertices = ico.vertices; icoMesh = ico.msh; icoTransform = ico.transform; faces_length = outsides.Length; icoPosition = icoTransform.position; waveform.positionCount = 1024; if (bounceWaveform) { waveform.transform.parent = icoTransform; } audioSource.Play(); }
/** * 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. #if !PROTOTYPE foreach (pb_Face f in shell) { f.SetMaterial(material); } #else ico.gameObject.GetComponent <MeshRenderer>().sharedMaterial = material; #endif 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(); }
/** * 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(); }