Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2021-06-24 08:09:25 +0300
committerYimingWu <xp8110@outlook.com>2021-06-24 08:09:25 +0300
commitde05e261ec1fe5687859c797b98d7fb65260f954 (patch)
tree1101d902f2409c28f9077e58c7939b5f6d93aab9
parentf7fbb518c8194e0a416321f5856e947d5592e131 (diff)
Line Art: Discard out of frame edges.
For scenes that have a lot of edges, this could potentially save some time generating individual strokes that are outside camera frustum. Reviewed By: Sebastian Parborg (zeddb) Differential Revision: https://developer.blender.org/D11525
m---------release/datafiles/locale0
m---------release/scripts/addons0
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c20
3 files changed, 20 insertions, 0 deletions
diff --git a/release/datafiles/locale b/release/datafiles/locale
-Subproject ab283053ab455f76f5620b59b823e73bd9f601c
+Subproject 4833954c0ac85cc407e1d5a153aa11b1d1823ec
diff --git a/release/scripts/addons b/release/scripts/addons
-Subproject ec07ed4c2e0495bea7fbe0b546d25e35211506a
+Subproject f86f25e62217264495d05f116ccb09d575fe984
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 3796e374db7..c00bd7c1cb5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1372,6 +1372,24 @@ static void lineart_main_perspective_division(LineartRenderBuffer *rb)
}
}
+static void lineart_main_discard_out_of_frame_edges(LineartRenderBuffer *rb)
+{
+ LineartEdge *e;
+ int i;
+
+#define LRT_VERT_OUT_OF_BOUND(v) \
+ (v && (v->fbcoord[0] < -1 || v->fbcoord[0] > 1 || v->fbcoord[1] < -1 || v->fbcoord[1] > 1))
+
+ LISTBASE_FOREACH (LineartElementLinkNode *, eln, &rb->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))) {
+ e[i].flags = LRT_EDGE_FLAG_CHAIN_PICKED;
+ }
+ }
+ }
+}
+
/**
* Transform a single vert to it's viewing position.
*/
@@ -3911,6 +3929,8 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
/* Do the perspective division after clipping is done. */
lineart_main_perspective_division(rb);
+ lineart_main_discard_out_of_frame_edges(rb);
+
/* Triangle intersections are done here during sequential adding of them. Only after this,
* triangles and lines are all linked with acceleration structure, and the 2D occlusion stage
* can do its job. */