Пример #1
0
    // Should call this from inspector when we change to mega
    public void BuildNormalMapping(Mesh mesh, bool force)
    {
        //float t = Time.realtimeSinceStartup;
        if (mapping == null || mapping.Length == 0 || force)
        {
            Debug.Log("Build norm data");
            // so for each normal we have a vertex, so find all faces that share that vertex
            otris     = mesh.triangles;
            norms     = mesh.normals;
            facenorms = new Vector3[otris.Length / 3];
            mapping   = new MegaRopeNormMap[overts.Length];

            for (int i = 0; i < overts.Length; i++)
            {
                mapping[i]       = new MegaRopeNormMap();
                mapping[i].faces = FindFacesUsing(overts[i], norms[i]);
            }
        }
        //float len = Time.realtimeSinceStartup - t;
        //Debug.Log("Took " + (len * 1000.0f) + "ms");
    }
Пример #2
0
    // Should call this from inspector when we change to mega
    public void BuildNormalMapping(Mesh mesh, bool force)
    {
        //float t = Time.realtimeSinceStartup;
        if ( mapping == null || mapping.Length == 0 || force )
        {
            Debug.Log("Build norm data");
            // so for each normal we have a vertex, so find all faces that share that vertex
            otris = mesh.triangles;
            norms = mesh.normals;
            facenorms = new Vector3[otris.Length / 3];
            mapping = new MegaRopeNormMap[overts.Length];

            for ( int i = 0; i < overts.Length; i++ )
            {
                mapping[i] = new MegaRopeNormMap();
                mapping[i].faces = FindFacesUsing(overts[i], norms[i]);
            }
        }
        //float len = Time.realtimeSinceStartup - t;
        //Debug.Log("Took " + (len * 1000.0f) + "ms");
    }