Ejemplo n.º 1
0
 public void UpdateUVsByExternal(NoiseAnimator noiseAnimator)
 {
     for (int i = 0; i < 6; i++)
     {
         if (meshFilters[i].gameObject.activeSelf && terrainFaces[i] != null)
         {
             terrainFaces[i].ConstructUVsFromNoise(colorGenerator, noiseAnimator);
         }
     }
 }
Ejemplo n.º 2
0
    public void ConstructUVsFromNoise(ColorGenerator colorGenerator, NoiseAnimator noiseAnimator)
    {
        Vector2[] uv = (mesh.uv.Length == resolution * resolution) ? mesh.uv : new Vector2[resolution * resolution];

        for (int y = 0; y < resolution; y++)
        {
            for (int x = 0; x < resolution; x++)
            {
                int i = x + y * resolution;

                //uv[i].x = colorGenerator.BiomePercentFromPoint(pointOnUnitSphere);
                float unscaledElevation = shapeGenerator.CalculateUnscaledElevation(pointsOnUnitSphere[i]);
                //x axis for biones
                uv[i].y = unscaledElevation;
                if (noiseAnimator.settings.noiseAnimatorType == NoiseAnimator.NoiseAnimatorType.All)
                {
                    uv[i].x = noiseAnimator.Evaluate(pointsOnUnitSphere[i]);
                }
                else if (noiseAnimator.settings.noiseAnimatorType == NoiseAnimator.NoiseAnimatorType.Ocean)
                {
                    if (unscaledElevation < 0)
                    {
                        uv[i].x = noiseAnimator.Evaluate(pointsOnUnitSphere[i]);
                    }
                    else
                    {
                        uv[i].x = 1;
                    }
                }
                else if (noiseAnimator.settings.noiseAnimatorType == NoiseAnimator.NoiseAnimatorType.Terrain)
                {
                    if (unscaledElevation > 0)
                    {
                        uv[i].x = noiseAnimator.Evaluate(pointsOnUnitSphere[i]);
                    }
                    else
                    {
                        uv[i].x = 1;
                    }
                }
            }
        }
        mesh.uv = uv;
    }
Ejemplo n.º 3
0
 private void OnEnable()
 {
     noiseAnimator = (NoiseAnimator)target;
 }