Example #1
0
 static void DrawMenusAnim()
 {
     for (int x = -3; x < Core.renderer.width + 3; x++)
     {
         for (int y = -3; y < Core.renderer.height + 3; y++)
         {
             if (x % 3 != 0 || y % 3 != 0)
             {
                 continue;
             }
             float noiseX   = (float)perlin.Get(x / 10f, y / 10f, _menusAnimTime / 2f) - 0.5f;
             float noiseY   = (float)perlin.Get(x / 10f, y / 10f, _menusAnimTime / 2f + 100f) - 0.5f;
             float noise    = MathF.Abs(noiseX * noiseY);
             float xOffset  = (Core.renderer.mousePositionF.X / Core.renderer.width - 0.5f) * noise * -100f;
             float yOffset  = (Core.renderer.mousePositionF.Y / Core.renderer.width - 0.5f) * noise * -100f;
             Color useColor = Renderer.AnimateColor(noise, ColorScheme.GetColor("background"),
                                                    ColorScheme.GetColor("menus_anim_max"), 30f);
             float xPos     = x + noiseX * 10f + xOffset;
             float yPos     = y + noiseY * 10f + yOffset;
             int   flooredX = (int)xPos;
             int   flooredY = (int)yPos;
             for (int useX = flooredX; useX <= flooredX + 1; useX++)
             {
                 for (int useY = flooredY; useY <= flooredY + 1; useY++)
                 {
                     float percentX = 1f - MathF.Abs(xPos - useX);
                     float percentY = 1f - MathF.Abs(yPos - useY);
                     float percent  = percentX * percentY;
                     Color posColor = Renderer.LerpColors(ColorScheme.GetColor("background"), useColor, percent);
                     Core.renderer.SetCellColor(new Vector2i(useX, useY),
                                                ColorScheme.GetColor("transparent"), posColor);
                 }
             }
         }
     }
     _menusAnimTime += Core.deltaTime * menusAnimBPM / 120f;
 }
    Vector3[] GenerateVertices()
    {
        Perlin noise = new Perlin();

        int sideVertices = size + 1;
        Vector3[] vertices = new Vector3[sideVertices * sideVertices];

        for (int gx = 0; gx < sideVertices; gx++) {
            for (int gz = 0; gz < sideVertices; gz++) {
                float x = gx * cellSize;
                float z = gz * cellSize;
                float height = noise.Get(x, z);
                vertices[gx * sideVertices + gz] = new Vector3(gx * cellSize, height, gz * cellSize);
            }
        }

        return vertices;
    }
    Vector3[] GenVertices()
    {
        Perlin noise = new Perlin ();

        int w = m_size + 1;
        int l = m_size + 1;
        Vector3[] result = new Vector3[w * l];
        for(int cx = 0; cx < w; cx++) {
            for(int cz = 0; cz < l; cz++) {
                int i = cx * l + cz;
                float x = cx * m_cellSize;
                float z = cz * m_cellSize;
                float height = 3.0f * noise.Get (x, z);
                result[i] = new Vector3(x, height, z);
            }
        }
        return result;
    }
    Vector3[] GenerateVertices()
    {
        Perlin noise = new Perlin();

        int sideVertices = size + 1;

        Vector3[] vertices = new Vector3[sideVertices * sideVertices];

        for (int gx = 0; gx < sideVertices; gx++)
        {
            for (int gz = 0; gz < sideVertices; gz++)
            {
                float x      = gx * cellSize;
                float z      = gz * cellSize;
                float height = noise.Get(x, z);
                vertices[gx * sideVertices + gz] = new Vector3(gx * cellSize, height, gz * cellSize);
            }
        }

        return(vertices);
    }