message: Also sample area lights from scene graphs
diff: @@ -1190,6 +1190,11 @@ void renderer::render_impl()
  temp_lights.push_back(pl);
  }
  + for (auto al : area_lights)
  + {
  + temp_lights.push_back(al);
  + }
  +
  if (tex_format == renderer::UV)
  {
  render_instances_cpp(
  @@ -1710,23 +1715,26 @@ int main(int argc, char** argv)
  {
  std::size_t begin;
  std::size_t end;
  + unsigned bvh_id;
  unsigned geom_id;
  };
  std::vector<range> ranges;
  - for (std::size_t i = 0; i < rend.mod.primitives.size(); ++i)
  + for (unsigned b = 0; b < rend.host_bvhs.size(); ++b)
  {
  - auto pi = rend.mod.primitives[i];
  + for (std::size_t i = 0; i < rend.host_bvhs[b].primitives().size(); ++i)
  + {
  + auto pi = rend.host_bvhs[b].primitives()[i];
  if (rend.generic_materials[pi.geom_id].as<emissive<float>>() != nullptr)
  {
  range r;
  r.begin = i;
  std::size_t j = i + 1;
  - for (;j < rend.mod.primitives.size(); ++j)
  + for (;j < rend.host_bvhs[b].primitives().size(); ++j)
  {
  - auto pii = rend.mod.primitives[j];
  + auto pii = rend.host_bvhs[b].primitives()[j];
  if (rend.generic_materials[pii.geom_id].as<emissive<float>>() == nullptr
  || pii.geom_id != pi.geom_id)
  {
  @@ -1735,19 +1743,21 @@ int main(int argc, char** argv)
  }
  r.end = j;
  + r.bvh_id = b;
  r.geom_id = pi.geom_id;
  ranges.push_back(r);
  i = r.end - 1;
  }
  }
  + }
  // Build vector with area light sources
  for (auto r : ranges)
  {
  for (std::size_t i = r.begin; i != r.end; ++i)
  {
  - area_light<float, basic_triangle<3, float>> light(rend.mod.primitives[i]);
  + area_light<float, basic_triangle<3, float>> light(rend.host_bvhs[r.bvh_id].primitives()[i]);
  auto mat = *rend.generic_materials[r.geom_id].as<emissive<float>>();
  light.set_cl(to_rgb(mat.ce()));
  light.set_kl(mat.ls());
  