예제 #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow) && counter > 0)
        {
            counter--;
        }
        if (Input.GetKeyDown(KeyCode.RightArrow) && counter < mat.Length)
        {
            counter++;
        }

        t = Time.time;
        GraphFunction3D f = functions[(int)function];

        for (int i = 0, z = 0; z < resolution; z++)
        {
            v = (z + 0.5f) * step - spread / 2;

            for (int x = 0; x < resolution; x++, i++)
            {
                u = (x + 0.5f) * step - spread / 2;
                points[i].localPosition = f(u, v, t);
                points[i].localScale    = size;
            }
        }


        for (int i = 0; i < points.Length; i++)
        {
            points [i].gameObject.GetComponent <Renderer> ().material = mat[counter];
        }
    }
예제 #2
0
    void Update()
    {
        float           t    = Time.time;
        GraphFunction3D f    = functions[(int)function];
        float           step = 2f / resolution;

        for (int i = 0, z = 0; z < resolution; z++)
        {
            float v = (z + 0.5f) * step - 1f;
            for (int x = 0; x < resolution; x++, i++)
            {
                float u = (x + 0.5f) * step - 1f;
                points[i].localPosition = f(u, v, t);
            }
        }
    }