You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

72 lines
1.5 KiB

  1. [vert.glsl]
  2. #version 120
  3. attribute vec3 in_Position;
  4. attribute vec2 in_TexCoord;
  5. varying vec2 pass_TexCoord;
  6. uniform mat4 u_projection;
  7. uniform mat4 u_view;
  8. uniform mat4 u_model;
  9. void main()
  10. {
  11. gl_Position = u_projection * u_view * u_model
  12. * vec4(in_Position, 1.0);
  13. pass_TexCoord = in_TexCoord;
  14. }
  15. [frag.glsl]
  16. #version 120
  17. #if defined GL_ES
  18. precision mediump float;
  19. #endif
  20. uniform sampler2D u_texture;
  21. uniform sampler2D u_palette;
  22. uniform vec2 u_texsize;
  23. varying vec2 pass_TexCoord;
  24. void main()
  25. {
  26. vec4 pal = texture2D(u_texture, pass_TexCoord);
  27. vec4 col = texture2D(u_palette, vec2(pal.x, 0.f));
  28. if (pal.x == 0.0)
  29. discard;
  30. gl_FragColor = col;
  31. }
  32. [vert.hlsl]
  33. void main(float4 in_Position : POSITION,
  34. float2 in_TexCoord : TEXCOORD0,
  35. uniform float4x4 u_projection,
  36. uniform float4x4 u_view,
  37. uniform float4x4 u_model,
  38. uniform float2 u_texsize,
  39. out float2 out_TexCoord : TEXCOORD0,
  40. out float4 out_Position : POSITION)
  41. {
  42. #if _XBOX
  43. float2 delta = float2(-0.5, -0.5) / u_texsize;
  44. #else
  45. float2 delta = float2(0.0, 0.0);
  46. #endif
  47. out_Position = mul(u_projection, mul(u_view, mul(u_model, in_Position)));
  48. out_TexCoord = in_TexCoord + delta;
  49. }
  50. [frag.hlsl]
  51. void main(float2 in_TexCoord : TEXCOORD0,
  52. uniform sampler2D u_texture,
  53. out float4 out_FragColor : COLOR)
  54. {
  55. float4 col = tex2D(u_texture, in_TexCoord);
  56. out_FragColor = col;
  57. }