Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. vec4 spotLightSubroutine(vec4 N, vec4 worldPosition, vec3 worldNormal)
  2. {
  3. // Insert code for Section 3.5 here.
  4.  
  5. vec4 L = (pointLight.pointPosition - worldPosition) / normalize(pointLight.pointPosition - worldPosition);
  6. float cos_theta = max(0, dot(-L, pointLight.pointPosition));
  7.  
  8. float lambda = 0.;
  9. if (cos_theta > cos(genericLight.spotInnerConeAngleDegrees)) {
  10. lambda = 1.0;
  11. } else if (cos_theta >= cos(genericLight.spotOuterConeAngleDegrees)) {
  12. lambda = (cos_theta - cos(genericLight.spotOuterConeAngleDegrees) ) / (cos(genericLight.spotInnerConeAngleDegrees) - cos(genericLight.spotOuterConeAngleDegrees));
  13. }
  14.  
  15. return vec4(lambda);
  16. //return vec4(0.);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement