예제 #1
0
파일: SoftShell.cs 프로젝트: jonigata/Tcf
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            var meshFilter = GetComponent <MeshFilter>();
            var mesh       = meshFilter.sharedMesh;


            Vector3[] vertices     = mesh.vertices;
            int       vertex_count = mesh.vertices.Length;

            int[] triangles      = mesh.triangles;
            int   triangle_count = mesh.triangles.Length / 3;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            nativePartixSoftShell = world.CreateSoftShell(
                this,
                vertex_count, vertices,
                triangle_count, triangles,
                32768, transform.position, transform.lossyScale.x, 1.0f);
            sw.Stop();
            UnityEngine.Debug.Log(sw.ElapsedMilliseconds + "ms");
        }
예제 #2
0
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            var mesh = BuildTriangleMesh();

            Vector3[] vertices     = mesh.vertices;
            int       vertex_count = mesh.vertices.Length;

            int[] triangles      = mesh.triangles;
            int   triangle_count = mesh.triangles.Length / 3;

            UnityEngine.Debug.Log(vertices.Length);
            UnityEngine.Debug.Log(vertex_count);
            UnityEngine.Debug.Log(triangles.Length);
            UnityEngine.Debug.Log(triangle_count);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            nativePartixSoftShell = world.CreateSoftShell(
                this,
                vertex_count, vertices,
                triangle_count, triangles,
                128, transform.position, transform.lossyScale.x, 1.0f);
            if (duplicateOffset != Vector3.zero)
            {
                nativeDup = world.CreateSoftShell(
                    this,
                    vertex_count, vertices,
                    triangle_count, triangles,
                    128, transform.position + duplicateOffset,
                    transform.lossyScale.x, 1.0f);
            }
            sw.Stop();
            UnityEngine.Debug.Log(sw.ElapsedMilliseconds + "ms");
        }