repeating_background.vp 569 B

12345678910111213141516171819202122
  1. #version 140
  2. in vec4 position;
  3. in vec2 texcoord0;
  4. uniform vp_uniforms
  5. {
  6. mat4 mtx_worldview;
  7. mat4 mtx_proj;
  8. vec4 uv_params;
  9. };
  10. out vec2 var_texcoord0;
  11. void main()
  12. {
  13. // uv_params.x = repeat scale on U axis (tiles across width)
  14. // uv_params.y = repeat scale on V axis (tiles across height)
  15. // uv_params.z = scroll offset on U axis (normalized 0..1)
  16. // uv_params.w = scroll offset on V axis (normalized 0..1)
  17. var_texcoord0 = texcoord0 * uv_params.xy + uv_params.zw;
  18. gl_Position = mtx_proj * mtx_worldview * vec4(position.xyz, 1.0);
  19. }