| 7 | namespace ospray { |
| 8 | |
| 9 | void IntensityDistribution::readParams(ISPCDeviceObject &obj) |
| 10 | { |
| 11 | c0 = obj.getParam<vec3f>("c0", c0); |
| 12 | lid = obj.getParamDataT<float, 2>("intensityDistribution"); |
| 13 | if (lid) { |
| 14 | if (lid->numItems.z > 1) |
| 15 | throw std::runtime_error(obj.toString() |
| 16 | + " must have (at most 2D) 'intensityDistribution' array using the first two dimensions."); |
| 17 | size = vec2i(lid->numItems.x, lid->numItems.y); |
| 18 | if (size.x < 2) |
| 19 | throw std::runtime_error(obj.toString() |
| 20 | + " 'intensityDistribution' must have data for at least two gamma angles."); |
| 21 | if (!lid->compact()) { |
| 22 | postStatusMsg(OSP_LOG_WARNING) |
| 23 | << obj.toString() |
| 24 | << " does currently not support strides for 'intensityDistribution', copying data."; |
| 25 | |
| 26 | const auto data = new Data(obj.getISPCDevice(), OSP_FLOAT, lid->numItems); |
| 27 | data->copy(*lid, vec3ui(0)); |
| 28 | lid = &(data->as<float, 2>()); |
| 29 | data->refDec(); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | void IntensityDistribution::setSh(ispc::IntensityDistribution &sh) const |
| 35 | { |