| 118 | } |
| 119 | |
| 120 | void PathTracerData::generateGeometryLights(const World &world, |
| 121 | const Renderer &renderer, |
| 122 | std::vector<ispc::Light *> &lightShs) |
| 123 | { |
| 124 | if (!world.instances) |
| 125 | return; |
| 126 | |
| 127 | for (auto &&instance : *world.instances) { |
| 128 | auto geometries = instance->group->geometricModels.ptr; |
| 129 | |
| 130 | if (!geometries) |
| 131 | return; |
| 132 | |
| 133 | for (auto &&model : *geometries) { |
| 134 | if (model->hasEmissiveMaterials(renderer.materialData)) { |
| 135 | if (model->geometry().supportAreaLighting()) { |
| 136 | std::vector<int> primIDs(model->geometry().numPrimitives()); |
| 137 | std::vector<float> distribution(model->geometry().numPrimitives()); |
| 138 | float pdf = 0.f; |
| 139 | int32 numPrimIDs = |
| 140 | ispc::GeometricModel_gatherEmissivePrimIDs(model->getSh(), |
| 141 | renderer.getSh(), |
| 142 | instance->getSh(), |
| 143 | primIDs.data(), |
| 144 | distribution.data(), |
| 145 | pdf); |
| 146 | |
| 147 | // check whether the geometry has any emissive primitives |
| 148 | if (numPrimIDs) { |
| 149 | lightShs.push_back(createGeometryLight( |
| 150 | instance, model, numPrimIDs, primIDs, distribution, pdf)); |
| 151 | } |
| 152 | } else { |
| 153 | postStatusMsg(OSP_LOG_WARNING) |
| 154 | << "#osp:pt Geometry " << model->toString() |
| 155 | << " does not implement area sampling! " |
| 156 | << "Cannot use importance sampling for that " |
| 157 | << "geometry with emissive material!"; |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | } // namespace ospray |
nothing calls this directly
no test coverage detected