PivotQuadVertShader.vsh 847 B

1234567891011121314151617181920212223242526272829
  1. attribute highp vec2 inVertex;
  2. attribute mediump vec2 inWordIndex;
  3. attribute mediump vec2 inTexCoords;
  4. // inWordIndex: { horizontal multiplier | vertical muliplier }
  5. varying mediump vec2 TexCoord;
  6. uniform highp mat4 ModelViewProjMatrix;
  7. uniform mediump vec3 PivotDirection;
  8. uniform mediump vec3 Up;
  9. void main()
  10. {
  11. // Span a quad depending on the texture coordinates and the camera's up and right vector
  12. // Convert each vertex into projection-space and output the value
  13. mediump vec3 offset = PivotDirection * inWordIndex.x + Up * inWordIndex.y;
  14. // Pass the texcoords
  15. TexCoord = inTexCoords;
  16. // Calculate the world position of the vertex
  17. highp vec4 vInVertex = vec4(vec3(inVertex, 0.0) + offset, 1.0);
  18. // Transform the vertex
  19. gl_Position = ModelViewProjMatrix * vInVertex;
  20. }