Blender  V2.93
Macros | Functions
lineart_chain.c File Reference
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "MOD_lineart.h"
#include "lineart_intern.h"
#include <math.h>

Go to the source code of this file.

Macros

#define LRT_OTHER_RV(e, rv)   ((rv) == (e)->v1 ? (e)->v2 : ((rv) == (e)->v2 ? (e)->v1 : NULL))
 
#define VERT_COORD_TO_FLOAT(a)
 
#define POS_TO_FLOAT(lpos, gpos)
 
#define IN_BOUND(ba, rlci)    ba.l <= rlci->pos[0] && ba.r >= rlci->pos[0] && ba.b <= rlci->pos[1] && ba.u >= rlci->pos[1]
 
#define IN_BOUND(ba, rlci)    ba.l <= rlci->pos[0] && ba.r >= rlci->pos[0] && ba.b <= rlci->pos[1] && ba.u >= rlci->pos[1]
 
#define LRT_TEST_ADJACENT_AREAS(dist_to, list)
 

Functions

static LineartEdgelineart_line_get_connected (LineartBoundingArea *ba, LineartVert *rv, LineartVert **new_rv, int match_flag)
 
static LineartLineChainlineart_chain_create (LineartRenderBuffer *rb)
 
static bool lineart_point_overlapping (LineartLineChainItem *rlci, float x, float y, double threshold)
 
static LineartLineChainItemlineart_chain_append_point (LineartRenderBuffer *rb, LineartLineChain *rlc, float *fbcoord, float *gpos, float *normal, char type, int level, unsigned char transparency_mask, size_t index)
 
static LineartLineChainItemlineart_chain_prepend_point (LineartRenderBuffer *rb, LineartLineChain *rlc, float *fbcoord, float *gpos, float *normal, char type, int level, unsigned char transparency_mask, size_t index)
 
void MOD_lineart_chain_feature_lines (LineartRenderBuffer *rb)
 
static LineartBoundingArealineart_bounding_area_get_rlci_recursive (LineartRenderBuffer *rb, LineartBoundingArea *root, LineartLineChainItem *rlci)
 
static LineartBoundingArealineart_bounding_area_get_end_point (LineartRenderBuffer *rb, LineartLineChainItem *rlci)
 
static void lineart_bounding_area_link_point_recursive (LineartRenderBuffer *rb, LineartBoundingArea *root, LineartLineChain *rlc, LineartLineChainItem *rlci)
 
static void lineart_bounding_area_link_chain (LineartRenderBuffer *rb, LineartLineChain *rlc)
 
void MOD_lineart_chain_split_for_fixed_occlusion (LineartRenderBuffer *rb)
 
static void lineart_chain_connect (LineartRenderBuffer *UNUSED(rb), LineartLineChain *onto, LineartLineChain *sub, int reverse_1, int reverse_2)
 
static LineartChainRegisterEntrylineart_chain_get_closest_cre (LineartRenderBuffer *rb, LineartBoundingArea *ba, LineartLineChain *rlc, LineartLineChainItem *rlci, int occlusion, unsigned char transparency_mask, float dist, float *result_new_len, LineartBoundingArea *caller_ba)
 
void MOD_lineart_chain_connect (LineartRenderBuffer *rb)
 
float MOD_lineart_chain_compute_length (LineartLineChain *rlc)
 
void MOD_lineart_chain_discard_short (LineartRenderBuffer *rb, const float threshold)
 
int MOD_lineart_chain_count (const LineartLineChain *rlc)
 
void MOD_lineart_chain_clear_picked_flag (LineartRenderBuffer *rb)
 
void MOD_lineart_chain_split_angle (LineartRenderBuffer *rb, float angle_threshold_rad)
 

Macro Definition Documentation

◆ IN_BOUND [1/2]

#define IN_BOUND (   ba,
  rlci 
)     ba.l <= rlci->pos[0] && ba.r >= rlci->pos[0] && ba.b <= rlci->pos[1] && ba.u >= rlci->pos[1]

◆ IN_BOUND [2/2]

#define IN_BOUND (   ba,
  rlci 
)     ba.l <= rlci->pos[0] && ba.r >= rlci->pos[0] && ba.b <= rlci->pos[1] && ba.u >= rlci->pos[1]

◆ LRT_OTHER_RV

#define LRT_OTHER_RV (   e,
  rv 
)    ((rv) == (e)->v1 ? (e)->v2 : ((rv) == (e)->v2 ? (e)->v1 : NULL))

Definition at line 34 of file lineart_chain.c.

◆ LRT_TEST_ADJACENT_AREAS

#define LRT_TEST_ADJACENT_AREAS (   dist_to,
  list 
)
Value:
if (dist_to < dist && dist_to > 0) { \
LISTBASE_FOREACH (LinkData *, ld, list) { \
LineartBoundingArea *sba = (LineartBoundingArea *)ld->data; \
adjacent_closest = lineart_chain_get_closest_cre( \
rb, sba, rlc, rlci, occlusion, transparency_mask, dist, &adjacent_new_len, ba); \
if (adjacent_new_len < dist) { \
dist = adjacent_new_len; \
closest_cre = adjacent_closest; \
} \
} \
}
static LineartChainRegisterEntry * lineart_chain_get_closest_cre(LineartRenderBuffer *rb, LineartBoundingArea *ba, LineartLineChain *rlc, LineartLineChainItem *rlci, int occlusion, unsigned char transparency_mask, float dist, float *result_new_len, LineartBoundingArea *caller_ba)

◆ POS_TO_FLOAT

#define POS_TO_FLOAT (   lpos,
  gpos 
)
Value:
copy_v2fl_v2db(use_fbcoord, lpos); \
copy_v3fl_v3db(use_gpos, gpos);
MINLINE void copy_v2fl_v2db(float r[2], const double a[2])

◆ VERT_COORD_TO_FLOAT

#define VERT_COORD_TO_FLOAT (   a)
Value:
copy_v2fl_v2db(use_fbcoord, (a)->fbcoord); \
copy_v3fl_v3db(use_gpos, (a)->gloc);
static unsigned a[3]
Definition: RandGen.cpp:92

Function Documentation

◆ lineart_bounding_area_get_end_point()

static LineartBoundingArea* lineart_bounding_area_get_end_point ( LineartRenderBuffer rb,
LineartLineChainItem rlci 
)
static

◆ lineart_bounding_area_get_rlci_recursive()

static LineartBoundingArea* lineart_bounding_area_get_rlci_recursive ( LineartRenderBuffer rb,
LineartBoundingArea root,
LineartLineChainItem rlci 
)
static

Definition at line 461 of file lineart_chain.c.

References LineartBoundingArea::child, IN_BOUND, and NULL.

Referenced by lineart_bounding_area_get_end_point().

◆ lineart_bounding_area_link_chain()

static void lineart_bounding_area_link_chain ( LineartRenderBuffer rb,
LineartLineChain rlc 
)
static

◆ lineart_bounding_area_link_point_recursive()

static void lineart_bounding_area_link_point_recursive ( LineartRenderBuffer rb,
LineartBoundingArea root,
LineartLineChain rlc,
LineartLineChainItem rlci 
)
static

Here we will try to connect geometry space chains together in image space. However we can't chain two chains together if their end and start points lie on the border between two bounding areas, this happens either when 1) the geometry is way too dense, or 2) the chaining threshold is too big that it covers multiple small bounding areas.

Definition at line 508 of file lineart_chain.c.

References LineartLineChain::chain, LineartBoundingArea::child, ListBase::first, IN_BOUND, LineartChainRegisterEntry::is_left, lineart_list_append_pointer_pool_sized(), LineartBoundingArea::linked_chains, NULL, LineartRenderBuffer::render_data_pool, and LineartChainRegisterEntry::rlci.

Referenced by lineart_bounding_area_link_chain().

◆ lineart_chain_append_point()

static LineartLineChainItem* lineart_chain_append_point ( LineartRenderBuffer rb,
LineartLineChain rlc,
float fbcoord,
float gpos,
float normal,
char  type,
int  level,
unsigned char  transparency_mask,
size_t  index 
)
static

◆ lineart_chain_connect()

static void lineart_chain_connect ( LineartRenderBuffer UNUSEDrb,
LineartLineChain onto,
LineartLineChain sub,
int  reverse_1,
int  reverse_2 
)
static

◆ lineart_chain_create()

static LineartLineChain* lineart_chain_create ( LineartRenderBuffer rb)
static

◆ lineart_chain_get_closest_cre()

static LineartChainRegisterEntry* lineart_chain_get_closest_cre ( LineartRenderBuffer rb,
LineartBoundingArea ba,
LineartLineChain rlc,
LineartLineChainItem rlci,
int  occlusion,
unsigned char  transparency_mask,
float  dist,
float result_new_len,
LineartBoundingArea caller_ba 
)
static

◆ lineart_chain_prepend_point()

static LineartLineChainItem* lineart_chain_prepend_point ( LineartRenderBuffer rb,
LineartLineChain rlc,
float fbcoord,
float gpos,
float normal,
char  type,
int  level,
unsigned char  transparency_mask,
size_t  index 
)
static

◆ lineart_line_get_connected()

static LineartEdge* lineart_line_get_connected ( LineartBoundingArea ba,
LineartVert rv,
LineartVert **  new_rv,
int  match_flag 
)
static

◆ lineart_point_overlapping()

static bool lineart_point_overlapping ( LineartLineChainItem rlci,
float  x,
float  y,
double  threshold 
)
static

◆ MOD_lineart_chain_clear_picked_flag()

void MOD_lineart_chain_clear_picked_flag ( LineartRenderBuffer rb)

Definition at line 892 of file lineart_chain.c.

References LineartRenderBuffer::chains, LISTBASE_FOREACH, and NULL.

Referenced by MOD_lineart_compute_feature_lines().

◆ MOD_lineart_chain_compute_length()

float MOD_lineart_chain_compute_length ( LineartLineChain rlc)

◆ MOD_lineart_chain_connect()

void MOD_lineart_chain_connect ( LineartRenderBuffer rb)

◆ MOD_lineart_chain_count()

int MOD_lineart_chain_count ( const LineartLineChain rlc)

Definition at line 883 of file lineart_chain.c.

References LineartLineChain::chain, count, and LISTBASE_FOREACH.

Referenced by lineart_gpencil_generate().

◆ MOD_lineart_chain_discard_short()

void MOD_lineart_chain_discard_short ( LineartRenderBuffer rb,
const float  threshold 
)

◆ MOD_lineart_chain_feature_lines()

void MOD_lineart_chain_feature_lines ( LineartRenderBuffer rb)

◆ MOD_lineart_chain_split_angle()

void MOD_lineart_chain_split_angle ( LineartRenderBuffer rb,
float  angle_threshold_rad 
)

◆ MOD_lineart_chain_split_for_fixed_occlusion()

void MOD_lineart_chain_split_for_fixed_occlusion ( LineartRenderBuffer rb)