Glsl PS.h 815 B

123456789101112131415161718192021
  1. #define AlphaTest(alpha) if(alpha+MaterialAlpha()<1.0)discard
  2. PAR Image Col, Col1, Col2, Col3,
  3. Nrm, Nrm1, Nrm2, Nrm3,
  4. Lum;
  5. PAR HP Image Depth;
  6. PAR ImageCube Rfl, Rfl1, Rfl2, Rfl3;
  7. PAR MP Flt AllowBackFlip;
  8. #define BackFlip(dir) {if(gl_FrontFacing==false)dir*=AllowBackFlip;} // keep this as "gl_FrontFacing==false" instead of "!gl_FrontFacing" because Mac OpenGL drivers for Intel fail to compile this correctly, resulting in reversed lighting
  9. MP Flt MultiMaterialWeight(MP Flt weight, MP Flt alpha) {return Max(weight+weight*(1.0-weight)*(alpha*10.0-5.0), weight/16.0);}
  10. MP Vec UpdateVelocities_PS(MP Vec vel, HP Vec view_space_pos)
  11. {
  12. vel/=view_space_pos.z;
  13. //#if !SIGNED_VEL_RT
  14. vel=vel*0.5+0.5; // scale from signed to unsigned (-1..1 -> 0..1)
  15. //#endif
  16. return vel;
  17. }