Esempio n. 1
0
        public Texture RenderImage(Scence scence, int x, int y)
        {
            Image img  = new Image((uint)x, (uint)y, Color.Black);
            var   FOWV = FOW / x / y;
            uint  xPos = 0;
            uint  yPos = 0;

            for (double i = -FOW / 2; i < FOW / 2; i += FOW / x)
            {
                for (double j = -FOWV / 2; j < FOWV / 2; j += FOWV / x)
                {
                    try
                    {
                        Ray3D tmpRay = new Ray3D(Position, Direct + new Direction(i, 0, j), 1);
                        var   p      = tmpRay.GetEndpoint(scence);
                        img.SetPixel(xPos, yPos, p.Color);
                        yPos++;
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                xPos++;
                yPos = 0;
                Console.WriteLine();
            }
            return(new Texture(img));
        }