Ambient.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /******************************************************************************/
  2. #include "!Header.h"
  3. /******************************************************************************/
  4. #define PARAMS \
  5. uniform Bool skin ,\
  6. uniform Int alpha_test
  7. /******************************************************************************/
  8. void VS
  9. (
  10. VtxInput vtx,
  11. out Vec2 outTex:TEXCOORD,
  12. out Vec4 outVtx:POSITION,
  13. IF_IS_CLIP
  14. PARAMS
  15. )
  16. {
  17. if(alpha_test)outTex=vtx.tex();
  18. Vec pos;
  19. if(!skin)pos=TransformPos(vtx.pos());
  20. else pos=TransformPos(vtx.pos(), vtx.bone(), vtx.weight());
  21. CLIP(pos); outVtx=Project(pos);
  22. }
  23. /******************************************************************************/
  24. Vec4 PS
  25. (
  26. Vec2 inTex:TEXCOORD,
  27. PARAMS
  28. ):COLOR
  29. {
  30. if(alpha_test==1)clip(Tex(Col, inTex).a + MaterialAlpha()-1);else
  31. if(alpha_test==2)clip(Tex(Nrm, inTex).a + MaterialAlpha()-1); // #MaterialTextureChannelOrder
  32. return Vec4(MaterialAmbient(), 0);
  33. }
  34. /******************************************************************************/
  35. CUSTOM_TECHNIQUE
  36. /******************************************************************************/