runewalsh

Стало

Nov 20th, 2013
179
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %LIGHTS?% uniform vec3 light_pos%[nLights]%, light_color%[nLights]%; %/%
  2. %OMNI?% uniform vec2 omni_sfif%[nOmni]%; %/%
  3. %OMNI_S?% uniform vec3 omniS_mPos%[nOmniS]%; %/%
  4. %TARG_S?% uniform float splits[%nCsmSplits%]; %/%
  5.  
  6. ...
  7.  
  8. %For:i, Lights%
  9. {
  10. %i.omni?%
  11. vec3 vecMV = light_pos%[i]% - vecFromEye;
  12. float len = length(vecMV);
  13. vec3 lt = normalize(vecMV);
  14. vec3 lc = light_color%[i]% * (1.0 - clamp((len - omni_sfif%[i.omni]%.s) * omni_sfif%[i.omni]%.t, 0.0, 1.0));
  15. %i.omniS?%
  16. vec3 vecM = v_mpos - omniS_mPos%[i.omniS]%;
  17. lc *= CalcShadowFactor3(omniS_SM%i.omniS%, vecM);
  18. %/%
  19. diff += lc * max(dot(n2, lt), 0.0);
  20. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  21. %/%
  22.  
  23. %i.targ?%
  24. vec3 lt = light_pos%[i]%;
  25. vec3 lc = light_color%[i]%;
  26. %i.targS?%
  27. {
  28. float sf = CalcTargShadowFactor3(zDist, splits %For:split,Csm%, targS_%i.targS%_SM%split%, targS_pmp%split%%[i.targS]% %/For%);
  29. lc *= sf;
  30. }%/%
  31.  
  32. diff += lc * max(dot(n2, lt), 0.0);
  33. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  34. %/%
  35. }
  36. %/For%
RAW Paste Data