Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        kit = new FogAbout.FogKit(w, h, w, h, w, h);

        fogTexture          = new Texture2D(w, h, TextureFormat.RGB24, false, true);
        fogTexture.wrapMode = TextureWrapMode.Clamp;
        fogTexture.name     = "Tmp fog mask";

        Color black = new Color(1, 0, 0);

        for (int i = 0, j = 0; i < w; i++)
        {
            for (j = 0; j < h; j++)
            {
                fogTexture.SetPixel(i, j, black);
            }
        }
        fogTexture.Apply();

        maskPic.material.SetTexture("_FogTex", fogTexture);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Init the specified view_w_pixel and view_h_pixel.
    /// </summary>
    /// <returns>The init.</returns>
    /// <param name="view_w_pixel">视界遮罩图的大小.</param>
    /// <param name="view_h_pixel">视界遮罩图的大小.</param>
    public void Init(int world_w, int world_h, int view_w, int view_h, int mask_w, int mask_h)
    {
        kit = new FogAbout.FogKit(world_w, world_h, view_w, view_h, mask_w, mask_h);

        InitPic(mask_w, mask_h);
    }