Exemple #1
0
        public Renderer(VariableSet variables, Drawable drawable) :
            base(variables)
        {
            _drawable = drawable;

            const double lensAngle   = 70.0;
            const double earthRadius = 6375.0;
            var          amplitudes  = new double[] { 1.0, 0.5, 0.25, 0.125, 0.0625,
                                                      0.03125, 0.05, 0.05, 0.04, 0.0300 };

            _width  = drawable.Width;
            _height = drawable.Height;

            _clouds = new Perlin3D(10, 16.0, amplitudes,
                                   (int)GetValue <UInt32>("seed"));
            _cameraDistance = _width * 0.5 / Math.Tan(lensAngle * Math.PI / 180.0);

            _intSunX = (int)Math.Round((_width - 1) * GetValue <double>("sun_x"));
            _intSunY = (int)Math.Round((_height - 1) * GetValue <double>("sun_y"));

            _horizonColor2 = FromScreen("horizon_color");
            _skyColor2     = FromScreen("sky_color");
            _sunColor2     = FromScreen("sun_color");
            _cloudColor2   = FromScreen("cloud_color");
            _shadowColor2  = FromScreen("shadow_color");

            var tilt     = new TMatrix(GetValue <double>("tilt"), 1);
            var rotation = new TMatrix(GetValue <double>("rotation"), 2);

            _transform      = TMatrix.Combine(tilt, rotation);
            _cameraLocation = new Vector3(0.0, earthRadius + 0.2, 0.0);
        }
Exemple #2
0
        public Renderer(VariableSet variables, Drawable drawable)
            : base(variables)
        {
            _drawable = drawable;

              const double lensAngle = 70.0;
              const double earthRadius = 6375.0;
              var amplitudes = new double[]{1.0, 0.5, 0.25, 0.125, 0.0625,
                    0.03125, 0.05, 0.05, 0.04, 0.0300};

              _width = drawable.Width;
              _height = drawable.Height;

              _clouds = new Perlin3D(10, 16.0, amplitudes,
                 (int) GetValue<UInt32>("seed"));
              _cameraDistance = _width * 0.5 / Math.Tan(lensAngle * Math.PI / 180.0);

              _intSunX = (int) Math.Round((_width - 1) * GetValue<double>("sun_x"));
              _intSunY = (int) Math.Round((_height - 1) * GetValue<double>("sun_y"));

              _horizonColor2 = FromScreen("horizon_color");
              _skyColor2 = FromScreen("sky_color");
              _sunColor2 = FromScreen("sun_color");
              _cloudColor2 = FromScreen("cloud_color");
              _shadowColor2 = FromScreen("shadow_color");

              var tilt = new TMatrix(GetValue<double>("tilt"), 1);
              var rotation = new TMatrix(GetValue<double>("rotation"), 2);
              _transform = TMatrix.Combine(tilt, rotation);
              _cameraLocation = new Vector3(0.0, earthRadius + 0.2, 0.0);
        }