Пример #1
0
        public override Color GetPixel(BaseCamera camera, int x, int y)
        {
            // Use angles from polar coorinates
            var point  = camera.ScreenToWorldPoint(new Vec2(x, y));
            var z      = point.Z;
            var length = point.Length;

            if (length == 0)
            {
                return(top);
            }
            else
            {
                var vangle = Math.Acos(z / length);
                var interpolation_factor = vangle / Math.PI; // angles are 0deg to 180deg (0 to Pi radians)
                return(Blend(bottom, top, interpolation_factor));
            }
        }
Пример #2
0
        public override Color GetPixel(BaseCamera camera, int x, int y)
        {
            var point  = camera.ScreenToWorldPoint(new Vec2(x, y));
            var z      = point.Z;
            var length = point.Length;

            if (length == 0)
            {
                return(Color.White);
            }

            // Vertical angle (0 - 180deg)
            var vangle = Math.Acos(z / length);
            var v_interpolation_factor = vangle / Math.PI;
            var uvy = (int)(Texture.Height * v_interpolation_factor);

            // Horizontal angle (0 - 360deg)
            var hangle = Math.Asin(point.Y / (length * Math.Sin(vangle))) + (Math.PI * 0.5);
            var h_interpolation_factor = hangle / (2 * Math.PI);
            var uvx = (int)(Texture.Width * h_interpolation_factor);

            return(this.Texture[uvy, uvx]);
        }
Пример #3
0
 public override Color GetPixel(BaseCamera camera, int x, int y)
 {
     return(this.Colour);
 }
Пример #4
0
 /// <summary>
 /// Get the skybox colour for the given camera
 /// </summary>
 /// <param name="camera">camera</param>
 /// <param name="x">pixel x</param>
 /// <param name="y">pixel y</param>
 /// <returns>skybox color for camera pixel</returns>
 public virtual Color GetPixel(BaseCamera camera, int x, int y)
 {
     return(Color.Black);
 }