// Token: 0x060041D3 RID: 16851 RVA: 0x0014E8B4 File Offset: 0x0014CCB4 public void Union() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); CSG.CSG csg = new CSG.CSG(); csg.Construct(this.A.GetComponent <MeshFilter>().sharedMesh, this.A.transform, 0); CSG.CSG csg2 = new CSG.CSG(); csg2.Construct(this.B.GetComponent <MeshFilter>().sharedMesh, this.B.transform, 1); CSG.CSG csg3 = csg.Union(csg2); Mesh sharedMesh = csg3.ToMesh(); this.Result = new GameObject("Union"); DefaultObject defaultObject = this.Result.AddComponent <DefaultObject>(); MeshFilter meshFilter = this.Result.AddComponent <MeshFilter>(); meshFilter.sharedMesh = sharedMesh; MeshRenderer meshRenderer = this.Result.AddComponent <MeshRenderer>(); meshRenderer.sharedMaterials = new Material[] { this.A.GetComponent <MeshRenderer>().sharedMaterial, this.B.GetComponent <MeshRenderer>().sharedMaterial }; if (this.DeleteOriginal) { UnityEngine.Object.DestroyImmediate(this.A); UnityEngine.Object.DestroyImmediate(this.B); } stopwatch.Stop(); defaultObject.GenerationTimeMS = (float)stopwatch.ElapsedMilliseconds; }
public void Union() { var stopWatch = new Stopwatch(); stopWatch.Start(); var csgA = new CSG.CSG(); csgA.Construct(A.GetComponent <MeshFilter>().sharedMesh, A.transform, 0); var csgB = new CSG.CSG(); csgB.Construct(B.GetComponent <MeshFilter>().sharedMesh, B.transform, 1); var substract = csgA.Union(csgB); var newMesh = substract.ToMesh(); Result = new GameObject("Union"); var defObj = Result.AddComponent <DefaultObject>(); var meshFilter = Result.AddComponent <MeshFilter>(); meshFilter.sharedMesh = newMesh; var renderer = Result.AddComponent <MeshRenderer>(); renderer.sharedMaterials = new Material[] { A.GetComponent <MeshRenderer>().sharedMaterial, B.GetComponent <MeshRenderer>().sharedMaterial }; if (DeleteOriginal) { Object.DestroyImmediate(A); Object.DestroyImmediate(B); } stopWatch.Stop(); defObj.GenerationTimeMS = stopWatch.ElapsedMilliseconds; }
public void Union() { var stopWatch = new Stopwatch(); stopWatch.Start(); var csgA = new CSG.CSG(); csgA.Construct(A.GetComponent<MeshFilter>().sharedMesh, A.transform, 0); var csgB = new CSG.CSG(); csgB.Construct(B.GetComponent<MeshFilter>().sharedMesh, B.transform, 1); var substract = csgA.Union(csgB); var newMesh = substract.ToMesh(); Result = new GameObject("Union"); var defObj = Result.AddComponent<DefaultObject>(); var meshFilter = Result.AddComponent<MeshFilter>(); meshFilter.sharedMesh = newMesh; var renderer = Result.AddComponent<MeshRenderer>(); renderer.sharedMaterials = new Material[] { A.GetComponent<MeshRenderer>().sharedMaterial, B.GetComponent<MeshRenderer>().sharedMaterial }; if (DeleteOriginal) { Object.DestroyImmediate(A); Object.DestroyImmediate(B); } stopWatch.Stop(); defObj.GenerationTimeMS = stopWatch.ElapsedMilliseconds; }