fix no depth test and render_priority sorting
(cherry picked from commit 2abe7deae8
)
This commit is contained in:
parent
055004c589
commit
39f3a575d6
|
@ -1002,7 +1002,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
||||||
has_alpha = false;
|
has_alpha = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element();
|
RenderList::Element *e = (has_alpha || p_material->shader->spatial.no_depth_test) ? render_list.add_alpha_element() : render_list.add_element();
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
return;
|
return;
|
||||||
|
@ -2811,13 +2811,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
|
|
||||||
|
|
||||||
if (sky && sky->panorama.is_valid()) {
|
|
||||||
_draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (probe_interior) {
|
if (probe_interior) {
|
||||||
env_radiance_tex = 0; //do not use radiance texture on interiors
|
env_radiance_tex = 0; //do not use radiance texture on interiors
|
||||||
state.default_ambient = Color(0, 0, 0, 1); //black as default ambient for interior
|
state.default_ambient = Color(0, 0, 0, 1); //black as default ambient for interior
|
||||||
|
@ -2827,6 +2820,14 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||||
render_list.sort_by_key(false);
|
render_list.sort_by_key(false);
|
||||||
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
|
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
|
||||||
|
|
||||||
|
// then draw the sky after
|
||||||
|
if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
|
||||||
|
|
||||||
|
if (sky && sky->panorama.is_valid()) {
|
||||||
|
_draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (storage->frame.current_rt && state.used_screen_texture) {
|
if (storage->frame.current_rt && state.used_screen_texture) {
|
||||||
//copy screen texture
|
//copy screen texture
|
||||||
storage->canvas->_copy_screen(Rect2());
|
storage->canvas->_copy_screen(Rect2());
|
||||||
|
|
|
@ -602,12 +602,10 @@ public:
|
||||||
struct SortByReverseDepthAndPriority {
|
struct SortByReverseDepthAndPriority {
|
||||||
|
|
||||||
_FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
|
_FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
|
||||||
uint32_t layer_A = uint32_t(A->sort_key >> SORT_KEY_PRIORITY_SHIFT);
|
if (A->priority == B->priority) {
|
||||||
uint32_t layer_B = uint32_t(B->sort_key >> SORT_KEY_PRIORITY_SHIFT);
|
|
||||||
if (layer_A == layer_B) {
|
|
||||||
return A->instance->depth > B->instance->depth;
|
return A->instance->depth > B->instance->depth;
|
||||||
} else {
|
} else {
|
||||||
return layer_A < layer_B;
|
return A->priority < B->priority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2372,7 +2372,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
|
||||||
has_alpha = false;
|
has_alpha = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element();
|
RenderList::Element *e = (has_alpha || p_material->shader->spatial.no_depth_test) ? render_list.add_alpha_element() : render_list.add_element();
|
||||||
|
|
||||||
if (!e)
|
if (!e)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue