Ejemplo n.º 1
0
        public NishitaInterp(Nishita skyColor, double h0,
                             double directLight, double ambiantLight,
                             double maxDist,
                             double latRadMin, double latRadMax, int numLat,
                             double lonRadMin, double lonRadMax, int numLon)
        {
            this.skyColor     = skyColor;
            this.h0           = h0;
            this.directLight  = directLight;
            this.ambientLight = ambiantLight;
            this.maxDist      = maxDist;
            this.latRadMin    = latRadMin;
            this.latRadMax    = latRadMax;
            this.numLat       = numLat;
            this.lonRadMin    = lonRadMin < lonRadMax ? lonRadMin : lonRadMax;
            this.lonRadMax    = lonRadMax > lonRadMin ? lonRadMax : lonRadMin;
            this.numLon       = numLon;
            this.intType      = InterpolatonType.Linear;

            // Fixup
            if (this.lonRadMin < 0.0)
            {
                this.lonRadMin = 0.0;
            }

            inters     = new Lazy <TwoDInterpolator[]>(() => GetInters());
            aerialPers = new Lazy <AerialPers>(() => GetAerialPers());
        }
Ejemplo n.º 2
0
        public MyColor SkyColorAtPointDist(GeoPolar2d p, double dist, MyColor ground, double nDotL)
        {
            double   theta       = skyColor.GetTheta(p);
            MyDColor attenuation = new MyDColor();
            MyDColor airColorR   = new MyDColor();
            MyDColor airColorM   = new MyDColor();
            MyDColor directPart  = new MyDColor();

            aerialPers.Value.TryGetValues(dist, ref attenuation, ref airColorR, ref airColorM, ref directPart);

            MyColor color = Nishita.CombineForAerialPrespective(ground, theta, nDotL, ambientLight,
                                                                ref attenuation,
                                                                ref airColorR,
                                                                ref airColorM,
                                                                ref directPart);

            return(color);
        }
Ejemplo n.º 3
0
            public AerialPers(int numDists, double maxDist, double h0, Nishita skyColor, InterpolatonType intType)
            {
                double[] dists = new double[numDists];
                for (int x = 0; x < numDists; x++)
                {
                    dists[x] = maxDist * x / (numDists + -1);
                }

                double[][] values = new double[numDists][];
                for (int k = 0; k < values.Length; k++)
                {
                    values[k] = new double[12];
                }

                for (int x = 0; x < dists.Length; x++)
                {
                    skyColor.SkyColorAtPointComputer(
                        h0, dists[x],
                        out MyDColor attenuation,
                        out MyDColor airColorR,
                        out MyDColor airColorM,
                        out MyDColor directPart);

                    for (int k = 0; k < 3; k++)
                    {
                        values[x][0]  = attenuation.R;
                        values[x][1]  = attenuation.G;
                        values[x][2]  = attenuation.B;
                        values[x][3]  = airColorR.R;
                        values[x][4]  = airColorR.G;
                        values[x][5]  = airColorR.B;
                        values[x][6]  = airColorM.R;
                        values[x][7]  = airColorM.G;
                        values[x][8]  = airColorM.B;
                        values[x][9]  = directPart.R;
                        values[x][10] = directPart.G;
                        values[x][11] = directPart.B;
                    }
                }

                inters = new OneDVectorInterpolator(dists, values, intType);
            }