aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/chunk.vert
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2023-12-02 17:59:34 +0100
committermakamys <makamys@outlook.com>2023-12-03 00:48:45 +0100
commit2f4979260b60f90ef0fce1b9305b74bcd9fb8af5 (patch)
tree1faa8cc83615e167d7eba206b0c24a6a599e33dd /src/main/resources/shaders/chunk.vert
parent1b32e6e42aa0d377ee7556b504130e37e26463bf (diff)
downloadNeodymium-2f4979260b60f90ef0fce1b9305b74bcd9fb8af5.tar.gz
Neodymium-2f4979260b60f90ef0fce1b9305b74bcd9fb8af5.tar.bz2
Neodymium-2f4979260b60f90ef0fce1b9305b74bcd9fb8af5.zip
Fix camera shake at high distances
- Made chunk meshes use region-relative coordinates - Moved mesh tracking to NeoRegion - Regions are now drawn separately, allowing a different translation to be set for each
Diffstat (limited to 'src/main/resources/shaders/chunk.vert')
-rw-r--r--src/main/resources/shaders/chunk.vert8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/resources/shaders/chunk.vert b/src/main/resources/shaders/chunk.vert
index 9988605..56bc2d6 100644
--- a/src/main/resources/shaders/chunk.vert
+++ b/src/main/resources/shaders/chunk.vert
@@ -19,7 +19,7 @@ uniform vec2 fogStartEnd;
uniform int fogMode;
uniform float fogDensity;
-uniform vec3 playerPos;
+uniform vec3 renderOffset;
out vec2 TexCoord;
#ifdef RPLE
@@ -38,7 +38,8 @@ out float FogFactor; // -1 means: disable fog
void main()
{
- gl_Position = proj * modelView * (vec4(aPos - playerPos, 1.0) + vec4(0, 0.12, 0, 0));
+ vec4 untransformedPos = (vec4(aPos, 1.0) + vec4(renderOffset.x, renderOffset.y + 0.12, renderOffset.z, 0));
+ gl_Position = proj * modelView * untransformedPos;
TexCoord = aTexCoord;
#ifdef RPLE
BTexCoordR = aBTexCoordR;
@@ -56,8 +57,7 @@ void main()
if(fogStartEnd.x >= 0 && fogStartEnd.y >= 0){
float s = fogStartEnd.x;
float e = fogStartEnd.y;
- vec4 eyePos = (modelView * (vec4(aPos - playerPos, 1.0) + vec4(0, 0.12, 0, 0)));
- float c = length(eyePos);
+ float c = length(untransformedPos);
float fogFactor = fogMode == 0x2601
? clamp((e - c) / (e - s), 0, 1) /* GL_LINEAR */