fix particle fog

`finFragmentPosition` was not set. This caused the fog to not appear. Some gpu drivers (e.g. intel) also heavily optimized the fog code and completely removed the uniform `uCameraPosition`, thus minosoft crashed when setting the value on those gpus.
This commit is contained in:
Moritz Zwerger 2024-04-23 17:46:30 +02:00
parent ff92b1f0db
commit a433215260
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -54,5 +54,4 @@ class ShaderUniform<T>(
upload()
}
}
}

View File

@ -21,6 +21,7 @@ uniform vec3 uCameraRight;
uniform vec3 uCameraUp;
out vec4 finTintColor;
out vec3 finFragmentPosition;
in Vertex
{
@ -41,8 +42,9 @@ in Vertex
void emit(vec3 offset, vec2 uv) {
vec3 pointPosition = gl_in[0].gl_Position.xyz;
finFragmentPosition = pointPosition + (offset * ginVertex[0].scale);
gl_Position = uViewProjectionMatrix * vec4(pointPosition + offset * ginVertex[0].scale, 1.0);
gl_Position = uViewProjectionMatrix * vec4(finFragmentPosition, 1.0f);
finAnimationUV = uv;
EmitVertex();