Beispiel #1
0
        public CorrectorRenderThread[] CreateThreads(int threadCount, IIntersectionEngine intersectionEngine, FrameManager fm)
        {
            var threads = new CorrectorRenderThread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                threads[i] = new CorrectorRenderThread(i, intersectionEngine, currentFrame.Scene, currentFrame.LowLatency, film, new GlobalSamplingContext()
                {
                    BsdfSampler = this.BsdfSampler,
                    LightSampler = this.LightsourceSampler,
                    PrimarySpaceSampler = this.CreatePrimarySampler(currentFrame.Width, currentFrame.Height, i)
                }, fm);

                threads[i].SetSamples(this.Samples);
            }
            return threads;
        }
        public virtual void Initialize()
        {

            this.deviceManager = new DeviceManager();
            this.frameManager = new FrameManager(this.OutputSettings, this.QualitySettings, Scene);
            this.deviceManager.Init(lowLatency, Scene);
            //this.frameManager.SetDevices(deviceManager, Film);
            this.film = new CorrectorImageFilm(Width, Height);
            this.engine = new CorrectorRenderer(CurrentFrame, film);
            this.deviceManager.RenderThreads = engine.CreateThreads(this.RenderThreadsCount, deviceManager.IntersectionDevice, frameManager);



            Tracer.TraceLine("Starting Corrector [Renderer type : {0}] ( Preprocessing : {1} )", engineType, false);
            //Tracer.TraceLine("..Sampler Type [{0}]", deviceManager.RenderThreads.First().sampler.GetType().Name);
            Tracer.TraceLine("..Image Film Type [{0}]", film.GetType().Name);
            CommandManager.Instance.OnExecuteCommand += command =>
            {
                if (command.Name == "init.config")
                {

                }

                return new EngineCommandContext() { Success = true };
            };
        }
        public virtual void Initialize()
        {
            this.engine = EngineFactory.CreateEngine(engineType, Scene, lowLatency);

            this.ImageMeasurement = config.Get("AdaptiveFilm", false);
            this.Film = FilmFactory.CreateFilm(width, height, this.ImageMeasurement);
            //this.Film = new CudaFilm(width, height);
            SamplerFactory.Instance.SetFilm(this.Film);
            this.deviceManager = new DevicesManager(Scene, engine) { SingleFilm = this.SingleFilm };
            this.frameManager = new FrameManager(this.OutputSettings, this.QualitySettings, Scene);
            this.deviceManager.Initialize(this.RenderThreadsCount, width, height, frameManager);
            this.frameManager.SetDevices(deviceManager, Film);
            //this.frameManager.OnFrameReady += (fm) =>
            //    {
            //        this.frameManager
            //    };
            Tracer.TraceLine("Starting [{0}] ( Preprocessing : {1} )", engineType, engine.PreprocessRequired);
            Tracer.TraceLine("..Sampler Type [{0}]", deviceManager.RenderThreads.First().sampler.GetType().Name);
            Tracer.TraceLine("..Image Film Type [{0}]", Film.GetType().Name);


            if (engine.PreprocessRequired)
            {
                engine.Preprocess(Scene, deviceManager.IntersectionDevice);
            }
        }