コード例 #1
0
    void Rebuild()
    {
        noise.Compute();
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                float   xCoord = (i / (float)width);
                float   yCoord = (j / (float)height);
                Vector2 r      = /*Quaternion.AngleAxis(rotation, Vector3.forward) * */ new Vector2(xCoord, yCoord);

                if (noise.colored)
                {
                    Color c = noise.ResolveAsColor(r.x, r.y);
                    texture.SetPixel(i, j, c);
                }
                else
                {
                    float n = noise.Resolve(r.x, r.y);
                    texture.SetPixel(i, j, n * Color.white);
                }
            }
        }
        texture.Apply();
    }
コード例 #2
0
    void Rebuild()
    {
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                float   xCoord = (i / (float)width) + offset.x;
                float   yCoord = (j / (float)height) + offset.y;
                Vector2 r      = Quaternion.AngleAxis(rotation, Vector3.forward) * new Vector2(xCoord, yCoord);

                if (noiseBox.colored)
                {
                    Color c = noiseBox.ResolveAsColor(r.x, r.y);
                    texture.SetPixel(i, j, c);
                }
                else
                {
                    float n = noiseBox.Resolve(r.x, r.y);
                    texture.SetPixel(i, j, n * fillColor + (1 - n) * secondary);
                }
            }
        }
        texture.Apply();
    }