geometry.fragment.fx 788 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #extension GL_EXT_draw_buffers : require
  2. precision highp float;
  3. precision highp int;
  4. varying vec3 vNormalV;
  5. varying vec4 vViewPos;
  6. #ifdef POSITION
  7. varying vec3 vPosition;
  8. #endif
  9. #ifdef ALPHATEST
  10. varying vec2 vUV;
  11. uniform sampler2D diffuseSampler;
  12. #endif
  13. #ifdef POSITION
  14. #include<mrtFragmentDeclaration>[3]
  15. #else
  16. #include<mrtFragmentDeclaration>[2]
  17. #endif
  18. void main() {
  19. #ifdef ALPHATEST
  20. if (texture2D(diffuseSampler, vUV).a < 0.4)
  21. discard;
  22. #endif
  23. gl_FragData[0] = vec4(vViewPos.z / vViewPos.w, 0.0, 0.0, 1.0);
  24. //color0 = vec4(vViewPos.z / vViewPos.w, 0.0, 0.0, 1.0);
  25. gl_FragData[1] = vec4(normalize(vNormalV), 1.0);
  26. //color2 = vec4(vPositionV, 1.0);
  27. #ifdef POSITION
  28. gl_FragData[2] = vec4(vPosition, 1.0);
  29. #endif
  30. }