Example #1
0
        public void Inverse()
        {
            var stopWatch = new Stopwatch();
            stopWatch.Start();

            var csgA = new CSG.CSG();
            csgA.Construct(A.GetComponent<MeshFilter>().sharedMesh, A.transform, 0);

            var substract = csgA.Inverse();
            var newMesh = substract.ToMesh();

            Result = new GameObject("Inverse");
            var defObj = Result.AddComponent<DefaultObject>();
            var meshFilter = Result.AddComponent<MeshFilter>();
            meshFilter.sharedMesh = newMesh;
            var renderer = Result.AddComponent<MeshRenderer>();
            renderer.sharedMaterial = new Material(A.GetComponent<MeshRenderer>().sharedMaterial);

            if (DeleteOriginal)
            {
                Object.DestroyImmediate(A);
            }

            stopWatch.Stop();
            defObj.GenerationTimeMS = stopWatch.ElapsedMilliseconds;
        }
Example #2
0
        // Token: 0x060041D2 RID: 16850 RVA: 0x0014E7E0 File Offset: 0x0014CBE0
        public void Inverse()
        {
            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       = csg.Inverse();
            Mesh    sharedMesh = csg2.ToMesh();

            this.Result = new GameObject("Inverse");
            DefaultObject defaultObject = this.Result.AddComponent <DefaultObject>();
            MeshFilter    meshFilter    = this.Result.AddComponent <MeshFilter>();

            meshFilter.sharedMesh = sharedMesh;
            MeshRenderer meshRenderer = this.Result.AddComponent <MeshRenderer>();

            meshRenderer.sharedMaterial = new Material(this.A.GetComponent <MeshRenderer>().sharedMaterial);
            if (this.DeleteOriginal)
            {
                UnityEngine.Object.DestroyImmediate(this.A);
            }
            stopwatch.Stop();
            defaultObject.GenerationTimeMS = (float)stopwatch.ElapsedMilliseconds;
        }
Example #3
0
        public void Inverse()
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var csgA = new CSG.CSG();

            csgA.Construct(A.GetComponent <MeshFilter>().sharedMesh, A.transform, 0);

            var substract = csgA.Inverse();
            var newMesh   = substract.ToMesh();

            Result = new GameObject("Inverse");
            var defObj     = Result.AddComponent <DefaultObject>();
            var meshFilter = Result.AddComponent <MeshFilter>();

            meshFilter.sharedMesh = newMesh;
            var renderer = Result.AddComponent <MeshRenderer>();

            renderer.sharedMaterial = new Material(A.GetComponent <MeshRenderer>().sharedMaterial);

            if (DeleteOriginal)
            {
                Object.DestroyImmediate(A);
            }

            stopWatch.Stop();
            defObj.GenerationTimeMS = stopWatch.ElapsedMilliseconds;
        }