RenderingConfig::~RenderingConfig() { StopAllRenderThreadsLockless(); delete renderEngine; delete scene; delete film; delete ctx; }
void RenderingConfig::SaveFilm() { const vector<string> filmNames = cfg.GetStringVector("screen.file", ""); if (filmNames.size() == 0) return; boost::unique_lock<boost::mutex> lock(filmMutex); StopAllRenderThreadsLockless(); if (filmNames.size() == 1) film->SaveFilm(filmNames[0]); else if (filmNames.size() > 1) film->SaveFilm("merged.flm"); StartAllRenderThreadsLockless(); }
void RenderingConfig::ReInit(const bool reallocBuffers, const unsigned int w, unsigned int h) { boost::unique_lock<boost::mutex> lock(cfgMutex); bool wasRunning = renderThreadsStarted; // First stop all devices if (wasRunning) StopAllRenderThreadsLockless(); // Check if I have to reallocate buffers if (reallocBuffers) film->Init(w, h); else film->Reset(); scene->camera->Update(film->GetWidth(), film->GetHeight()); // Restart all devices if (wasRunning) StartAllRenderThreadsLockless(); }
void RenderingConfig::SetMotionBlur(const bool v) { boost::unique_lock<boost::mutex> lock(cfgMutex); bool wasRunning = renderThreadsStarted; // First stop all devices if (wasRunning) StopAllRenderThreadsLockless(); film->Reset(); PerspectiveCamera *camera = scene->camera; camera->motionBlur = v; if (camera->motionBlur) { camera->mbOrig = camera->orig; camera->mbTarget = camera->target; camera->mbUp = camera->up; } camera->Update(film->GetWidth(), film->GetHeight()); // Restart all devices if (wasRunning) StartAllRenderThreadsLockless(); }
void RenderingConfig::SetRenderingEngineType(const RenderEngineType type) { boost::unique_lock<boost::mutex> lock(cfgMutex); // Check the current rendering engine type is different if (renderEngine->GetEngineType() != type) { bool wasRunning = renderThreadsStarted; // First stop all devices if (wasRunning) StopAllRenderThreadsLockless(); delete renderEngine; switch (type) { case PATH: renderEngine = new PathRenderEngine(scene, film, &filmMutex, intersectionAllDevices, false, cfg); break; case SPPM: renderEngine = new SPPMRenderEngine(scene, film, &filmMutex, intersectionAllDevices, cfg); break; case DIRECTLIGHT: renderEngine = new PathRenderEngine(scene, film, &filmMutex, intersectionAllDevices, true, cfg); break; #if !defined(LUXRAYS_DISABLE_OPENCL) case PATHGPU: renderEngine = new PathGPURenderEngine(scene, film, &filmMutex, intersectionGPUDevices, cfg); break; case PATHGPU2: renderEngine = new PathGPU2RenderEngine(scene, film, &filmMutex, intersectionGPUDevices, cfg); break; #endif default: assert (false); } film->Reset(); // Restart all devices if (wasRunning) StartAllRenderThreadsLockless(); } }
void RenderingConfig::StopAllRenderThreads() { boost::unique_lock<boost::mutex> lock(cfgMutex); StopAllRenderThreadsLockless(); }