void CaptureParticleProcess::processResult(const WorkResult *wr, bool cancelled) { const CaptureParticleWorkResult *result = static_cast<const CaptureParticleWorkResult *>(wr); const RangeWorkUnit *range = result->getRangeWorkUnit(); if (cancelled) return; m_resultMutex->lock(); increaseResultCount(range->getSize()); /* Accumulate the received pixel data */ float *imageData = m_accumBitmap->getFloatData(); size_t pixelIndex, imagePixelIndex = 0; Float r, g, b; Vector2i start(result->getBorder(), result->getBorder()); Vector2i end(result->getFullSize().x - result->getBorder(), result->getFullSize().y - result->getBorder()); for (int y=start.y; y<end.y; ++y) { pixelIndex = y*result->getFullSize().x + start.x; for (int x=start.x; x<end.x; ++x) { Spectrum spec(result->getPixel(pixelIndex)); spec.toLinearRGB(r,g,b); imageData[imagePixelIndex++] += r; imageData[imagePixelIndex++] += g; imageData[imagePixelIndex++] += b; ++imagePixelIndex; ++pixelIndex; } } develop(); m_resultMutex->unlock(); }
void CaptureParticleProcess::processResult(const WorkResult *wr, bool cancelled) { const CaptureParticleWorkResult *result = static_cast<const CaptureParticleWorkResult *>(wr); const RangeWorkUnit *range = result->getRangeWorkUnit(); if (cancelled) return; LockGuard lock(m_resultMutex); increaseResultCount(range->getSize()); m_accum->put(result); if (m_job->isInteractive() || m_receivedResultCount == m_workCount) develop(); }
void Flunence2ParticleProcess::processResult(const WorkResult *wr, bool cancelled) { if ( !cancelled ) { LockGuard lock(m_resultMutex); const Fluence2WorkResult *res = static_cast<const Fluence2WorkResult *>(wr); const RangeWorkUnit *range = res->getRangeWorkUnit(); size_t npoint; npoint = res->m_surfPos.size(); for ( size_t i = 0; i < npoint; ++i ) m_output.addSurfacePoint(res->m_surfPos[i], res->m_surfWeight[i]*m_surfScale); npoint = res->m_volPos.size(); for ( size_t i = 0; i < npoint; ++i ) m_output.addVolumePoint(res->m_volPos[i], res->m_volWeight[i]*m_volScale); increaseResultCount(range->getSize()); } }