[Bf-blender-cvs] [28245d89741] temp-lineart-contained: LineArt: Bound box shifting support.
YimingWu
noreply at git.blender.org
Thu Jul 29 14:10:13 CEST 2021
Commit: 28245d897416c6b5c6169e428e3defd1e3a5880a
Author: YimingWu
Date: Wed Jul 28 19:48:10 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB28245d897416c6b5c6169e428e3defd1e3a5880a
LineArt: Bound box shifting support.
===================================================================
M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
===================================================================
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index fd3f065f962..6a9530593d0 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2121,7 +2121,10 @@ static void lineart_geometry_load_assign_thread(LineartObjectLoadTaskInfo *olti_
use_olti->pending = obi;
}
-static bool lineart_geometry_check_visible(double (*model_view_proj)[4], Object *use_ob)
+static bool lineart_geometry_check_visible(double (*model_view_proj)[4],
+ double shift_x,
+ double shift_y,
+ Object *use_ob)
{
BoundBox *bb = BKE_object_boundbox_get(use_ob);
if (!bb) {
@@ -2135,6 +2138,8 @@ static bool lineart_geometry_check_visible(double (*model_view_proj)[4], Object
copy_v3db_v3fl(co[i], bb->vec[i]);
copy_v3_v3_db(tmp, co[i]);
mul_v4_m4v3_db(co[i], model_view_proj, tmp);
+ co[i][0] -= shift_x * 2 * co[i][3];
+ co[i][1] -= shift_y * 2 * co[i][3];
}
bool cond[6] = {true, true, true, true, true, true};
@@ -2179,11 +2184,11 @@ static void lineart_main_load_geometries(
if (fit == CAMERA_SENSOR_FIT_HOR && asp < 1) {
sensor /= asp;
}
- double fov = focallength_to_fov(cam->lens / (1 + rb->overscan), sensor);
+ const double fov = focallength_to_fov(cam->lens / (1 + rb->overscan), sensor);
lineart_matrix_perspective_44d(proj, fov, asp, cam->clip_start, cam->clip_end);
}
else if (cam->type == CAM_ORTHO) {
- double w = cam->ortho_scale / 2;
+ const double w = cam->ortho_scale / 2;
lineart_matrix_ortho_44d(proj, -w, w, -w / asp, w / asp, cam->clip_start, cam->clip_end);
}
@@ -2240,7 +2245,7 @@ static void lineart_main_load_geometries(
continue;
}
- if (!lineart_geometry_check_visible(obi->model_view_proj, use_ob)) {
+ if (!lineart_geometry_check_visible(obi->model_view_proj, rb->shift_x, rb->shift_y, use_ob)) {
if (G.debug_value == 4000) {
bound_box_discard_count++;
}
More information about the Bf-blender-cvs
mailing list