Exemple #1
0
        Pixel DoRenderPlanet(IntCoordinate c, int width, int height, RenderInfo info,
                             Vector3 sunvec)
        {
            const double starClose = 2;

            info.InitializeRow(c.Y);

            var sv = new Vector3(sunvec.X, sunvec.Y * info.dy, sunvec.Z * info.sqomdysq);

            double azimuth = Math.Asin(((double)c.Y / (height - 1)) * 2 - 1);
            int    lcos    = (int)((height / 2) * Math.Abs(Math.Cos(azimuth)));

            if (c.X >= width / 2 - lcos && c.X <= width / 2 + lcos)
            {
                double r = info.CalculateR(c.X);

                var rgb = (r >= 128) ? RenderLand(r) : RenderWater(r);

                double icet = Math.Pow(Math.Abs(Math.Sin(azimuth)), 1.0 / _icelevel)
                              - 0.5;
                RenderPolarIceCaps(r, icet, rgb);

                return(ApplyDarkening(width, height, c.X, sv, info.dysq, rgb));
            }
            else if (c.X < width / 2 - (lcos + starClose) ||
                     c.X > width / 2 + (lcos + starClose))
            {
                return(_starFactory.Generate());
            }
            else
            {
                return(new Pixel(3));
            }
        }
Exemple #2
0
        Pixel DoRenderClouds(IntCoordinate c, RenderInfo info)
        {
            const double rgbQuant = 255;

            info.InitializeRow(c.Y);
            double r = info.CalculateR(c.X);

            byte w = (byte)((r > 127.0) ? (rgbQuant * ((r - 127.0) / 128.0)) : 0);

            return(new Pixel(w, w, (byte)rgbQuant));
        }
Exemple #3
0
        Pixel DoRenderPlanet(IntCoordinate c, int width, int height, RenderInfo info, 
			 Vector3 sunvec)
        {
            const double starClose = 2;

              info.InitializeRow(c.Y);

              var sv = new Vector3(sunvec.X, sunvec.Y * info.dy, sunvec.Z * info.sqomdysq);

              double azimuth = Math.Asin(((double) c.Y / (height - 1)) * 2 - 1);
              int lcos = (int) ((height / 2) * Math.Abs(Math.Cos(azimuth)));

              if (c.X >= width / 2 - lcos && c.X <= width / 2 + lcos)
            {
              double r = info.CalculateR(c.X);

              var rgb = (r >= 128) ? RenderLand(r) : RenderWater(r);

              double icet = Math.Pow(Math.Abs(Math.Sin(azimuth)), 1.0 / _icelevel)
            - 0.5;
              RenderPolarIceCaps(r, icet, rgb);

              return ApplyDarkening(width, height, c.X, sv, info.dysq, rgb);
            }
              else if (c.X < width / 2 - (lcos + starClose) ||
               c.X > width / 2 + (lcos + starClose))
            {
              return _starFactory.Generate();
            }
              else
            {
              return new Pixel(3);
            }
        }
Exemple #4
0
        Pixel DoRenderClouds(IntCoordinate c, RenderInfo info)
        {
            const double rgbQuant = 255;

              info.InitializeRow(c.Y);
              double r = info.CalculateR(c.X);

              byte w = (byte)((r > 127.0) ? (rgbQuant * ((r - 127.0) / 128.0)) : 0);

              return new Pixel(w, w, (byte) rgbQuant);
        }