54 ListBaseT<LineartStaticMemPoolNode>
pools;
231 ListBaseT<LineartEdgeChainItem>
chain;
296#define LRT_TILE_SPLITTING_TRIANGLE_LIMIT 100
297#define LRT_TILE_EDGE_COUNT_INITIAL 32
474#define DBL_TRIANGLE_LIM 1e-8
475#define DBL_EDGE_LIM 1e-9
477#define LRT_MEMORY_POOL_1MB (1 << 20)
490#define LRT_SHADOW_MASK_UNDEFINED 0
491#define LRT_SHADOW_MASK_ILLUMINATED (1 << 0)
492#define LRT_SHADOW_MASK_SHADED (1 << 1)
493#define LRT_SHADOW_MASK_ENCLOSED_SHAPE (1 << 2)
494#define LRT_SHADOW_MASK_INHIBITED (1 << 3)
495#define LRT_SHADOW_SILHOUETTE_ERASED_GROUP (1 << 4)
496#define LRT_SHADOW_SILHOUETTE_ERASED_OBJECT (1 << 5)
497#define LRT_SHADOW_MASK_ILLUMINATED_SHAPE (1 << 6)
499#define LRT_SHADOW_TEST_SHAPE_BITS \
500 (LRT_SHADOW_MASK_ILLUMINATED | LRT_SHADOW_MASK_SHADED | LRT_SHADOW_MASK_INHIBITED | \
501 LRT_SHADOW_MASK_ILLUMINATED_SHAPE)
508#define LRT_THREAD_EDGE_COUNT 1000
522#define LRT_OBINDEX_SHIFT 20
523#define LRT_OBINDEX_LOWER 0x0FFFFF
524#define LRT_OBINDEX_HIGHER 0xFFF00000
525#define LRT_EDGE_IDENTIFIER(obi, e) \
526 (((uint64_t)(obi->obindex | (e->v1->index & LRT_OBINDEX_LOWER)) << 32) | \
527 (obi->obindex | (e->v2->index & LRT_OBINDEX_LOWER)))
528#define LRT_LIGHT_CONTOUR_TARGET 0xFFFFFFFF
596 ListBaseT<LinkData>
lp;
597 ListBaseT<LinkData>
rp;
598 ListBaseT<LinkData>
up;
599 ListBaseT<LinkData>
bp;
615#define LRT_TILE(tile, r, c, CCount) tile[r * CCount + c]
617#define LRT_CLAMP(a, Min, Max) a = a < Min ? Min : (a > Max ? Max : a)
619#define LRT_MAX3_INDEX(a, b, c) (a > b ? (a > c ? 0 : (b > c ? 1 : 2)) : (b > c ? 1 : 2))
621#define LRT_MIN3_INDEX(a, b, c) (a < b ? (a < c ? 0 : (b < c ? 1 : 2)) : (b < c ? 1 : 2))
623#define LRT_MAX3_INDEX_ABC(x, y, z) (x > y ? (x > z ? a : (y > z ? b : c)) : (y > z ? b : c))
625#define LRT_MIN3_INDEX_ABC(x, y, z) (x < y ? (x < z ? a : (y < z ? b : c)) : (y < z ? b : c))
627#define DBL_LOOSER 1e-5
628#define LRT_DOUBLE_CLOSE_LOOSER(a, b) (((a) + DBL_LOOSER) >= (b) && ((a) - DBL_LOOSER) <= (b))
629#define LRT_DOUBLE_CLOSE_ENOUGH(a, b) (((a) + DBL_EDGE_LIM) >= (b) && ((a) - DBL_EDGE_LIM) <= (b))
630#define LRT_DOUBLE_CLOSE_ENOUGH_TRI(a, b) \
631 (((a) + DBL_TRIANGLE_LIM) >= (b) && ((a) - DBL_TRIANGLE_LIM) <= (b))
633#define LRT_CLOSE_LOOSER_v3(a, b) \
634 (LRT_DOUBLE_CLOSE_LOOSER(a[0], b[0]) && LRT_DOUBLE_CLOSE_LOOSER(a[1], b[1]) && \
635 LRT_DOUBLE_CLOSE_LOOSER(a[2], b[2]))
658#ifdef USE_VECTOR_LINE_INTERSECTION
662 double s10[2], s32[2];
673 const double rx = ((s32[0] * u) - (s10[0] *
v)) / div;
674 const double ry = ((s32[1] * u) - (s10[1] *
v)) / div;
677 if (
fabs(a2[0] - a1[0]) >
fabs(a2[1] - a1[1])) {
678 *r_ratio =
ratiod(a1[0], a2[0], rx);
679 if (
fabs(b2[0] - b1[0]) >
fabs(b2[1] - b1[1])) {
680 rr =
ratiod(b1[0], b2[0], rx);
683 rr =
ratiod(b1[1], b2[1], ry);
685 if ((*r_ratio) > 0 && (*r_ratio) < 1 && rr > 0 && rr < 1) {
691 *r_ratio =
ratiod(a1[1], a2[1], ry);
692 if (
fabs(b2[0] - b1[0]) >
fabs(b2[1] - b1[1])) {
693 rr =
ratiod(b1[0], b2[0], rx);
696 rr =
ratiod(b1[1], b2[1], ry);
698 if ((*r_ratio) > 0 && (*r_ratio) < 1 && rr > 0 && rr < 1) {
710 double x_diff = (a2[0] - a1[0]);
711 double x_diff2 = (b2[0] - b1[0]);
732 double r2 =
ratiod(b1[0], b2[0], a1[0]);
735 *r_ratio = ratio =
ratiod(a1[1], a2[1],
y);
739 ratio =
ratiod(a1[0], a2[0], b1[0]);
744 double y_diff = a2[1] - a1[1], y_diff2 = b2[1] - b1[1];
745 k1 = y_diff / x_diff;
746 k2 = y_diff2 / x_diff2;
767 x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
769 ratio = (
x - a1[0]) / x_diff;
777 if (
y > std::max(b1[1], b2[1]) ||
y < std::min(b1[1], b2[1])) {
781 else if (ratio <= 0 || ratio > 1 || (b1[0] > b2[0] &&
x > b1[0]) ||
782 (b1[0] < b2[0] &&
x < b1[0]) || (b2[0] > b1[0] &&
x > b2[0]) ||
783 (b2[0] < b1[0] &&
x < b2[0]))
811#define USE_VECTOR_LINE_INTERSECTION_IGN
812#ifdef USE_VECTOR_LINE_INTERSECTION_IGN
816 double s10[2], s32[2];
827 const double rx = ((s32[0] * u) - (s10[0] *
v)) / div;
828 const double ry = ((s32[1] * u) - (s10[1] *
v)) / div;
830 if (
fabs(a2[0] - a1[0]) >
fabs(a2[1] - a1[1])) {
831 *r_a_ratio =
ratiod(a1[0], a2[0], rx);
838 *r_a_ratio =
ratiod(a1[1], a2[1], ry);
851 double x_diff = (a2[0] - a1[0]);
852 double x_diff2 = (b2[0] - b1[0]);
859 double r2 =
ratiod(b1[0], b2[0], a1[0]);
862 *r_a_ratio = ratio =
ratiod(a1[1], a2[1],
y);
866 ratio =
ratiod(a1[0], a2[0], b1[0]);
871 k1 = (a2[1] - a1[1]) / x_diff;
872 k2 = (b2[1] - b1[1]) / x_diff2;
877 x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
879 ratio = (
x - a1[0]) / x_diff;
885 if (ratio <= 0 || ratio >= 1) {
894struct LineartGpencilModifierData;
895struct GreasePencilLineartModifierData;
930 GreasePencilLineartModifierData &lmd,
931 LineartCache **cached_result,
932 bool enable_stroke_depth_offset);
944namespace bke::greasepencil {
949 Depsgraph *depsgraph,
959 uchar material_mask_bits,
960 uchar intersection_mask,
963 const bool fill_strokes,
964 uchar shadow_selection,
965 uchar silhouette_mode,
966 const char *source_vgname,
969 int modifier_calculation_flags);
#define LRT_DOUBLE_CLOSE_ENOUGH(a, b)
#define LRT_DOUBLE_CLOSE_ENOUGH_TRI(a, b)
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
ENUM_OPERATORS(Layer::Flags)
void MOD_lineart_smooth_chains(LineartData *ld, float tolerance)
unsigned __int64 uint64_t
LineartBoundingArea * MOD_lineart_get_parent_bounding_area(LineartData *ld, double x, double y)
MINLINE void sub_v2_v2v2_db(double r[2], const double a[2], const double b[2])
@ LRT_ELEMENT_BORDER_ONLY
@ LRT_ELEMENT_IS_ADDITIONAL
@ LRT_ELEMENT_INTERSECTION_DATA
@ LRT_ELEMENT_NO_INTERSECTION
pthread_spinlock_t SpinLock
@ LRT_TRIANGLE_MAT_BACK_FACE_CULLING
@ LRT_TRIANGLE_FORCE_INTERSECTION
@ LRT_TRIANGLE_INTERSECTION_ONLY
@ LRT_TRIANGLE_NO_INTERSECTION
BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2], const double a2[2], const double b1[2], const double b2[2], double *r_a_ratio)
eLineArtTileRecursiveLimit
@ LRT_TILE_RECURSIVE_PERSPECTIVE
@ LRT_TILE_RECURSIVE_ORTHO
MINLINE double interpd(double target, double origin, double t)
void MOD_lineart_clear_cache(LineartCache **lc)
void MOD_lineart_chain_feature_lines(LineartData *ld)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void MOD_lineart_chain_offset_towards_camera(LineartData *ld, float dist, bool use_custom_camera)
MatBase< float, 4, 4 > float4x4
void MOD_lineart_finalize_chains(LineartData *ld)
void MOD_lineart_chain_clip_at_border(LineartData *ld)
MINLINE double ratiod(double min, double max, double pos)
bool MOD_lineart_compute_feature_lines_v3(Depsgraph *depsgraph, GreasePencilLineartModifierData &lmd, LineartCache **cached_result, bool enable_stroke_depth_offset)
int MOD_lineart_chain_count(const LineartEdgeChain *ec)
void MOD_lineart_chain_clear_picked_flag(LineartCache *lc)
void MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld)
void MOD_lineart_gpencil_generate_v3(const LineartCache *cache, const float4x4 &inverse_mat, Depsgraph *depsgraph, bke::greasepencil::Drawing &drawing, const int8_t source_type, Object *source_object, Collection *source_collection, const int level_start, const int level_end, const int mat_nr, const int16_t edge_types, const uchar mask_switches, const uchar material_mask_bits, const uchar intersection_mask, const float thickness, const float opacity, const bool fill_strokes, const uchar shadow_selection, const uchar silhouette_mode, const char *source_vgname, const char *vgname, const int modifier_flags, const int modifier_calculation_flags)
void MOD_lineart_chain_split_angle(LineartData *ld, float angle_threshold_rad)
void MOD_lineart_chain_connect(LineartData *ld)
void MOD_lineart_destroy_render_data_v3(GreasePencilLineartModifierData *lmd)
@ LRT_SHADOW_CAMERA_DIRECTIONAL
@ LRT_SHADOW_CAMERA_POINT
MINLINE double cross_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT
LineartBoundingArea * MOD_lineart_get_bounding_area(LineartData *ld, double x, double y)
eLineartShadowSegmentFlag
@ LRT_SHADOW_FACING_LIGHT
float MOD_lineart_chain_compute_length(LineartEdgeChain *ec)
BLI_INLINE int lineart_intersect_seg_seg(const double a1[2], const double a2[2], const double b1[2], const double b2[2], double *r_ratio, bool *r_aligned)
void MOD_lineart_chain_find_silhouette_backdrop_objects(LineartData *ld)
void MOD_lineart_chain_discard_unused(LineartData *ld, const float threshold, uint8_t max_occlusion)
LineartCache * MOD_lineart_init_cache()
uint32_t max_triangle_count
LineartBoundingArea * child
LineartTriangle ** linked_triangles
ListBaseT< LineartChainRegisterEntry > linked_chains
uint32_t insider_triangle_count
LineartEdge ** linked_lines
LineartStaticMemPool chain_data_pool
ListBaseT< LineartElementLinkNode > shadow_elns
ListBaseT< LineartEdgeChain > chains
uint16_t all_enabled_edge_types
LineartStaticMemPool shadow_data_pool
ed::greasepencil::LineartLimitInfo LimitInfo
LineartEdgeChainItem * eci
LineartChainRegisterEntry * prev
LineartChainRegisterEntry * next
double view_projection[4][4]
bool chain_preserve_details
bool use_loose_edge_chain
bool shadow_use_silhouette
int draw_material_preview
double active_camera_pos[3]
bool use_image_boundary_trimming
float cam_obmat_secondary[4][4]
float chain_smooth_tolerance
double camera_pos_secondary[3]
bool use_geometry_space_chain
double material_transparency
bool cam_is_persp_secondary
bool filter_face_mark_boundaries
bool filter_face_mark_invert
double view_vector_secondary[3]
bool use_back_face_culling
bool use_contour_secondary
float angle_splitting_threshold
float chaining_image_threshold
bool allow_duplicated_types
bool light_reference_available
bool shadow_enclose_shapes
bool filter_face_mark_keep_contour
bool use_loose_as_contour
bool allow_overlapping_edges
ListBaseT< LineartElementLinkNode > vertex_buffer_pointers
ListBaseT< LineartElementLinkNode > intersecting_vertex_buffer
ListBaseT< LineartElementLinkNode > triangle_adjacent_pointers
ListBaseT< LineartElementLinkNode > line_buffer_pointers
ListBaseT< LineartElementLinkNode > triangle_buffer_pointers
uint32_t initial_tile_count
LineartBoundingArea * initials
LineartStaticMemPool * chain_data_pool
LineartShadowEdge * shadow_edges
struct blender::LineartData::_geom geom
LineartStaticMemPool * edge_data_pool
struct blender::LineartData::_qtree qtree
struct blender::LineartData::_conf conf
ListBaseT< LineartEdgeChain > chains
int isect_scheduled_up_to_index
struct LineartPendingEdges pending_edges
LineartStaticMemPool render_data_pool
ListBaseT< LineartEdgeSegment > wasted_cuts
LineartElementLinkNode * isect_scheduled_up_to
LineartStaticMemPool * shadow_data_pool
ListBaseT< LineartShadowSegment > wasted_shadow_cuts
LineartEdgeChainItem * prev
uint8_t intersection_mask
uint8_t material_mask_bits
uint32_t shadow_mask_bits
LineartEdgeChainItem * next
ListBaseT< LineartEdgeChainItem > chain
uint8_t intersection_mask
uint32_t shadow_mask_bits
Object * silhouette_backdrop
uint8_t material_mask_bits
LineartEdgeSegment * next
uint32_t shadow_mask_bits
uint8_t material_mask_bits
LineartEdgeSegment * prev
ListBaseT< LineartEdgeSegment > segments
uint64_t target_reference
uint8_t intersection_mask
eLineArtElementNodeFlag flags
LineartElementLinkNode * next
LineartElementLinkNode * prev
Set< const Object * > object_dependencies
uint8_t intersection_priority
LineartPendingEdges pending_edges
Object * original_ob_eval
LineartElementLinkNode * v_eln
double model_view_proj[4][4]
uint8_t override_intersection_mask
ListBaseT< LineartElementLinkNode > * shadow_elns
LineartObjectInfo * pending
struct LineartPendingEdges pending_edges
ListBaseT< LineartShadowSegment > shadow_segments
LineartEdge * e_ref_light_contour
LineartEdgeSegment * es_ref
LineartShadowSegment * prev
uint32_t shadow_mask_bits
LineartShadowSegment * next
uint32_t target_reference
ListBaseT< LineartStaticMemPoolNode > pools
LineartEdge * testing_e[1]
uint32_t target_reference
LinkNode * intersecting_verts
uint8_t material_mask_bits
uint8_t intersection_mask
uint8_t intersection_priority