Ejemplo n.º 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)
        {
            // so for each normal we have a vertex, so find all faces that share that vertex
            tris      = mesh.triangles;
            norms     = mesh.normals;
            facenorms = new Vector3[tris.Length / 3];
            mapping   = new NormMap[verts.Length];

            for (int i = 0; i < verts.Length; i++)
            {
                mapping[i]       = new NormMap();
                mapping[i].faces = FindFacesUsing(verts[i], norms[i]);
            }
        }
        //float len = Time.realtimeSinceStartup - t;
        //Debug.Log("Took " + (len * 1000.0f) + "ms");
    }
Ejemplo n.º 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 )
        {
            // so for each normal we have a vertex, so find all faces that share that vertex
            tris = mesh.triangles;
            norms = mesh.normals;
            facenorms = new Vector3[tris.Length / 3];
            mapping = new NormMap[verts.Length];

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