コード例 #1
0
    private static void ProcessDetails(Dictionary <int, int[, ]> details, DslExpression.DslCalculator calc, string proc, int cx, int cy, int r)
    {
        int x  = cx - r;
        int y  = cy - r;
        int w  = r * 2;
        int h  = r * 2;
        int r2 = r * r;

        for (int ix = 0; ix < w; ++ix)
        {
            for (int iy = 0; iy < h; ++iy)
            {
                int xi = x + ix;
                int yi = y + iy;
                int dx = xi - cx;
                int dy = yi - cy;
                if (dx * dx + dy * dy <= r2)
                {
                    foreach (var pair in details)
                    {
                        int layer  = pair.Key;
                        var detail = pair.Value[xi, yi];
                        calc.SetVariable("detail", detail);
                        calc.Calc(proc, xi, yi, layer);
                        pair.Value[xi, yi] = (int)Convert.ChangeType(calc.GetVariable("detail"), typeof(int));
                    }
                }
            }
        }
    }
コード例 #2
0
    private static void ProcessHeights(float[,] datas, DslExpression.DslCalculator calc, string proc, int cx, int cy, int r)
    {
        int x  = cx - r;
        int y  = cy - r;
        int w  = r * 2;
        int h  = r * 2;
        int r2 = r * r;

        for (int ix = 0; ix < w; ++ix)
        {
            for (int iy = 0; iy < h; ++iy)
            {
                int xi = x + ix;
                int yi = y + iy;
                int dx = xi - cx;
                int dy = yi - cy;
                if (dx * dx + dy * dy <= r2)
                {
                    calc.SetVariable("height", datas[yi, xi]);
                    calc.Calc(proc, xi, yi);
                    datas[yi, xi] = (float)Convert.ChangeType(calc.GetVariable("height"), typeof(float));
                }
            }
        }
    }
コード例 #3
0
 private static void ProcessHeights(float[,] datas, DslExpression.DslCalculator calc, string proc, int x, int y, int w, int h)
 {
     for (int ix = 0; ix < w; ++ix)
     {
         for (int iy = 0; iy < h; ++iy)
         {
             int xi = x + ix;
             int yi = y + iy;
             calc.SetVariable("height", datas[yi, xi]);
             calc.Calc(proc, xi, yi);
             datas[yi, xi] = (float)Convert.ChangeType(calc.GetVariable("height"), typeof(float));
         }
     }
 }
コード例 #4
0
 private static void ProcessDetails(Dictionary <int, int[, ]> details, DslExpression.DslCalculator calc, string proc, int x, int y, int w, int h)
 {
     for (int ix = 0; ix < w; ++ix)
     {
         for (int iy = 0; iy < h; ++iy)
         {
             int xi = x + ix;
             int yi = y + iy;
             foreach (var pair in details)
             {
                 int layer  = pair.Key;
                 var detail = pair.Value[xi, yi];
                 calc.SetVariable("detail", detail);
                 calc.Calc(proc, xi, yi, layer);
                 pair.Value[xi, yi] = (int)Convert.ChangeType(calc.GetVariable("detail"), typeof(int));
             }
         }
     }
 }