Why am I doing this?

This commit is contained in:
korenkonder
2023-12-25 12:46:18 +03:00
parent 1cdc843de0
commit 19b4ed9ce2
3 changed files with 18 additions and 12 deletions
+3 -3
View File
@@ -467,7 +467,7 @@ namespace mdl {
texture* tex = texture_handler_get_texture(texture_id);
gl_state_bind_sampler(tex_index, rctx->samplers[(wrap_t * 3 + wrap_s) * 2
+ (tex->max_mipmap_level > 0 ? 1 : 0)]);
+ (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]);
}
}
@@ -723,7 +723,7 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo
texture* tex = texture_handler_get_texture(texture_id);
gl_state_bind_sampler(tex_index, rctx->samplers[(wrap_t * 3 + wrap_s) * 2
+ (tex->max_mipmap_level > 0 ? 1 : 0)]);
+ (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]);
}
if (material->material.shader.index == SHADER_FT_SKY) {
@@ -925,7 +925,7 @@ static void draw_object_material_set_reflect(const mdl::ObjSubMeshArgs* args) {
texture* tex = texture_handler_get_texture(texture_id);
gl_state_bind_sampler(i, rctx->samplers[(wrap_t * 3 + wrap_s) * 2
+ (tex->max_mipmap_level > 0 ? 1 : 0)]);
+ (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]);
}
vec4 ambient;
+11 -5
View File
@@ -1298,13 +1298,19 @@ namespace rndr {
}
if (render_manager->npr_param == 1) {
/*gl_state_active_bind_texture_2d(16, sss_contour_texture->GetColorTex());
gl_state_bind_sampler(16, rctx->render_samplers[1]);
gl_state_active_bind_texture_2d(17, sss_contour_texture->GetDepthTex());
gl_state_bind_sampler(17, rctx->render_samplers[1]);*/
gl_state_active_bind_texture_2d(14, rend_texture[0].GetDepthTex());
gl_state_bind_sampler(14, rctx->render_samplers[1]);
/*gl_state_active_bind_texture_2d(16, sss_contour_texture->GetColorTex());
gl_state_active_bind_texture_2d(17, sss_contour_texture->GetDepthTex());*/
}
else {
gl_state_active_bind_texture_2d(14, rctx->empty_texture_2d);
/*gl_state_active_bind_texture_2d(16, rctx->empty_texture_2d);
gl_state_active_bind_texture_2d(17, rctx->empty_texture_2d);*/
}
gl_state_bind_sampler(14, rctx->render_samplers[1]);
/*gl_state_bind_sampler(16, rctx->render_samplers[1]);
gl_state_bind_sampler(17, rctx->render_samplers[1]);*/
rctx->tone_map_ubo.WriteMemory(shader_data);
+4 -4
View File
@@ -951,12 +951,12 @@ namespace rndr {
rctx->contour_params_ubo.WriteMemory(contour_params_data);
shaders_ft.set(SHADER_FT_CONTOUR_NPR);
gl_state_active_bind_texture_2d(16, contour_rt->GetColorTex());
gl_state_bind_sampler(16, rctx->render_samplers[1]);
gl_state_active_bind_texture_2d(17, contour_rt->GetDepthTex());
gl_state_bind_sampler(17, rctx->render_samplers[1]);
gl_state_active_bind_texture_2d(14, rt->GetDepthTex());
gl_state_active_bind_texture_2d(16, contour_rt->GetColorTex());
gl_state_active_bind_texture_2d(17, contour_rt->GetDepthTex());
gl_state_bind_sampler(14, rctx->render_samplers[1]);
gl_state_bind_sampler(16, rctx->render_samplers[1]);
gl_state_bind_sampler(17, rctx->render_samplers[1]);
rctx->quad_ubo.Bind(0);
rctx->contour_params_ubo.Bind(2);
gl_state_bind_vertex_array(rctx->common_vao);