311 #define DBL_TRIANGLE_LIM 1e-8
312 #define DBL_EDGE_LIM 1e-9
314 #define LRT_MEMORY_POOL_64MB (1 << 26)
328 #define LRT_THREAD_EDGE_COUNT 1000
397 #define LRT_TILE(tile, r, c, CCount) tile[r * CCount + c]
399 #define LRT_CLAMP(a, Min, Max) a = a < Min ? Min : (a > Max ? Max : a)
401 #define LRT_MAX3_INDEX(a, b, c) (a > b ? (a > c ? 0 : (b > c ? 1 : 2)) : (b > c ? 1 : 2))
403 #define LRT_MIN3_INDEX(a, b, c) (a < b ? (a < c ? 0 : (b < c ? 1 : 2)) : (b < c ? 1 : 2))
405 #define LRT_MAX3_INDEX_ABC(x, y, z) (x > y ? (x > z ? a : (y > z ? b : c)) : (y > z ? b : c))
407 #define LRT_MIN3_INDEX_ABC(x, y, z) (x < y ? (x < z ? a : (y < z ? b : c)) : (y < z ? b : c))
409 #define LRT_ABC(index) (index == 0 ? a : (index == 1 ? b : c))
411 #define LRT_DOUBLE_CLOSE_ENOUGH(a, b) (((a) + DBL_EDGE_LIM) >= (b) && ((a)-DBL_EDGE_LIM) <= (b))
414 const double *a1,
const double *a2,
const double *b1,
const double *b2,
double *aRatio)
418 #ifdef USE_VECTOR_LINE_INTERSECTION
422 double s10[2], s32[2];
433 const double rx = ((s32[0] *
u) - (s10[0] *
v)) / div;
434 const double ry = ((s32[1] *
u) - (s10[1] *
v)) / div;
437 if (
fabs(a2[0] - a1[0]) >
fabs(a2[1] - a1[1])) {
438 *aRatio =
ratiod(a1[0], a2[0], rx);
439 if (
fabs(b2[0] - b1[0]) >
fabs(b2[1] - b1[1])) {
440 rr =
ratiod(b1[0], b2[0], rx);
443 rr =
ratiod(b1[1], b2[1], ry);
445 if ((*aRatio) > 0 && (*aRatio) < 1 && rr > 0 && rr < 1) {
451 *aRatio =
ratiod(a1[1], a2[1], ry);
452 if (
fabs(b2[0] - b1[0]) >
fabs(b2[1] - b1[1])) {
453 rr =
ratiod(b1[0], b2[0], rx);
456 rr =
ratiod(b1[1], b2[1], ry);
458 if ((*aRatio) > 0 && (*aRatio) < 1 && rr > 0 && rr < 1) {
470 double x_diff = (a2[0] - a1[0]);
471 double x_diff2 = (b2[0] - b1[0]);
478 double r2 =
ratiod(b1[0], b2[0], a1[0]);
481 *aRatio = ratio =
ratiod(a1[1], a2[1],
y);
485 ratio =
ratiod(a1[0], a2[0], b1[0]);
490 k1 = (a2[1] - a1[1]) / x_diff;
491 k2 = (b2[1] - b1[1]) / x_diff2;
496 x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
498 ratio = (
x - a1[0]) / x_diff;
506 if (
y >
MAX2(b1[1], b2[1]) ||
y <
MIN2(b1[1], b2[1]))
509 else if (ratio <= 0 || ratio > 1 || (b1[0] > b2[0] &&
x > b1[0]) ||
510 (b1[0] < b2[0] &&
x < b1[0]) || (b2[0] > b1[0] &&
x > b2[0]) ||
511 (b2[0] < b1[0] &&
x < b2[0]))
554 void *source_reference,
559 unsigned char transparency_flags,
560 unsigned char transparency_mask,
563 const char *source_vgname,
MINLINE double interpd(double a, double b, double t)
MINLINE double ratiod(double min, double max, double pos)
MINLINE double cross_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v2_v2v2_db(double r[2], const double a[2], const double b[2])
pthread_spinlock_t SpinLock
struct Depsgraph Depsgraph
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
struct LineartStaticMemPool LineartStaticMemPool
struct LineartBoundingArea LineartBoundingArea
#define LRT_DOUBLE_CLOSE_ENOUGH(a, b)
struct LineartEdge LineartEdge
struct LineartRenderTaskInfo LineartRenderTaskInfo
void MOD_lineart_chain_discard_short(LineartRenderBuffer *rb, const float threshold)
struct LineartChainRegisterEntry LineartChainRegisterEntry
struct LineartLineChainItem LineartLineChainItem
struct LineartLineChain LineartLineChain
struct LineartRenderBuffer LineartRenderBuffer
void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb, struct Depsgraph *depsgraph, struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf, char source_type, void *source_reference, int level_start, int level_end, int mat_nr, short edge_types, unsigned char transparency_flags, unsigned char transparency_mask, short thickness, float opacity, const char *source_vgname, const char *vgname, int modifier_flags)
struct LineartVertIntersection LineartVertIntersection
struct LineartTriangleAdjacent LineartTriangleAdjacent
void MOD_lineart_destroy_render_data(struct LineartGpencilModifierData *lmd)
void MOD_lineart_chain_clear_picked_flag(struct LineartRenderBuffer *rb)
void ED_operatortypes_lineart(void)
void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
struct LineartStaticMemPoolNode LineartStaticMemPoolNode
@ LRT_VERT_HAS_INTERSECTION_DATA
int MOD_lineart_chain_count(const LineartLineChain *rlc)
BLI_INLINE int lineart_LineIntersectTest2d(const double *a1, const double *a2, const double *b1, const double *b2, double *aRatio)
void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
LineartBoundingArea * MOD_lineart_get_parent_bounding_area(LineartRenderBuffer *rb, double x, double y)
struct LineartTriangleThread LineartTriangleThread
bool MOD_lineart_compute_feature_lines(struct Depsgraph *depsgraph, struct LineartGpencilModifierData *lmd)
@ LRT_TRIANGLE_NO_INTERSECTION
@ LRT_TRIANGLE_INTERSECTION_ONLY
void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
LineartBoundingArea * MOD_lineart_get_bounding_area(LineartRenderBuffer *rb, double x, double y)
@ LRT_ELEMENT_NO_INTERSECTION
@ LRT_ELEMENT_BORDER_ONLY
@ LRT_ELEMENT_IS_ADDITIONAL
struct LineartElementLinkNode LineartElementLinkNode
struct LineartLineSegment LineartLineSegment
float MOD_lineart_chain_compute_length(LineartLineChain *rlc)
void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshold_rad)
struct LineartTriangle LineartTriangle
struct LineartVert LineartVert
ATTR_WARN_UNUSED_RESULT const BMVert * v
const Depsgraph * depsgraph
struct LineartBoundingArea * child
ListBase linked_triangles
struct LineartChainRegisterEntry * next
struct LineartChainRegisterEntry * prev
LineartLineChainItem * rlci
struct LineartEdge * next
struct LineartTriangle * t2
struct LineartTriangle * t1
struct Object * object_ref
eLineArtElementNodeFlag flags
struct LineartElementLinkNode * prev
struct LineartElementLinkNode * next
struct LineartLineChainItem * next
struct LineartLineChainItem * prev
unsigned char transparency_mask
struct LineartLineChain * next
struct LineartLineChain * prev
unsigned char transparency_mask
struct Object * object_ref
struct LineartLineSegment * prev
struct LineartLineSegment * next
unsigned char transparency_mask
ListBase line_buffer_pointers
struct LineartRenderBuffer * next
LineartEdge * edge_mark_managed
struct LineartBoundingArea * initial_bounding_areas
unsigned int edge_mark_count
unsigned int bounding_area_count
unsigned int intersection_count
unsigned int material_line_count
ListBase triangle_buffer_pointers
LineartEdge * material_lines
int draw_material_preview
LineartEdge * intersection_managed
LineartStaticMemPool render_data_pool
ListBase intersecting_vertex_buffer
struct LineartRenderBuffer * prev
double view_projection[4][4]
unsigned int intersection_processed
unsigned int crease_count
LineartEdge * material_managed
unsigned int contour_count
struct Collection * _source_collection
ListBase triangle_adjacent_pointers
unsigned int edge_mark_processed
LineartEdge * intersection_lines
float chaining_image_threshold
unsigned int material_processed
double material_transparency
LineartEdge * crease_lines
bool allow_overlapping_edges
float angle_splitting_threshold
unsigned int crease_processed
struct Object * _source_object
ListBase vertex_buffer_pointers
LineartEdge * crease_managed
unsigned int contour_processed
LineartEdge * contour_managed
LineartEdge * edge_mark_end
LineartEdge * intersection_end
LineartEdge * intersection
LineartEdge * material_end
LineartEdge * contour_end
struct LineartRenderBuffer * rb
struct LineartEdge * e[3]
struct LineartEdge * testing_e[1]
struct LineartTriangle base
struct LinkNode * intersecting_verts
unsigned char transparency_mask
struct LineartVert * v[3]
struct LineartTriangle * intersecting_with
ccl_device_inline float2 fabs(const float2 &a)