Advertisement
runewalsh

Было

Nov 20th, 2013
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. %OMNI_A?%
  2. uniform vec3 omni_pos%[nOmniA]%, omni_color%[nOmniA]%;
  3. uniform vec2 omni_sfif%[nOmniA]%;
  4. %/%
  5. %OMNI_S?%
  6. uniform vec3 omniS_pos%[nOmniS]%, omniS_mPos%[nOmniS]%, omniS_color%[nOmniS]%;
  7. uniform vec2 omniS_sfif%[nOmniS]%;
  8. %/%
  9. %TARG_A?%
  10. uniform vec3 targ_pos%[nTargA]%, targ_color%[nTargA]%;
  11. %/%
  12. %TARG_S?%
  13. uniform float splits[%nCsmSplits%];
  14. uniform vec3 targS_pos%[nTargS]%, targS_color%[nTargS]%;
  15. %/%
  16.  
  17. ...
  18.  
  19. %For:i,OmniA%
  20. {
  21. vec3 vecMV = omni_pos%[i]% - vecFromEye;
  22. float len = length(vecMV);
  23. vec3 lt = normalize(vecMV);
  24. vec3 lc = omni_color%[i]% * (1.0 - clamp((len - omni_sfif%[i]%.s) * omni_sfif%[i]%.t, 0.0, 1.0));
  25. diff += lc * max(dot(n2, lt), 0.0);
  26. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  27. }
  28. %/For%
  29.  
  30. %For:i,OmniS%
  31. {
  32. vec3 vecMV = omniS_pos%[i]% - vecFromEye, vecM = v_mpos - omniS_mPos%[i]%;
  33. float len = length(vecMV);
  34. vec3 lt = normalize(vecMV);
  35. float shadowFactor = CalcShadowFactor3(omniS_SM%i%, vecM);
  36. vec3 lc = omniS_color%[i]% * (1.0 - clamp((len - omniS_sfif%[i]%.s) * omniS_sfif%[i]%.t, 0.0, 1.0)) * shadowFactor;
  37. diff += lc * max(dot(n2, lt), 0.0);
  38. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  39. }
  40. %/For%
  41.  
  42. %For:i,TargA%
  43. {
  44. vec3 lt = targ_pos%[i]%;
  45. vec3 lc = targ_color%[i]%;
  46. diff += lc * max(dot(n2, lt), 0.0);
  47. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  48. }
  49. %/For%
  50.  
  51. %For:i,TargS%
  52. {
  53. vec3 lt = targS_pos%[i]%;
  54. float sf = CalcTargShadowFactor3(zDist, splits %For:split,Csm%, targS_%i%_SM%split%, targS_pmp%split%%[i]% %/For%);
  55. vec3 lc = targS_color%[i]% * sf;
  56. diff += lc * max(dot(n2, lt), 0.0);
  57. %SPEC?% spec += lc * pow(max(dot(lt, r), 0.0), specPow); %/%
  58. }
  59. %/For%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement