fix emission buffer writing & fix entity shader

This commit is contained in:
MihailRis
2025-07-12 23:28:38 +03:00
parent 3f3f48eb6d
commit 2831d1c963
6 changed files with 34 additions and 18 deletions
+3 -3
View File
@@ -15,6 +15,7 @@ out vec3 a_position;
out vec3 a_realnormal;
out vec4 a_color;
out vec4 a_modelpos;
out float a_emission;
uniform mat4 u_model;
uniform mat4 u_proj;
@@ -31,8 +32,6 @@ uniform float u_torchlightDistance;
#include <lighting>
#include <fog>
#define SKY_LIGHT_BRIGHTNESS_COMPENSATION 0.1
void main() {
a_modelpos = u_model * vec4(v_position, 1.0);
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
@@ -48,13 +47,14 @@ void main() {
a_texCoord = v_texCoord;
a_dir = a_modelpos.xyz - u_cameraPos;
vec3 skyLightColor = pick_sky_color(u_skybox) + SKY_LIGHT_BRIGHTNESS_COMPENSATION;
vec3 skyLightColor = pick_sky_color(u_skybox);
a_color.rgb = max(a_color.rgb, skyLightColor.rgb * v_light.a) * v_color;
a_color.a = u_opacity;
mat4 viewmodel = u_view * u_model;
a_distance = length(viewmodel * vec4(pos3d, 0.0));
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
a_emission = v_normal.w;
vec4 viewmodelpos = u_view * a_modelpos;
a_position = viewmodelpos.xyz;