Skip to content

Commit

Permalink
Add support for sensors attached to shapes in batch plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
njroussel committed Aug 28, 2023
1 parent 4f35612 commit 65e0444
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sensors/batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,17 @@ MI_VARIANT class BatchSensor final : public Sensor<Float, Spectrum> {
BatchSensor(const Properties &props) : Base(props) {
for (auto [unused, o] : props.objects()) {
ref<Base> sensor(dynamic_cast<Base *>(o.get()));
ref<Shape> shape(dynamic_cast<Shape *>(o.get()));

if (sensor)
if (sensor) {
m_sensors.push_back(sensor);
} else if (shape) {
if (shape->is_sensor())
m_sensors.push_back(shape->sensor());
else
Throw("BatchSensor: shapes can only be specified as "
"children if a sensor is associated with them!");
}
}

if (m_sensors.empty())
Expand Down

0 comments on commit 65e0444

Please sign in to comment.