public PotatoRenderContext(Option option)
        {
            Option = option;

            Scene        = new PotatoScene(option);
            imageBlender = new ImageBlender();
        }
        public static Vector3 GetDirectionFromPixel(PotatoScene scene, float pixelPositionX, float pixelPositionY)
        {
            Vector3 V1       = Vector3.Multiply(scene.GetCamera().Right(), pixelPositionX);
            Vector3 V2       = Vector3.Multiply(scene.GetCamera().Up(), pixelPositionY);
            Vector3 pixelPos = Vector3.Add(Vector3.Add(scene.GetOptions().ScreenLeft, V1), V2);

            return(Vector3.Normalize(Vector3.Add(scene.GetCamera().Forward(), pixelPos)));
        }
        public PotatoTasksSceneRenderer(PotatoScene scene)
        {
            this.scene = scene;

            tasksCountToDo = scene.GetLightCount();
            imagesRendered = new Bitmap[tasksCountToDo];
            tasks          = new Task <Bitmap> [tasksCountToDo];
        }
Beispiel #4
0
        public SuperSampling(int resolution, float samplingSubPixelDivision, PotatoScene scene, PotatoTracer tracer)
        {
            this.resolution = resolution;
            this.samplingSubPixelDivision = samplingSubPixelDivision;
            this.tracer = tracer;
            this.scene  = scene;

            halfResolution  = resolution / 2;
            samplingAverage = (int)(samplingSubPixelDivision * samplingSubPixelDivision);
        }
        public PotatoRenderContext(Option option)
        {
            this.option = option;

            scene = new PotatoScene(option);
            tasksSceneRenderer = new PotatoTasksSceneRenderer(scene);
            imageBlender       = new ImageBlender();

            System.Console.WriteLine(scene.ToString());
        }
        public PotatoRenderer(PotatoScene scene, int lightIndex)
        {
            this.scene = scene;
            option     = scene.GetOptions();

            textureManager = new TextureManager();
            textureManager.AddTextures(scene.GetTexturesPath());
            tracer = new PotatoTracer(scene, textureManager);

            this.lightIndex = lightIndex;

            if (option.SuperSampling)
            {
                superSampling = new SuperSampling(option.Height, option.SuperSamplingDivision, scene, tracer);
            }
        }
Beispiel #7
0
 public PotatoTracer(PotatoScene scene, TextureManager textureManager)
 {
     this.scene          = scene;
     this.textureManager = textureManager;
 }
 public static void SetRayDirectionByPixelPosition(ref Ray ray, PotatoScene scene, float pixelPositionX, float pixelPositionY)
 {
     ray.Set(scene.GetCamera().Position, GetDirectionFromPixel(scene, pixelPositionX, pixelPositionY));
 }