Advertisement
mbl111

Untitled

Dec 12th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. vec4 calcSpotLight(SpotLight spotLight, vec3 normal){
  2. vec3 lightDirection = normalize(worldPos0 - spotLight.point.pos);
  3. float spotFactor = dot(lightDirection, spotLight.direction);
  4.  
  5. vec4 color = vec4(0,0,0,0);
  6.  
  7. if (spotFactor > spotLight.cutoff){
  8. color = calcPointLight(spotLight.point, normal) *
  9. (1.0 - ((1.0 - spotFactor)/(1.0 - spotLight.cutoff)));
  10. }
  11.  
  12. return color;
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement