it pans properly now

Objects
Milk.H 2023-03-31 23:59:59 +02:00
parent df9c5f387f
commit 7eb4ece49f
No known key found for this signature in database
GPG Key ID: 3D9DAE46AAC37BD8
2 changed files with 2 additions and 6 deletions

View File

@ -8,9 +8,7 @@ uniform sampler2D tex;
void main() void main()
{ {
// Sample the texture using the texture coordinates vec4 tex_color = texture(tex, v_texcoord*60);
vec4 tex_color = texture(tex, v_texcoord);
// Output the final color
frag_color = tex_color; frag_color = tex_color;
} }

View File

@ -18,7 +18,5 @@ void main()
gl_Position = projection * view * model * vec4(position, 1.0); gl_Position = projection * view * model * vec4(position, 1.0);
// Calculate the texture coordinate offset based on the camera position // Calculate the texture coordinate offset based on the camera position
vec2 offset = (camera_position.xz - position.xz) / tile_size; v_texcoord = texcoord;
offset += scroll_speed * vec2(0, 1) * -(gl_Position.w / projection[1][1]);
v_texcoord = texcoord + offset;
} }