MCPcopy Create free account
hub / github.com/RenderKit/ospray / addLightsToArray

Function addLightsToArray

modules/cpu/render/scivis/SciVisData.cpp:31–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31vec3f addLightsToArray(std::vector<ispc::Light *> &lightShs,
32 uint32_t &visibleOnly,
33 Ref<const DataT<Light *>> lights,
34 const ispc::Instance *instanceSh)
35{
36 vec3f aoColor = vec3f(0.f);
37 for (auto &&light : *lights) {
38 // just extract color from ambient lights
39 const auto ambient = dynamic_cast<const AmbientLight *>(light);
40 if (ambient) {
41 addVisibleOnlyToArray(
42 lightShs, visibleOnly, light->createSh(0, instanceSh));
43 aoColor += ambient->radiance;
44 continue;
45 }
46
47 // no illumination from HDRI lights
48 const auto hdri = dynamic_cast<const HDRILight *>(light);
49 if (hdri) {
50 addVisibleOnlyToArray(
51 lightShs, visibleOnly, light->createSh(0, instanceSh));
52 continue;
53 }
54
55 // sun-sky: only sun illuminates
56 const auto sunsky = dynamic_cast<const SunSkyLight *>(light);
57 if (sunsky) {
58 addVisibleOnlyToArray(lightShs,
59 visibleOnly,
60 light->createSh(0, instanceSh)); // sky visible only
61 lightShs.push_back(light->createSh(1, instanceSh)); // sun
62 continue;
63 }
64
65 // handle the remaining types of lights
66 for (uint32_t id = 0; id < light->getShCount(); id++)
67 lightShs.push_back(light->createSh(id, instanceSh));
68 }
69 return aoColor;
70}
71
72} // namespace
73

Callers 1

SciVisDataMethod · 0.85

Calls 3

addVisibleOnlyToArrayFunction · 0.85
createShMethod · 0.45
getShCountMethod · 0.45

Tested by

no test coverage detected