summaryrefslogtreecommitdiff
path: root/themes/src/shaders/sun_vert.cpp
blob: bacf3a6aff625de063e71f980f0172c08ec6af7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "sun_vert.h"

const char* shader_sun_vert = " \n"
"attribute vec2 position; \n"
"attribute vec4 color; \n"
"attribute mat4 vMatrix; \n"
"uniform mat4 projection; \n"
"uniform mat4 model; \n"
"varying lowp vec4 VertexColor; \n"
"varying lowp vec2 TexCoord; \n"
" \n"
"void main() { \n"
"    vec4 fragmentPosition = projection * model * vMatrix * vec4(position.x, position.y, 0, 1); \n"
"    gl_Position = fragmentPosition; \n"
"    VertexColor = color; \n"
"    // Normalize the position - the center is at (0,0) and edge vertices are at distance 'radius' \n"
"    // We want TexCoord to be in the range roughly [-1, 1] at the edges \n"
"    lowp float maxDist = length(position); \n"
"    if (maxDist > 0.1) { \n"
"        TexCoord = position / maxDist; \n"
"    } else { \n"
"        TexCoord = vec2(0.0, 0.0); \n"
"    } \n"
"} \n"
" \n";