From fe31cf69dba1612c1a53f468ced6f6032b31c133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Sat, 24 Aug 2024 08:22:19 +0200 Subject: [PATCH] fix sorting --- engine/joint/v4k.h | 4 ++-- engine/split/v4k_render.c | 4 ++-- engine/v4k.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 6500dbb..8496568 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -385912,7 +385912,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ if (rs_idx > RENDER_PASS_OVERRIDES_BEGIN) { for(int i = 0; i < q->nummeshes; i++) { - array_push(drawcalls, (drawcall_t){i, 0}); + array_push(drawcalls, (drawcall_t){i, -1}); } } else { if(pass == -1 || pass == RENDER_PASS_OPAQUE) { @@ -385922,7 +385922,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ drawcall_t call; call.mesh = i; call.tex = m.textures[i]; - call.distance = 0; + call.distance = -1; if (m.shading == SHADING_PBR) call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id; array_push(drawcalls, call); diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 1cd2a81..090351e 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -4272,7 +4272,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ if (rs_idx > RENDER_PASS_OVERRIDES_BEGIN) { for(int i = 0; i < q->nummeshes; i++) { - array_push(drawcalls, (drawcall_t){i, 0}); + array_push(drawcalls, (drawcall_t){i, -1}); } } else { if(pass == -1 || pass == RENDER_PASS_OPAQUE) { @@ -4282,7 +4282,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ drawcall_t call; call.mesh = i; call.tex = m.textures[i]; - call.distance = 0; + call.distance = -1; if (m.shading == SHADING_PBR) call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id; array_push(drawcalls, call); diff --git a/engine/v4k.c b/engine/v4k.c index d3c91be..b5b70c6 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -21071,7 +21071,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ if (rs_idx > RENDER_PASS_OVERRIDES_BEGIN) { for(int i = 0; i < q->nummeshes; i++) { - array_push(drawcalls, (drawcall_t){i, 0}); + array_push(drawcalls, (drawcall_t){i, -1}); } } else { if(pass == -1 || pass == RENDER_PASS_OPAQUE) { @@ -21081,7 +21081,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_ drawcall_t call; call.mesh = i; call.tex = m.textures[i]; - call.distance = 0; + call.distance = -1; if (m.shading == SHADING_PBR) call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id; array_push(drawcalls, call);