From 3e9cb72a58aaa9cb18919ef4508c2f4483710c62 Mon Sep 17 00:00:00 2001 From: Valerie Date: Sun, 14 Apr 2024 17:37:44 -0400 Subject: [PATCH] initial implementation of world curvature --- shaders/gbuffers_basic.vsh | 6 ++++++ shaders/gbuffers_entities.fsh | 1 + shaders/gbuffers_entities.vsh | 2 ++ shaders/gbuffers_terrain.fsh | 1 + shaders/gbuffers_terrain.vsh | 2 ++ shaders/lang/en_US.lang | 6 ++---- shaders/module/world.vert | 8 ++++++++ shaders/shaders.properties | 2 +- 8 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 shaders/gbuffers_entities.fsh create mode 100644 shaders/gbuffers_entities.vsh create mode 100644 shaders/gbuffers_terrain.fsh create mode 100644 shaders/gbuffers_terrain.vsh create mode 100644 shaders/module/world.vert diff --git a/shaders/gbuffers_basic.vsh b/shaders/gbuffers_basic.vsh index 8752f2f..11e87ab 100644 --- a/shaders/gbuffers_basic.vsh +++ b/shaders/gbuffers_basic.vsh @@ -2,6 +2,8 @@ #define pixelSize 2 // [1 2 4 8 16] +#define worldCurvature 0 // [0 1 2] + varying vec2 texcoord; varying vec4 color; varying vec2 lmcoord; @@ -26,5 +28,9 @@ void main() { #ifdef tWarp texture_warp(); #endif + + #ifdef WORLD + #include "/module/world.vert" + #endif } diff --git a/shaders/gbuffers_entities.fsh b/shaders/gbuffers_entities.fsh new file mode 100644 index 0000000..74dd3ca --- /dev/null +++ b/shaders/gbuffers_entities.fsh @@ -0,0 +1 @@ +#include "/gbuffers_basic.fsh" diff --git a/shaders/gbuffers_entities.vsh b/shaders/gbuffers_entities.vsh new file mode 100644 index 0000000..e08a961 --- /dev/null +++ b/shaders/gbuffers_entities.vsh @@ -0,0 +1,2 @@ +#define WORLD +#include "/gbuffers_basic.vsh" diff --git a/shaders/gbuffers_terrain.fsh b/shaders/gbuffers_terrain.fsh new file mode 100644 index 0000000..74dd3ca --- /dev/null +++ b/shaders/gbuffers_terrain.fsh @@ -0,0 +1 @@ +#include "/gbuffers_basic.fsh" diff --git a/shaders/gbuffers_terrain.vsh b/shaders/gbuffers_terrain.vsh new file mode 100644 index 0000000..e08a961 --- /dev/null +++ b/shaders/gbuffers_terrain.vsh @@ -0,0 +1,2 @@ +#define WORLD +#include "/gbuffers_basic.vsh" diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang index c008789..07b7127 100644 --- a/shaders/lang/en_US.lang +++ b/shaders/lang/en_US.lang @@ -44,8 +44,6 @@ value.dofRes.0=Static value.dofRes.1=Dynamic option.worldCurvature=World Curvature value.worldCurvature.0=Off -value.worldCurvature.1=Chunk -value.worldCurvature.2=Cylinder -value.worldCurvature.3=Polyhedron -value.worldCurvature.4=Sphere +value.worldCurvature.1=Cylinder +value.worldCurvature.2=Round diff --git a/shaders/module/world.vert b/shaders/module/world.vert new file mode 100644 index 0000000..e4abe93 --- /dev/null +++ b/shaders/module/world.vert @@ -0,0 +1,8 @@ +#if worldCurvature == 1 + float z = gl_Position.z * gl_Position.z; + gl_Position.y -= z / 256; +#elif worldCurvature == 2 + vec2 xz = gl_Position.xz; + gl_Position.y -= ceil(( dot(xz, xz) * 5 ) / 512) / 5; +#endif + diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 291e85f..6889ba6 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -19,7 +19,7 @@ screen.COLOR=colorMode dithering rgbSteps hueSteps satSt screen.PSX=vWarp tWarp # fx -screen.FX=dof dofRes +screen.FX=dof dofRes worldCurvature # -- CONDITIONALS -- gbuffers_hand.enabled=tWarp