コード例 #1
0
        public IPixelColor GetPixelColor(int col, int row)
        {
            int bmpRow = this.World.Camera.Height - 1 - row;

            if (this.AntiAliasing)
            {
                IRay        ray = this.World.Camera.GetRay(col, bmpRow, 0, 0);
                IPixelColor c1  = this.Trace(ray, 0);
                ray = this.World.Camera.GetRay(col, bmpRow, 0.5f, 0);
                IPixelColor c2 = this.Trace(ray, 0);
                ray = this.World.Camera.GetRay(col, bmpRow, 0, 0.5f);
                IPixelColor c3 = this.Trace(ray, 0);
                ray = this.World.Camera.GetRay(col, bmpRow, 0.5f, 0.5f);
                IPixelColor c4 = this.Trace(ray, 0);

                IPixelColor color = PixelColor.Avg(c1, c2, c3, c4);

                return(color);
            }
            else
            {
                IRay        ray   = this.World.Camera.GetRay(col, bmpRow);
                IPixelColor color = this.Trace(ray, 0);

                return(color);
            }
        }