Exemplo n.º 1
0
 /// <summary>
 ///     Create a new renderer
 /// </summary>
 /// <param name="scene">the scene to render</param>
 /// <param name="sampler">the sampler</param>
 /// <param name="camera">the camera</param>
 /// <param name="film">the film to write to</param>
 /// <param name="integrator">the surface integrator</param>
 public Renderer(Scene scene, Sampler sampler, Camera camera, Film film, Integrator integrator)
 {
     Film       = film;
     Scene      = scene;
     Sampler    = sampler;
     Camera     = camera;
     Integrator = integrator;
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Compute radiance for a sample
        /// </summary>
        /// <param name="sample"></param>
        /// <param name="ray"></param>
        /// <returns></returns>
        public SampledSpectrum Li(Sample sample, Ray ray = null)
        {
            ray = ray ?? Camera.GenerateRay(sample);
            var intersection = new Intersection();
            var spectrum     = SampledSpectrum.Black();

            if (Scene.TryToIntersect(ray, ref intersection))
            {
                spectrum = Integrator.Li(Scene, ray, this, sample, ref intersection);
            }
            else
            {
                spectrum = Scene.Lights.Aggregate(spectrum, (current, light) => current + light.Le(ray));
            }
            return(spectrum);
        }