diff options
Diffstat (limited to 'themes/src/shaders')
-rw-r--r-- | themes/src/shaders/renderer2d_frag.cpp | 8 | ||||
-rw-r--r-- | themes/src/shaders/renderer2d_frag.h | 2 | ||||
-rw-r--r-- | themes/src/shaders/renderer2d_vert.cpp | 16 | ||||
-rw-r--r-- | themes/src/shaders/renderer2d_vert.h | 2 | ||||
-rw-r--r-- | themes/src/shaders/renderer3d_frag.cpp | 10 | ||||
-rw-r--r-- | themes/src/shaders/renderer3d_frag.h | 9 | ||||
-rw-r--r-- | themes/src/shaders/renderer3d_vert.cpp | 18 | ||||
-rw-r--r-- | themes/src/shaders/renderer3d_vert.h | 17 | ||||
-rw-r--r-- | themes/src/shaders/sun_vert.cpp | 3 | ||||
-rw-r--r-- | themes/src/shaders/sun_vert.h | 2 |
10 files changed, 60 insertions, 27 deletions
diff --git a/themes/src/shaders/renderer2d_frag.cpp b/themes/src/shaders/renderer2d_frag.cpp new file mode 100644 index 0000000..7650fce --- /dev/null +++ b/themes/src/shaders/renderer2d_frag.cpp @@ -0,0 +1,8 @@ +#include "renderer2d_frag.h" + +const char* shader_renderer2d_frag = "varying lowp vec4 VertexColor; \n" +" \n" +"void main() { \n" +" gl_FragColor = VertexColor; \n" +"} \n" +" \n"; diff --git a/themes/src/shaders/renderer2d_frag.h b/themes/src/shaders/renderer2d_frag.h index 6f5e472..20cff24 100644 --- a/themes/src/shaders/renderer2d_frag.h +++ b/themes/src/shaders/renderer2d_frag.h @@ -1,4 +1,4 @@ #ifndef SHADER_RENDERER2D_FRAG #define SHADER_RENDERER2D_FRAG -const char* shader_renderer2d_frag = " \n"; +extern const char* shader_renderer2d_frag; #endif diff --git a/themes/src/shaders/renderer2d_vert.cpp b/themes/src/shaders/renderer2d_vert.cpp new file mode 100644 index 0000000..9b4182e --- /dev/null +++ b/themes/src/shaders/renderer2d_vert.cpp @@ -0,0 +1,16 @@ +#include "renderer2d_vert.h" + +const char* shader_renderer2d_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" +" \n" +"void main() { \n" +" vec4 fragmentPosition = projection * model * vMatrix * vec4(position.x, position.y, 0, 1); \n" +" gl_Position = fragmentPosition; \n" +" VertexColor = color; \n" +"} \n" +" \n"; diff --git a/themes/src/shaders/renderer2d_vert.h b/themes/src/shaders/renderer2d_vert.h index b32cf9f..cfd09c5 100644 --- a/themes/src/shaders/renderer2d_vert.h +++ b/themes/src/shaders/renderer2d_vert.h @@ -1,4 +1,4 @@ #ifndef SHADER_RENDERER2D_VERT #define SHADER_RENDERER2D_VERT -const char* shader_renderer2d_vert = " \n"; +extern const char* shader_renderer2d_vert; #endif diff --git a/themes/src/shaders/renderer3d_frag.cpp b/themes/src/shaders/renderer3d_frag.cpp new file mode 100644 index 0000000..a83f2e6 --- /dev/null +++ b/themes/src/shaders/renderer3d_frag.cpp @@ -0,0 +1,10 @@ +#include "renderer3d_frag.h" + +const char* shader_renderer3d_frag = "varying lowp vec4 VertexColor; \n" +"varying lowp vec4 VertexNormal; \n" +" \n" +"void main() { \n" +" const lowp vec3 lightDirection = vec3(0.0, 1.0, 0.0); \n" +" gl_FragColor = vec4(VertexColor.xyz * dot(VertexNormal.xyz, lightDirection), 1); \n" +"} \n" +" \n"; diff --git a/themes/src/shaders/renderer3d_frag.h b/themes/src/shaders/renderer3d_frag.h index 6b3a936..25f1fdf 100644 --- a/themes/src/shaders/renderer3d_frag.h +++ b/themes/src/shaders/renderer3d_frag.h @@ -1,11 +1,4 @@ #ifndef SHADER_RENDERER3D_FRAG #define SHADER_RENDERER3D_FRAG -const char* shader_renderer3d_frag = "varying lowp vec4 VertexColor; \n" -"varying lowp vec4 VertexNormal; \n" -" \n" -"void main() { \n" -" const lowp vec3 lightDirection = vec3(0.0, 1.0, 0.0); \n" -" gl_FragColor = vec4(VertexColor.xyz * dot(VertexNormal.xyz, lightDirection), 1); \n" -"} \n" -" \n"; +extern const char* shader_renderer3d_frag; #endif diff --git a/themes/src/shaders/renderer3d_vert.cpp b/themes/src/shaders/renderer3d_vert.cpp new file mode 100644 index 0000000..083a69d --- /dev/null +++ b/themes/src/shaders/renderer3d_vert.cpp @@ -0,0 +1,18 @@ +#include "renderer3d_vert.h" + +const char* shader_renderer3d_vert = "attribute vec4 position; \n" +"attribute vec4 color; \n" +"attribute vec4 normal; \n" +"uniform mat4 projection; \n" +"uniform mat4 view; \n" +"uniform mat4 model; \n" +"varying lowp vec4 VertexColor; \n" +"varying lowp vec4 VertexNormal; \n" +" \n" +"void main() { \n" +" vec4 fragmentPosition = projection * view * model * position; \n" +" gl_Position = fragmentPosition; \n" +" VertexColor = color; \n" +" VertexNormal = normal; \n" +"} \n" +" \n"; diff --git a/themes/src/shaders/renderer3d_vert.h b/themes/src/shaders/renderer3d_vert.h index 20e69f9..760cad5 100644 --- a/themes/src/shaders/renderer3d_vert.h +++ b/themes/src/shaders/renderer3d_vert.h @@ -1,19 +1,4 @@ #ifndef SHADER_RENDERER3D_VERT #define SHADER_RENDERER3D_VERT -const char* shader_renderer3d_vert = "attribute vec4 position; \n" -"attribute vec4 color; \n" -"attribute vec4 normal; \n" -"uniform mat4 projection; \n" -"uniform mat4 view; \n" -"uniform mat4 model; \n" -"varying lowp vec4 VertexColor; \n" -"varying lowp vec4 VertexNormal; \n" -" \n" -"void main() { \n" -" vec4 fragmentPosition = projection * view * model * position; \n" -" gl_Position = fragmentPosition; \n" -" VertexColor = color; \n" -" VertexNormal = normal; \n" -"} \n" -" \n"; +extern const char* shader_renderer3d_vert; #endif diff --git a/themes/src/shaders/sun_vert.cpp b/themes/src/shaders/sun_vert.cpp new file mode 100644 index 0000000..0049bfd --- /dev/null +++ b/themes/src/shaders/sun_vert.cpp @@ -0,0 +1,3 @@ +#include "sun_vert.h" + +const char* shader_sun_vert = " \n"; diff --git a/themes/src/shaders/sun_vert.h b/themes/src/shaders/sun_vert.h index 2f9bf69..9c95b49 100644 --- a/themes/src/shaders/sun_vert.h +++ b/themes/src/shaders/sun_vert.h @@ -1,4 +1,4 @@ #ifndef SHADER_SUN_VERT #define SHADER_SUN_VERT -const char* shader_sun_vert = " \n"; +extern const char* shader_sun_vert; #endif |