diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c')
-rw-r--r-- | Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c index b0bcdff..f428a49 100644 --- a/Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/Source/3rdParty/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -30,20 +30,24 @@ /************************************************************************************************* * Vertex/fragment shader source * *************************************************************************************************/ - +/* Notes on a_angle: + * It is a vector containing sin and cos for rotation matrix + * To get correct rotation for most cases when a_angle is disabled cos + value is decremented by 1.0 to get proper output with 0.0 which is + default value +*/ static const Uint8 GLES2_VertexSrc_Default_[] = " \ uniform mat4 u_projection; \ attribute vec2 a_position; \ attribute vec2 a_texCoord; \ - attribute float a_angle; \ + attribute vec2 a_angle; \ attribute vec2 a_center; \ varying vec2 v_texCoord; \ \ void main() \ { \ - float angle = radians(a_angle); \ - float c = cos(angle); \ - float s = sin(angle); \ + float s = a_angle[0]; \ + float c = a_angle[1] + 1.0; \ mat2 rotationMatrix = mat2(c, -s, s, c); \ vec2 position = rotationMatrix * (a_position - a_center) + a_center; \ v_texCoord = a_texCoord; \ |