コード例 #1
0
        public virtual void Initialize() {
            this.IntersectionDevice =
                new DadeCudaIntersectionDevice(Scene, null);
                //new MCOpenClIntersectionDevice(Scene, lowLatency, 0);

            this.engine = EngineFactory.CreateEngine(engineType, Scene, lowLatency);
            this.Film = (ImageFilmBase)engine.CreateFilm(width, height);
            
            var renderThreadsCount = Math.Min(engine.MaxThreadCount, this.RenderThreadsCount);
            this.RenderThreads = new RenderThread[renderThreadsCount];
            int ht = height / renderThreadsCount;
            var samplingContext = new SamplingContext()
            {
                LightSampler = new LightSampler(Scene),
                SurfaceSampler = new SurfaceSampler(Scene)
            };
            for (int i = 0; i < renderThreadsCount; i++)
            {
                var sampler = engine.CreateSampler(width, height, Scene.MaxPathDepth, i, ht*i, ht);
                samplingContext.PrimarySpaceSampler = sampler;
                RenderThreads[i] = engine.CreateRenderThread(i, IntersectionDevice, Scene, Film, new StillFrameManager(), samplingContext);
            }

            Tracer.TraceLine("Starting {0}", engineType);
        }