/engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.frag

http://jmonkeyengine.googlecode.com/ · GLSL · 27 lines · 19 code · 4 blank · 4 comment · 0 complexity · 2edfd72e4c4a15d4d712728634dda3a4 MD5 · raw file

  1. #import "Common/ShaderLib/Texture.glsllib"
  2. varying vec2 texCoord;
  3. uniform sampler2D m_ColorMap;
  4. void main(){
  5. //Texture_GetColor(m_ColorMap, texCoord)
  6. //vec4 color = texture2D(m_ColorMap, texCoord);
  7. //color.rgb *= color.a;
  8. //gl_FragColor = vec4(color.a);
  9. #ifdef NORMAL_LATC
  10. vec3 newNorm = vec3(texture2D(m_ColorMap, texCoord).ag, 0.0);
  11. newNorm = Common_UnpackNormal(newNorm);
  12. newNorm.b = sqrt(1.0 - (newNorm.x * newNorm.x) - (newNorm.y * newNorm.y));
  13. newNorm = Common_PackNormal(newNorm);
  14. gl_FragColor = vec4(newNorm, 1.0);
  15. #elif defined(SHOW_ALPHA)
  16. gl_FragColor = vec4(texture2D(m_ColorMap, texCoord).a);
  17. #else
  18. gl_FragColor = Texture_GetColor(m_ColorMap, texCoord);
  19. #endif
  20. #ifdef NORMALIZE
  21. gl_FragColor = vec4(normalize(gl_FragColor.xyz), gl_FragColor.a);
  22. #endif
  23. }