コード例 #1
0
    protected void SetVertexColor(int x, int y, float power, Color clr)
    {
        PATile         tile;
        int            i, j, id;
        bool           c;
        List <Mesh>    ms   = new List <Mesh>();
        List <Color[]> clrs = new List <Color[]>();

        Mesh mesh;

        Color[] colors;

        PAPoint point = settings.points[(settings.xCount + 1) * y + x];

        for (i = 0; i < 4; ++i)
        {
            if (point.t[i] >= 0)
            {
                c    = false;
                tile = GetTile(point.t[i]);

                mesh   = GetChunkMesh(tile.chunkId);
                colors = null;

                for (j = 0; j < ms.Count; ++j)
                {
                    if (ms[j] == mesh)
                    {
                        c = true; colors = clrs[j];
                    }
                }
                if (colors == null)
                {
                    colors = mesh.colors;
                }

                id         = tile.cId * 4 + point.p[i];
                colors[id] = Color.Lerp(colors[id], clr, power);

                if (!c)
                {
                    ms.Add(mesh); clrs.Add(colors);
                }
            }
        }
        for (i = 0; i < ms.Count; ++i)
        {
            ms[i].colors = clrs[i];
        }
    }
コード例 #2
0
ファイル: PATileTerrain.cs プロジェクト: piotrdubiel/polyjam
    protected void PrepareHelperPoint(PAPoint point, int x, int y, int w, int h)
    {
        for (int k = 0; k < 4; ++k) { point.t[k] = -1; point.p[k] = -1; }

        if (x == 0) // only RU and RD
        {
            if (y == 0) //only RU
            {
                point.t[0] = 0; point.p[0] = 0;
            }
            else if (y == settings.yCount) //only RD
            {
                point.t[0] = w * (y - 1); point.p[0] = 1;
            } else //RU and RD
            {
                point.t[0] = w * y;       point.p[0] = 0; //RU
                point.t[1] = w * (y - 1); point.p[1] = 1; //RD
            }
        } else if (x == settings.xCount) //only LU and LD
        {
            if (y == 0) //only LU
            {
                point.t[0] = x - 1; point.p[0] = 3;
            }
            else if (y == settings.yCount) //only LD
            {
                point.t[0] = w * (y - 1) + x - 1; point.p[0] = 2;
            }
            else //LU and LD
            {
                point.t[0] = w * y + x - 1; 	  point.p[0] = 3; //LU
                point.t[1] = w * (y - 1) + x - 1; point.p[1] = 2; //LD
            }
        } else //if (x > 0 && x < settings.xCount)
        {
            if (y == 0) //only LU and RU
            {
                point.t[0] = x - 1; point.p[0] = 3; //LU
                point.t[1] = x;     point.p[1] = 0; //RU
            }
            else if (y == settings.yCount) //only LD and RD
            {
                point.t[0] = w * (y - 1) + x - 1; point.p[0] = 2; //LD
                point.t[1] = w * (y - 1) + x; 	  point.p[1] = 1; //RD
            }
            else //LU and RU and LD and RD
            {
                point.t[0] = w * y + x - 1; 	  point.p[0] = 3; //LU
                point.t[1] = w * y + x;           point.p[1] = 0; //RU
                point.t[2] = w * (y - 1) + x - 1; point.p[2] = 2; //LD
                point.t[3] = w * (y - 1) + x;     point.p[3] = 1; //RD
            }
        }
    }
コード例 #3
0
 public PAMOrder(ACClass acType, IACObject content, IACObject parentACObject, ACValueList parameter, string acIdentifier = "")
     : base(acType, content, parentACObject, parameter, acIdentifier)
 {
     _PAPointMatIn1  = new PAPoint(this, Const.PAPointMatIn1);
     _PAPointMatOut1 = new PAPoint(this, Const.PAPointMatOut1);
 }