OtfTransmittanceMapOccluder::OtfTransmittanceMapOccluder(Renderer::CPtr renderer, 
                                                         Camera::CPtr camera,
                                                         const size_t numSamples)
  : m_renderer(renderer), m_camera(camera)
{ 
  // Record resolution of camera
  m_resolution = m_camera->resolution();
  m_floatRasterBounds = static_cast<Imath::V2f>(m_resolution);
  m_intRasterBounds = m_resolution - Imath::V2i(1);
  // Update transmittance map size and sample count
  m_transmittanceMap.setSize(m_resolution.x, m_resolution.y);
  m_transmittanceMap.setNumSamples(numSamples);
  // Reset the list of computed pixels
  m_computed.resize(m_resolution.x * m_resolution.y, 0);
  // Check if space behind camera is valid
  m_clipBehindCamera = !camera->canTransformNegativeCamZ();
}
Esempio n. 2
0
TransmittanceMapOccluder::TransmittanceMapOccluder(Renderer::CPtr baseRenderer, 
                                                   Camera::CPtr camera,
                                                   const size_t numSamples)
  : m_camera(camera)
{ 
  // Clone Renderer to create a mutable copy
  Renderer::Ptr renderer = baseRenderer->clone();
  // Configure Renderer
  renderer->setCamera(camera);
  renderer->setPrimaryEnabled(false);
  renderer->setTransmittanceMapEnabled(true);
  renderer->setNumDeepSamples(numSamples);
  // Execute render and grab transmittace map
  renderer->execute();
  m_transmittanceMap = renderer->transmittanceMap();
  // Record the bounds of the transmittance map
  m_rasterBounds = static_cast<Imath::V2f>(m_transmittanceMap->size());
  // Check if space behind camera is valid
  m_clipBehindCamera = !camera->canTransformNegativeCamZ();
}