예제 #1
0
    private static void ProcessDetails(Dictionary <int, int[, ]> details, Expression.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.NamedVariables["detail"] = detail;
                        calc.Calc(proc, xi, yi, layer);
                        pair.Value[xi, yi] = (int)Convert.ChangeType(calc.NamedVariables["detail"], typeof(int));
                    }
                }
            }
        }
    }
예제 #2
0
    private static void ProcessAlphamaps(float[,,] alphamaps, Expression.DslCalculator calc, string proc, int cx, int cy, int r)
    {
        int alphanum = alphamaps.GetLength(2);
        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)
                {
                    float[] alphas = calc.NamedVariables["alphas"] as float[];
                    for (int i = 0; i < alphanum; ++i)
                    {
                        alphas[i] = alphamaps[xi, yi, i];
                    }
                    var v = calc.Calc(proc, xi, yi);
                    for (int i = 0; i < alphanum; ++i)
                    {
                        alphamaps[xi, yi, i] = alphas[i];
                    }
                }
            }
        }
    }
예제 #3
0
    private static void ProcessHeights(float[,] datas, Expression.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.NamedVariables["height"] = datas[yi, xi];
                    calc.Calc(proc, xi, yi);
                    datas[yi, xi] = (float)Convert.ChangeType(calc.NamedVariables["height"], typeof(float));
                }
            }
        }
    }
예제 #4
0
 private static void ProcessHeights(float[,] datas, Expression.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.NamedVariables["height"] = datas[yi, xi];
             calc.Calc(proc, xi, yi);
             datas[yi, xi] = (float)Convert.ChangeType(calc.NamedVariables["height"], typeof(float));
         }
     }
 }
예제 #5
0
 private static void ProcessDetails(Dictionary <int, int[, ]> details, Expression.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.NamedVariables["detail"] = detail;
                 calc.Calc(proc, xi, yi, layer);
                 pair.Value[xi, yi] = (int)Convert.ChangeType(calc.NamedVariables["detail"], typeof(int));
             }
         }
     }
 }
예제 #6
0
    private static void ProcessAlphamaps(float[,,] alphamaps, Expression.DslCalculator calc, string proc, int x, int y, int w, int h)
    {
        int alphanum = alphamaps.GetLength(2);

        for (int ix = 0; ix < w; ++ix)
        {
            for (int iy = 0; iy < h; ++iy)
            {
                int     xi     = x + ix;
                int     yi     = y + iy;
                float[] alphas = calc.NamedVariables["alphas"] as float[];
                for (int i = 0; i < alphanum; ++i)
                {
                    alphas[i] = alphamaps[xi, yi, i];
                }
                var v = calc.Calc(proc, xi, yi);
                for (int i = 0; i < alphanum; ++i)
                {
                    alphamaps[xi, yi, i] = alphas[i];
                }
            }
        }
    }