void Init() { //transform.position = Vector3.zero; matcount = 0; maintris = 0; mats.Clear(); if (mainObj != null) { MeshFilter mf = mainObj.GetComponent <MeshFilter>(); Mesh ms = mf.sharedMesh; mverts = ms.vertices; muvs = ms.uv; MeshRenderer mr = mainObj.GetComponent <MeshRenderer>(); mainMats = mr.sharedMaterials; matcount += mainMats.Length; mats.AddRange(mainMats); mainlofttris.Clear(); for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); maintris += lt.sourcetris.Length; mainlofttris.Add(lt); } } }
public void Init() { matcount = 0; mats.Clear(); for (int r = 0; r < rules.Count; r++) { MegaLoftRule rule = rules[r]; rule.lofttris.Clear(); if (rule.obj) { MeshFilter mf = rule.obj.GetComponent <MeshFilter>(); if (mf) { Mesh ms = mf.sharedMesh; rule.bounds = ms.bounds; rule.verts = ms.vertices; rule.uvs = ms.uv; rule.tris = ms.triangles; MeshRenderer mr = rule.obj.GetComponent <MeshRenderer>(); rule.mats = mr.sharedMaterials; matcount += rule.mats.Length; mats.AddRange(rule.mats); rule.numtris = 0; for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); rule.numtris += lt.sourcetris.Length; rule.lofttris.Add(lt); } } } } //transform.position = Vector3.zero; }
void Init() { //transform.position = Vector3.zero; matcount = 0; starttris = maintris = endtris = 0; mats.Clear(); startlofttris.Clear(); mainlofttris.Clear(); endlofttris.Clear(); // need to get alpha for each vert in the source mesh if (startObj != null && StartEnabled) { MeshFilter mf = startObj.GetComponent <MeshFilter>(); if (mf) { Mesh ms = mf.sharedMesh; startBounds = ms.bounds; sverts = ms.vertices; suvs = ms.uv; MeshRenderer mr = startObj.GetComponent <MeshRenderer>(); startMats = mr.sharedMaterials; matcount += startMats.Length; mats.AddRange(startMats); for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); starttris += lt.sourcetris.Length; startlofttris.Add(lt); } } } if (mainObj != null && MainEnabled) { MeshFilter mf = mainObj.GetComponent <MeshFilter>(); if (mf) { Mesh ms = mf.sharedMesh; mainBounds = ms.bounds; mverts = ms.vertices; muvs = ms.uv; MeshRenderer mr = mainObj.GetComponent <MeshRenderer>(); mainMats = mr.sharedMaterials; matcount += mainMats.Length; mats.AddRange(mainMats); for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); maintris += lt.sourcetris.Length; mainlofttris.Add(lt); } } } if (endObj != null && EndEnabled) { MeshFilter mf = endObj.GetComponent <MeshFilter>(); if (mf) { Mesh ms = mf.sharedMesh; endBounds = ms.bounds; everts = ms.vertices; euvs = ms.uv; MeshRenderer mr = endObj.GetComponent <MeshRenderer>(); endMats = mr.sharedMaterials; matcount += endMats.Length; mats.AddRange(endMats); for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); endtris += lt.sourcetris.Length; endlofttris.Add(lt); } } } }
void Init() { //transform.position = Vector3.zero; matcount = 0; starttris = maintris = endtris = 0; mats.Clear(); startlofttris.Clear(); mainlofttris.Clear(); endlofttris.Clear(); // need to get alpha for each vert in the source mesh if ( startObj != null && StartEnabled ) { MeshFilter mf = startObj.GetComponent<MeshFilter>(); if ( mf ) { Mesh ms = mf.sharedMesh; startBounds = ms.bounds; sverts = ms.vertices; suvs = ms.uv; MeshRenderer mr = startObj.GetComponent<MeshRenderer>(); startMats = mr.sharedMaterials; matcount += startMats.Length; mats.AddRange(startMats); for ( int i = 0; i < ms.subMeshCount; i++ ) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); starttris += lt.sourcetris.Length; startlofttris.Add(lt); } } } if ( mainObj != null && MainEnabled ) { MeshFilter mf = mainObj.GetComponent<MeshFilter>(); if ( mf ) { Mesh ms = mf.sharedMesh; mainBounds = ms.bounds; mverts = ms.vertices; muvs = ms.uv; MeshRenderer mr = mainObj.GetComponent<MeshRenderer>(); mainMats = mr.sharedMaterials; matcount += mainMats.Length; mats.AddRange(mainMats); for ( int i = 0; i < ms.subMeshCount; i++ ) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); maintris += lt.sourcetris.Length; mainlofttris.Add(lt); } } } if ( endObj != null && EndEnabled ) { MeshFilter mf = endObj.GetComponent<MeshFilter>(); if ( mf ) { Mesh ms = mf.sharedMesh; endBounds = ms.bounds; everts = ms.vertices; euvs = ms.uv; MeshRenderer mr = endObj.GetComponent<MeshRenderer>(); endMats = mr.sharedMaterials; matcount += endMats.Length; mats.AddRange(endMats); for ( int i = 0; i < ms.subMeshCount; i++ ) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); endtris += lt.sourcetris.Length; endlofttris.Add(lt); } } } }
public void Init() { matcount = 0; mats.Clear(); for ( int r = 0; r < rules.Count; r++ ) { MegaLoftRule rule = rules[r]; rule.lofttris.Clear(); if ( rule.obj ) { MeshFilter mf = rule.obj.GetComponent<MeshFilter>(); if ( mf ) { Mesh ms = mf.sharedMesh; rule.bounds = ms.bounds; rule.verts = ms.vertices; rule.uvs = ms.uv; rule.tris = ms.triangles; MeshRenderer mr = rule.obj.GetComponent<MeshRenderer>(); rule.mats = mr.sharedMaterials; matcount += rule.mats.Length; mats.AddRange(rule.mats); rule.numtris = 0; for ( int i = 0; i < ms.subMeshCount; i++ ) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); rule.numtris += lt.sourcetris.Length; rule.lofttris.Add(lt); } } } } //transform.position = Vector3.zero; }
void Init() { //transform.position = Vector3.zero; matcount = 0; maintris = 0; mats.Clear(); if ( mainObj != null ) { MeshFilter mf = mainObj.GetComponent<MeshFilter>(); Mesh ms = mf.sharedMesh; mverts = ms.vertices; muvs = ms.uv; MeshRenderer mr = mainObj.GetComponent<MeshRenderer>(); mainMats = mr.sharedMaterials; matcount += mainMats.Length; mats.AddRange(mainMats); mainlofttris.Clear(); for ( int i = 0; i < ms.subMeshCount; i++ ) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); maintris += lt.sourcetris.Length; mainlofttris.Add(lt); } } }