From b6a666e96ffd04bd6d52be8fd9899faf27b751db Mon Sep 17 00:00:00 2001 From: mattkae Date: Mon, 31 Jul 2023 07:31:52 -0400 Subject: Some initial shader loading work --- themes/src/shaders/renderer2d.frag | 0 themes/src/shaders/renderer2d.vert | 0 themes/src/shaders/renderer2d_frag.h | 4 ++++ themes/src/shaders/renderer2d_vert.h | 4 ++++ themes/src/shaders/renderer3d.frag | 7 ------- themes/src/shaders/renderer3d.vert | 15 --------------- themes/src/shaders/renderer3d_frag.h | 11 +++++++++++ themes/src/shaders/renderer3d_vert.h | 19 +++++++++++++++++++ themes/src/shaders/sun_vert.h | 4 ++++ 9 files changed, 42 insertions(+), 22 deletions(-) delete mode 100644 themes/src/shaders/renderer2d.frag delete mode 100644 themes/src/shaders/renderer2d.vert create mode 100644 themes/src/shaders/renderer2d_frag.h create mode 100644 themes/src/shaders/renderer2d_vert.h delete mode 100644 themes/src/shaders/renderer3d.frag delete mode 100644 themes/src/shaders/renderer3d.vert create mode 100644 themes/src/shaders/renderer3d_frag.h create mode 100644 themes/src/shaders/renderer3d_vert.h create mode 100644 themes/src/shaders/sun_vert.h (limited to 'themes/src/shaders') diff --git a/themes/src/shaders/renderer2d.frag b/themes/src/shaders/renderer2d.frag deleted file mode 100644 index e69de29..0000000 diff --git a/themes/src/shaders/renderer2d.vert b/themes/src/shaders/renderer2d.vert deleted file mode 100644 index e69de29..0000000 diff --git a/themes/src/shaders/renderer2d_frag.h b/themes/src/shaders/renderer2d_frag.h new file mode 100644 index 0000000..6f5e472 --- /dev/null +++ b/themes/src/shaders/renderer2d_frag.h @@ -0,0 +1,4 @@ +#ifndef SHADER_RENDERER2D_FRAG +#define SHADER_RENDERER2D_FRAG +const char* shader_renderer2d_frag = " \n"; +#endif diff --git a/themes/src/shaders/renderer2d_vert.h b/themes/src/shaders/renderer2d_vert.h new file mode 100644 index 0000000..b32cf9f --- /dev/null +++ b/themes/src/shaders/renderer2d_vert.h @@ -0,0 +1,4 @@ +#ifndef SHADER_RENDERER2D_VERT +#define SHADER_RENDERER2D_VERT +const char* shader_renderer2d_vert = " \n"; +#endif diff --git a/themes/src/shaders/renderer3d.frag b/themes/src/shaders/renderer3d.frag deleted file mode 100644 index 2f50347..0000000 --- a/themes/src/shaders/renderer3d.frag +++ /dev/null @@ -1,7 +0,0 @@ -varying lowp vec4 VertexColor; -varying lowp vec4 VertexNormal; - -void main() { - const lowp vec3 lightDirection = vec3(0.0, 1.0, 0.0); - gl_FragColor = vec4(VertexColor.xyz * dot(VertexNormal.xyz, lightDirection), 1); -} diff --git a/themes/src/shaders/renderer3d.vert b/themes/src/shaders/renderer3d.vert deleted file mode 100644 index 026285f..0000000 --- a/themes/src/shaders/renderer3d.vert +++ /dev/null @@ -1,15 +0,0 @@ -attribute vec4 position; -attribute vec4 color; -attribute vec4 normal; -uniform mat4 projection; -uniform mat4 view; -uniform mat4 model; -varying lowp vec4 VertexColor; -varying lowp vec4 VertexNormal; - -void main() { - vec4 fragmentPosition = projection * view * model * position; - gl_Position = fragmentPosition; - VertexColor = color; - VertexNormal = normal; -} diff --git a/themes/src/shaders/renderer3d_frag.h b/themes/src/shaders/renderer3d_frag.h new file mode 100644 index 0000000..6b3a936 --- /dev/null +++ b/themes/src/shaders/renderer3d_frag.h @@ -0,0 +1,11 @@ +#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"; +#endif diff --git a/themes/src/shaders/renderer3d_vert.h b/themes/src/shaders/renderer3d_vert.h new file mode 100644 index 0000000..20e69f9 --- /dev/null +++ b/themes/src/shaders/renderer3d_vert.h @@ -0,0 +1,19 @@ +#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"; +#endif diff --git a/themes/src/shaders/sun_vert.h b/themes/src/shaders/sun_vert.h new file mode 100644 index 0000000..2f9bf69 --- /dev/null +++ b/themes/src/shaders/sun_vert.h @@ -0,0 +1,4 @@ +#ifndef SHADER_SUN_VERT +#define SHADER_SUN_VERT +const char* shader_sun_vert = " \n"; +#endif -- cgit v1.2.1