diff --git a/src/libs/gltf/gltf_view/lv_gltf_view.cpp b/src/libs/gltf/gltf_view/lv_gltf_view.cpp index 4dcd80a6a8..1528a4a645 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view.cpp +++ b/src/libs/gltf/gltf_view/lv_gltf_view.cpp @@ -688,8 +688,8 @@ static void lv_gltf_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) static void lv_gltf_view_state_init(lv_gltf_t * view) { lv_memset(&view->state, 0, sizeof(view->state)); - view->state.opaque_frame_buffer_width = 256; - view->state.opaque_frame_buffer_height = 256; + view->state.opaque_frame_buffer_width = LV_GLTF_TRANSMISSION_PASS_SIZE; + view->state.opaque_frame_buffer_height = LV_GLTF_TRANSMISSION_PASS_SIZE; view->state.material_variant = 0; view->state.render_state_ready = false; view->state.render_opaque_buffer = false; diff --git a/src/libs/gltf/gltf_view/lv_gltf_view_internal.h b/src/libs/gltf/gltf_view/lv_gltf_view_internal.h index 937c12f46d..8cf1f1509c 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view_internal.h +++ b/src/libs/gltf/gltf_view/lv_gltf_view_internal.h @@ -40,6 +40,7 @@ #define LV_GLTF_GAMMA_DARKEST "0.8" #define LV_GLTF_DISTANCE_SCALE_FACTOR 2.5f +#define LV_GLTF_TRANSMISSION_PASS_SIZE 256 /* Apply defaults below if not set explicitly */ diff --git a/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp b/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp index ba3e6e226a..3adef36933 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp +++ b/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp @@ -572,7 +572,9 @@ static bool draw_material(lv_gltf_t * viewer, const lv_gltf_uniform_locations_t GL_CALL(glDisable(GL_CULL_FACE)); if(gltfMaterial.alphaMode == fastgltf::AlphaMode::Blend) { GL_CALL(glEnable(GL_BLEND)); - GL_CALL(glDepthMask(GL_FALSE)); + if(!is_transmission_pass) { + GL_CALL(glDepthMask(GL_FALSE)); + } GL_CALL(glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); GL_CALL(glBlendEquation(GL_FUNC_ADD)); GL_CALL(glEnable(GL_CULL_FACE)); @@ -1037,8 +1039,8 @@ static void setup_view_proj_matrix_from_camera(lv_gltf_t * viewer, uint32_t came float aspect = (float)width / (float)height; if(transmission_pass) { - width = 256; - height = 256; + width = LV_GLTF_TRANSMISSION_PASS_SIZE; + height = LV_GLTF_TRANSMISSION_PASS_SIZE; } std::visit(fastgltf::visitor{