Пример #1
0
    // Should call this from inspector when we change to mega
    public void BuildNormalMapping(Mesh mesh, bool force)
    {
        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 MegaNormMap[verts.Length];

            for (int i = 0; i < verts.Length; i++)
            {
                mapping[i]       = new MegaNormMap();
                mapping[i].faces = FindFacesUsing(verts[i], norms[i]);
            }
        }
    }
Пример #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 MegaNormMap[verts.Length];

            for (int i = 0; i < verts.Length; i++)
            {
                mapping[i]       = new MegaNormMap();
                mapping[i].faces = FindFacesUsing(verts[i], norms[i]);
            }
        }
        //float len = Time.realtimeSinceStartup - t;
        //Debug.Log("Took " + (len * 1000.0f) + "ms");
    }
Пример #3
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 MegaNormMap[verts.Length];

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