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

Method commit

modules/cpu/lights/SpotLight.cpp:74–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void SpotLight::commit()
75{
76 Light::commit();
77 position = getParam<vec3f>("position", vec3f(0.f));
78 direction = getParam<vec3f>("direction", vec3f(0.f, 0.f, 1.f));
79 float openingAngle = getParam<float>("openingAngle", 180.f);
80 float penumbraAngle = getParam<float>("penumbraAngle", 5.f);
81 radius = max(0.0f, getParam<float>("radius", 0.f));
82 innerRadius =
83 clamp(getParam<float>("innerRadius", 0.f), 0.0f, 0.999f * radius);
84
85 // per default perpendicular to direction
86 intensityDistribution.c0 = std::abs(direction.x) < std::abs(direction.y)
87 ? vec3f(0.0f, direction.z, direction.y)
88 : vec3f(direction.z, 0.0f, direction.x);
89 intensityDistribution.readParams(*this);
90
91 // check ranges and pre-compute parameters
92 openingAngle = clamp(openingAngle, 0.f, 360.f);
93 penumbraAngle = clamp(penumbraAngle, 0.f, 0.5f * openingAngle);
94
95 cosAngleMax = std::cos(deg2rad(0.5f * openingAngle));
96 const float cosAngleMin =
97 std::cos(deg2rad(0.5f * openingAngle - penumbraAngle));
98 cosAngleScale = 1.0f / (cosAngleMin - cosAngleMax);
99
100 queryIntensityQuantityType(intensityDistribution
101 ? OSP_INTENSITY_QUANTITY_SCALE
102 : OSP_INTENSITY_QUANTITY_INTENSITY);
103 processIntensityQuantityType(openingAngle);
104}
105
106void SpotLight::processIntensityQuantityType(const float openingAngle)
107{

Callers

nothing calls this directly

Calls 2

commitFunction · 0.50
readParamsMethod · 0.45

Tested by

no test coverage detected