[Bf-blender-cvs] [1705587e21b] master: Cleanup: note that compositor vector blur shares logic with zbuf.c

Campbell Barton noreply at git.blender.org
Mon Jan 10 03:50:21 CET 2022


Commit: 1705587e21bc62f67a0aa297769853e1903d2a44
Author: Campbell Barton
Date:   Mon Jan 10 13:47:13 2022 +1100
Branches: master
https://developer.blender.org/rB1705587e21bc62f67a0aa297769853e1903d2a44

Cleanup: note that compositor vector blur shares logic with zbuf.c

Note that some functions have been copied between these files.
De-duplication isn't trivial as there are differences in some functions.

===================================================================

M	source/blender/compositor/operations/COM_VectorBlurOperation.cc
M	source/blender/render/intern/zbuf.c

===================================================================

diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc
index e34b629f457..1d097b37ca5 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc
@@ -180,8 +180,13 @@ void VectorBlurOperation::generate_vector_blur(float *data,
                           inputZ->get_buffer());
 }
 
-/* ****************** Spans ******************************* */
-/* span fill in method, is also used to localize data for zbuffering */
+/* -------------------------------------------------------------------- */
+/** \name Spans
+ *
+ * Duplicated logic from `zbuf.c`.
+ * \{ */
+
+/** Span fill in method, is also used to localize data for Z-buffering. */
 struct ZSpan {
   /* range for clipping */
   int rectx, recty;
@@ -327,11 +332,13 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
   }
 
   for (y = my2; y >= my0; y--, xs0 += dx0) {
-    /* xs0 is the xcoord! */
+    /* xs0 is the X-coordinate! */
     span[y] = xs0;
   }
 }
 
+/** \} */
+
 /* ******************** VECBLUR ACCUM BUF ************************* */
 
 struct DrawBufPixel {
@@ -339,6 +346,9 @@ struct DrawBufPixel {
   float alpha;
 };
 
+/**
+ * \note Near duplicate of `zspan_scanconvert` in `zbuf.c` with some minor adjustments.
+ */
 static void zbuf_fill_in_rgba(
     ZSpan *zspan, DrawBufPixel *col, float *v1, float *v2, float *v3, float *v4)
 {
diff --git a/source/blender/render/intern/zbuf.c b/source/blender/render/intern/zbuf.c
index 1812a492ac0..beba10ad82a 100644
--- a/source/blender/render/intern/zbuf.c
+++ b/source/blender/render/intern/zbuf.c
@@ -19,6 +19,9 @@
 
 /** \file
  * \ingroup render
+ *
+ * \note Some of this logic has been duplicated in `COM_VectorBlurOperation.cc`
+ * changes here may also apply also apply to that file.
  */
 
 /*---------------------------------------------------------------------------*/



More information about the Bf-blender-cvs mailing list