Merge branch 'blender-v4.1-release'

This commit is contained in:
Miguel Pozo
2024-02-26 12:51:59 +01:00
3 changed files with 30 additions and 6 deletions

View File

@@ -526,6 +526,8 @@ BLI_INLINE void material_shadow(EEVEE_Data *vedata,
/* This GPUShader has already been used by another material.
* Add new shading group just after to avoid shader switching cost. */
grp = DRW_shgroup_create_sub(*grp_p);
/* Per material uniforms. */
DRW_shgroup_uniform_float_copy(grp, "alphaClipThreshold", alpha_clip_threshold);
}
else {
*grp_p = grp = DRW_shgroup_create(sh, psl->shadow_pass);
@@ -606,6 +608,8 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
/* This GPUShader has already been used by another material.
* Add new shading group just after to avoid shader switching cost. */
grp = DRW_shgroup_create_sub(*grp_p);
/* Per material uniforms. */
DRW_shgroup_uniform_float_copy(grp, "alphaClipThreshold", alpha_clip_threshold);
}
else {
*grp_p = grp = DRW_shgroup_create(sh, depth_ps);
@@ -653,6 +657,7 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
grp = DRW_shgroup_create_sub(*grp_p);
/* Per material uniforms. */
DRW_shgroup_uniform_float_copy(grp, "alphaClipThreshold", alpha_clip_threshold);
if (use_ssrefract) {
DRW_shgroup_uniform_float_copy(grp, "refractionDepth", ma->refract_depth);
}

View File

@@ -15,6 +15,7 @@
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.hh"
#include "BLI_sort.hh"
#include "BLI_task.h"
#include "BLI_time.h"
@@ -1385,16 +1386,29 @@ void lineart_main_perspective_division(LineartData *ld)
void lineart_main_discard_out_of_frame_edges(LineartData *ld)
{
LineartEdge *e;
int i;
const float bounds[4][2] = {{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, -1.0f}, {1.0f, 1.0f}};
#define LRT_VERT_OUT_OF_BOUND(v) \
(v && (v->fbcoord[0] < -1 || v->fbcoord[0] > 1 || v->fbcoord[1] < -1 || v->fbcoord[1] > 1))
(v->fbcoord[0] < -1 || v->fbcoord[0] > 1 || v->fbcoord[1] < -1 || v->fbcoord[1] > 1)
LISTBASE_FOREACH (LineartElementLinkNode *, eln, &ld->geom.line_buffer_pointers) {
e = (LineartEdge *)eln->pointer;
for (i = 0; i < eln->element_count; i++) {
if (LRT_VERT_OUT_OF_BOUND(e[i].v1) && LRT_VERT_OUT_OF_BOUND(e[i].v2)) {
for (int i = 0; i < eln->element_count; i++) {
if (!e[i].v1 || !e[i].v2) {
e[i].flags = LRT_EDGE_FLAG_CHAIN_PICKED;
continue;
}
const blender::float2 vec1(e[i].v1->fbcoord), vec2(e[i].v2->fbcoord);
if (LRT_VERT_OUT_OF_BOUND(e[i].v1) && LRT_VERT_OUT_OF_BOUND(e[i].v2)) {
/* A line could still cross the image border even when both of the vertices are out of
* bound. */
if (isect_seg_seg_v2(bounds[0], bounds[1], vec1, vec2) == ISECT_LINE_LINE_NONE &&
isect_seg_seg_v2(bounds[0], bounds[2], vec1, vec2) == ISECT_LINE_LINE_NONE &&
isect_seg_seg_v2(bounds[1], bounds[3], vec1, vec2) == ISECT_LINE_LINE_NONE &&
isect_seg_seg_v2(bounds[2], bounds[3], vec1, vec2) == ISECT_LINE_LINE_NONE)
{
e[i].flags = LRT_EDGE_FLAG_CHAIN_PICKED;
}
}
}
}

View File

@@ -232,6 +232,12 @@ static bool lineart_do_closest_segment(bool is_persp,
{
int side = 0;
int z_index = is_persp ? 3 : 2;
/* No need to do anything if the segment has no length. */
if (s2_fb_co_1[z_index] == s2_fb_co_2[z_index]) {
return false;
}
/* Always use the closest point to the light camera. */
if (s1_fb_co_1[z_index] >= s2_fb_co_1[z_index]) {
copy_v4_v4_db(r_fb_co_1, s2_fb_co_1);
@@ -748,8 +754,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
* the edge
*/
if (!(pi && LRT_DOUBLE_CLOSE_ENOUGH(ratio[0], 1.0f) &&
LRT_DOUBLE_CLOSE_ENOUGH(ratio[1], 0.0f)))
{
LRT_DOUBLE_CLOSE_ENOUGH(ratio[1], 0.0f))) {
trie[pi] = 1;
pi++;
}