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

Method SciVisData

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

Source from the content-addressed store, hash-verified

72} // namespace
73
74SciVisData::SciVisData(const World &world)
75 : AddStructShared(world.getISPCDevice().getDRTDevice())
76{
77 std::vector<ispc::Light *> lightShs;
78 vec3f aoColor = vec3f(0.f);
79 uint32_t visibleOnly = 0;
80
81 // Add lights not assigned to any instance
82 if (world.lights)
83 aoColor += addLightsToArray(lightShs, visibleOnly, world.lights, nullptr);
84
85 // Iterate through all world instances
86 if (world.instances) {
87 for (auto &&inst : *world.instances) {
88 // Skip instances without lights
89 if (!inst->group->lights)
90 continue;
91
92 // Add instance lights to array
93 aoColor += addLightsToArray(
94 lightShs, visibleOnly, inst->group->lights, inst->getSh());
95 }
96 }
97
98 // Then create shared buffer from the temporary std::vector
99 lightArray = devicert::make_buffer_shared_unique<ispc::Light *>(
100 world.getISPCDevice().getDRTDevice(), lightShs);
101 getSh()->lights = lightArray->sharedPtr();
102 getSh()->numLights = lightArray->size();
103 getSh()->numLightsVisibleOnly = visibleOnly;
104 getSh()->aoColorPi = aoColor * float(pi);
105}
106
107SciVisData::~SciVisData()
108{

Callers

nothing calls this directly

Calls 4

addLightsToArrayFunction · 0.85
getShMethod · 0.80
sharedPtrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected