Ejemplo n.º 1
0
    public void SetPoint(float value)
    {
        k = (k < resolution) ? k : 0;
        Vector3 tmp = points[k].position;

        tmp.y = value / 20;
        tmp.y = Mathf.Clamp(tmp.y, 0, 20);
        points[k].position = tmp;
        Color col = ColorGradient.FullColorBWR(1 - tmp.y, 0, 1);

        col.a           = 1;
        points[k].color = col;
        k++;
    }
Ejemplo n.º 2
0
    private void CreatePoints()
    {
        currentResolution = resolution;
        points            = new ParticleSystem.Particle[resolution];
        float increment = 1f / (resolution - 1);

        for (int i = 0; i < resolution; i++)
        {
            float x = i * increment;
            points[i].position = new Vector3(x, 0f, 0f);
            points[i].color    = ColorGradient.FullColorBWR(x, 0, 1);
            points[i].size     = 0.1f;
        }
    }
Ejemplo n.º 3
0
    void CreateTexture()
    {
        if (texture == null)
        {
            texture            = new Texture2D((int)size.x / gridStep, (int)size.y / gridStep);
            texture.wrapMode   = TextureWrapMode.Clamp;
            texture.filterMode = FilterMode.Point;
        }

        if (!shitbool)
        {
            texture.filterMode = FilterMode.Point;
        }
        else
        {
            texture.filterMode = FilterMode.Bilinear;
        }
        //texture = new Texture2D(-5, -1);

        int y = 0;

        //Debug.Log("S: " + DateTime.Now.Second +":"+ DateTime.Now.Millisecond);
        while (y < texture.height)
        {
            int x = 0;
            while (x < texture.width)
            {
                Color color = Color.clear;
                switch (colorMode)
                {
                case 0:
                    color = ColorGradient.MonoChrome(map[x, y], mapMin, mapMax);
                    break;

                case 1:
                    color = ColorGradient.TwoColorGradentRG(map[x, y], mapMin, mapMax);
                    break;

                case 2:
                    color = ColorGradient.FullColorGradient(map[x, y], mapMin, mapMax);
                    break;

                case 3:
                    color = ColorGradient.FullColorBWR(map[x, y], mapMin, mapMax);
                    break;

                case 4:
                    color = ColorGradient.FullColorWBR(map[x, y], mapMin, mapMax);
                    break;

                case 5:
                    color = ColorGradient.FullColorCGY(map[x, y], mapMin, mapMax);
                    break;

                default:
                    color = ColorGradient.FullColorGradient(map[x, y], mapMin, mapMax);
                    break;
                }
                color.a = Mathf.Clamp(color.a, 0f, 0.6f);
                texture.SetPixel(x, y, color);
                ++x;
            }
            ++y;
        }
        texture.Apply();
        //Debug.Log("F: " + DateTime.Now.Second + ":" + DateTime.Now.Millisecond);
    }