void Update()
    {
        mcBlob.Update();


        float time        = Time.realtimeSinceStartup;
        Mesh  newWireMesh = null;

        if (uiToggle.isOn)
        {
            newWireMesh = WireframeGenerator.Generate(mcBlob.finalMesh);
        }
        else
        {
            newWireMesh = WireframeGenerator.GenerateFast(mcBlob.finalMesh);
        }

        //
        uiText.text  = "Wireframe generation speed: " + (Time.realtimeSinceStartup - time).ToString("f5") + " ms";
        uiText.text += "\nVertexCount: " + newWireMesh.vertexCount;
        uiText.text += "\nTrinaglesCount: " + (newWireMesh.triangles.Length / 3);



        //Destroy previously generated wirefame mesh
        if (meshFilter.sharedMesh != null)
        {
            DestroyImmediate(meshFilter.sharedMesh);
        }

        //render new wireframe mesh
        meshFilter.sharedMesh = newWireMesh;
    }
Example #2
0
    void Update()
    {
        mcBlob.Update();



        //
        uiText.text  = "GeometryShader does not need mesh with barycentric coordinates. Generating speed: Instantly";
        uiText.text += "\nVertexCount: " + mcBlob.finalMesh.vertexCount + " (same as original)";
        uiText.text += "\nTrinaglesCount: " + (mcBlob.finalMesh.triangles.Length / 3);



        //render new mesh
        meshFilter.sharedMesh = mcBlob.finalMesh;
    }