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

Method createSh

modules/cpu/lights/PointLight.cpp:22–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace ospray {
21
22ispc::Light *PointLight::createSh(
23 uint32_t, const ispc::Instance *instance) const
24{
25 ispc::PointLight *sh =
26 StructSharedCreate<ispc::PointLight>(getISPCDevice().getDRTDevice());
27
28 sh->super.isVisible = visible;
29 sh->super.instance = instance;
30#ifndef OSPRAY_TARGET_SYCL
31 sh->super.sample =
32 reinterpret_cast<ispc::Light_SampleFunc>(ispc::PointLight_sample_addr());
33 sh->super.eval =
34 reinterpret_cast<ispc::Light_EvalFunc>(ispc::PointLight_eval_addr());
35#endif
36
37 sh->radiance = radiance;
38 sh->intensity = radIntensity;
39 sh->radius = radius;
40 sh->pre.position = position;
41 sh->pre.direction = normalize(direction);
42 intensityDistribution.setSh(sh->intensityDistribution);
43
44 // Enable dynamic runtime instancing or apply static transformation
45 if (instance) {
46 sh->pre.c0 = intensityDistribution.c0;
47 if (instance->motionBlur) {
48#ifndef OSPRAY_TARGET_SYCL
49 sh->super.sample = reinterpret_cast<ispc::Light_SampleFunc>(
50 ispc::PointLight_sample_instanced_addr());
51 sh->super.eval = reinterpret_cast<ispc::Light_EvalFunc>(
52 ispc::PointLight_eval_instanced_addr());
53#endif
54 } else
55 ispc::PointLight_Transform(sh, instance->xfm, &sh->pre);
56 } else {
57 sh->pre.c90 = normalize(cross(intensityDistribution.c0, sh->pre.direction));
58 sh->pre.c0 = cross(sh->pre.direction, sh->pre.c90);
59 }
60
61 return &sh->super;
62}
63
64std::string PointLight::toString() const
65{

Callers

nothing calls this directly

Calls 1

setShMethod · 0.80

Tested by

no test coverage detected