Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vec4 spotLightSubroutine(vec4 N, vec4 worldPosition, vec3 worldNormal)
- {
- // Insert code for Section 3.5 here.
- vec4 L = (pointLight.pointPosition - worldPosition) / normalize(pointLight.pointPosition - worldPosition);
- float cos_theta = max(0, dot(-L, pointLight.pointPosition));
- float lambda = 0.;
- if (cos_theta > cos(genericLight.spotInnerConeAngleDegrees)) {
- lambda = 1.0;
- } else if (cos_theta >= cos(genericLight.spotOuterConeAngleDegrees)) {
- lambda = (cos_theta - cos(genericLight.spotOuterConeAngleDegrees) ) / (cos(genericLight.spotInnerConeAngleDegrees) - cos(genericLight.spotOuterConeAngleDegrees));
- }
- return vec4(lambda);
- //return vec4(0.);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement