|
Blender
V2.93
|
#include "MOD_lineart.h"#include "BLI_linklist.h"#include "BLI_listbase.h"#include "BLI_math.h"#include "BLI_task.h"#include "BLI_utildefines.h"#include "PIL_time.h"#include "BKE_camera.h"#include "BKE_collection.h"#include "BKE_customdata.h"#include "BKE_deform.h"#include "BKE_editmesh.h"#include "BKE_global.h"#include "BKE_gpencil.h"#include "BKE_gpencil_geom.h"#include "BKE_gpencil_modifier.h"#include "BKE_material.h"#include "BKE_mesh.h"#include "BKE_scene.h"#include "DEG_depsgraph_query.h"#include "DNA_camera_types.h"#include "DNA_collection_types.h"#include "DNA_gpencil_types.h"#include "DNA_material_types.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_modifier_types.h"#include "DNA_scene_types.h"#include "MEM_guardedalloc.h"#include "bmesh.h"#include "bmesh_class.h"#include "bmesh_tools.h"#include "lineart_intern.h"Go to the source code of this file.
Macros | |
| #define | LRT_ASSIGN_OCCLUSION_TASK(name) |
| #define | INCREASE_RL |
| #define | SELECT_RL(e_num, v1_link, v2_link, newrt) |
| #define | RELINK_RL(e_num, newrt) |
| #define | REMOVE_TRIANGLE_RL |
| #define | LRT_CULL_ENSURE_MEMORY |
| #define | LRT_CULL_DECIDE_INSIDE |
| #define | LRT_MESH_FINISH |
| #define | LRT_TRI_SAME_POINT(rt, i, pt) |
| #define | INTERSECT_SORT_MIN_TO_MAX_3(ia, ib, ic, lst) |
| #define | INTERSECT_JUST_GREATER(is, order, num, index) |
| #define | INTERSECT_JUST_SMALLER(is, order, num, index) |
| #define INCREASE_RL |
| #define INTERSECT_JUST_GREATER | ( | is, | |
| order, | |||
| num, | |||
| index | |||
| ) |
Definition at line 1939 of file lineart_cpu.c.
| #define INTERSECT_JUST_SMALLER | ( | is, | |
| order, | |||
| num, | |||
| index | |||
| ) |
| #define INTERSECT_SORT_MIN_TO_MAX_3 | ( | ia, | |
| ib, | |||
| ic, | |||
| lst | |||
| ) |
Definition at line 1929 of file lineart_cpu.c.
| #define LRT_ASSIGN_OCCLUSION_TASK | ( | name | ) |
| #define LRT_CULL_DECIDE_INSIDE |
| #define LRT_CULL_ENSURE_MEMORY |
| #define LRT_MESH_FINISH |
| #define LRT_TRI_SAME_POINT | ( | rt, | |
| i, | |||
| pt | |||
| ) |
| #define RELINK_RL | ( | e_num, | |
| newrt | |||
| ) |
| #define REMOVE_TRIANGLE_RL |
| #define SELECT_RL | ( | e_num, | |
| v1_link, | |||
| v2_link, | |||
| newrt | |||
| ) |
|
static |
Definition at line 1728 of file lineart_cpu.c.
References BKE_collection_has_object_recursive_instanced(), Freestyle::c, Collection::children, CollectionChild::collection, ListBase::first, Collection::id, Object::id, if(), CollectionChild::next, and ID::orig_id.
Referenced by lineart_usage_check().
|
static |
Definition at line 1432 of file lineart_cpu.c.
References LineartRenderBuffer::contours, LineartRenderBuffer::crease_lines, e, LineartRenderBuffer::edge_marks, LineartRenderBuffer::intersection_lines, lineart_prepend_edge_direct(), LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_CREASE, LRT_EDGE_FLAG_EDGE_MARK, LRT_EDGE_FLAG_INTERSECTION, LRT_EDGE_FLAG_MATERIAL, and LineartRenderBuffer::material_lines.
Referenced by lineart_geometry_object_load().
|
static |
Definition at line 2989 of file lineart_cpu.c.
References LineartBoundingArea::b, Freestyle::c, l, LineartBoundingArea::l, MAX2, MIN2, LineartBoundingArea::r, r, and LineartBoundingArea::u.
Referenced by lineart_bounding_area_link_line(), and lineart_bounding_area_triangle_intersect().
|
static |
Definition at line 3125 of file lineart_cpu.c.
References LineartBoundingArea::child, e, lineart_bounding_area_line_intersect(), lineart_list_append_pointer_pool(), LineartBoundingArea::linked_lines, NULL, and LineartRenderBuffer::render_data_pool.
Referenced by lineart_bounding_area_split(), lineart_main_link_lines(), and lineart_triangle_intersect().
|
static |
1) Link triangles with bounding areas for later occlusion test. 2) Test triangles with existing(added previously) triangles for intersection lines.
Definition at line 3070 of file lineart_cpu.c.
References Freestyle::B1(), LineartBoundingArea::child, LineartVert::fbcoord, l, lineart_bounding_area_split(), lineart_bounding_area_triangle_intersect(), lineart_list_append_pointer_pool(), lineart_triangle_intersect_in_bounding_area(), LineartBoundingArea::linked_triangles, LRT_BOUND_AREA_CROSSES, MAX3, MIN3, NULL, LineartRenderBuffer::render_data_pool, LineartBoundingArea::triangle_count, LineartRenderBuffer::use_intersections, and LineartTriangle::v.
Referenced by lineart_bounding_area_split(), and lineart_main_add_triangles().
|
static |
This march along one render line in image space and get the next bounding area the line is crossing.
Definition at line 3427 of file lineart_cpu.c.
References LineartBoundingArea::b, e, l, LineartBoundingArea::l, LISTBASE_FOREACH, MIN2, LineartBoundingArea::r, r, ratiod(), LineartBoundingArea::u, x, and y.
Referenced by lineart_occlusion_single_line().
|
static |
Subdivide a tile after one tile contains too many triangles.
Definition at line 2920 of file lineart_cpu.c.
References LineartBoundingArea::b, LineartRenderBuffer::bounding_area_count, LineartBoundingArea::child, LineartBoundingArea::cx, LineartBoundingArea::cy, e, LineartVert::fbcoord, l, LineartBoundingArea::l, lineart_bounding_area_link_line(), lineart_bounding_area_link_triangle(), lineart_bounding_areas_connect_new(), lineart_list_pop_pointer_no_free(), lineart_mem_aquire(), LineartBoundingArea::linked_lines, LineartBoundingArea::linked_triangles, LRT_BOUND_AREA_CROSSES, MAX3, MIN3, NULL, LineartBoundingArea::r, LineartRenderBuffer::render_data_pool, LineartBoundingArea::u, and LineartTriangle::v.
Referenced by lineart_bounding_area_link_triangle().
|
static |
Definition at line 3032 of file lineart_cpu.c.
References LineartBoundingArea::b, double(), fb(), LineartVert::fbcoord, LineartBoundingArea::l, lineart_bounding_area_line_intersect(), lineart_point_inside_triangle(), LineartBoundingArea::r, LineartBoundingArea::u, and LineartTriangle::v.
Referenced by lineart_bounding_area_link_triangle().
|
static |
Re-link adjacent tiles after one gets subdivided.
Definition at line 2777 of file lineart_cpu.c.
References LineartBoundingArea::b, BLI_listbase_clear(), LineartBoundingArea::bp, LineartBoundingArea::child, LinkData::data, LineartBoundingArea::l, lineart_list_append_pointer_pool(), lineart_list_remove_pointer_item_no_free(), LISTBASE_FOREACH, LineartBoundingArea::lp, LinkData::next, r, LineartRenderBuffer::render_data_pool, LineartBoundingArea::rp, and LineartBoundingArea::up.
Referenced by lineart_bounding_area_split().
|
static |
Definition at line 2645 of file lineart_cpu.c.
References LineartRenderBuffer::allow_boundaries, LineartRenderBuffer::allow_overlapping_edges, LineartRenderBuffer::angle_splitting_threshold, LineartGpencilModifierData::angle_splitting_threshold, BKE_camera_sensor_fit(), BLI_spin_init(), Freestyle::c, LineartGpencilModifierData::calculation_flags, LineartRenderBuffer::cam_is_persp, LineartRenderBuffer::cam_obmat, CAM_PERSP, Scene::camera, LineartRenderBuffer::camera_pos, CAMERA_SENSOR_FIT_HOR, CAMERA_SENSOR_FIT_VERT, LineartRenderBuffer::chaining_image_threshold, LineartGpencilModifierData::chaining_image_threshold, copy_m4_m4(), copy_v3db_v3fl(), KDL::cos(), LineartRenderBuffer::crease_threshold, LineartGpencilModifierData::crease_threshold, Object::data, double(), LineartGpencilModifierData::edge_types, LineartRenderBuffer::far_clip, LineartRenderBuffer::fuzzy_everything, LineartRenderBuffer::fuzzy_intersections, LineartRenderBuffer::h, LineartRenderBuffer::lock_cuts, LineartStaticMemPool::lock_mem, LineartRenderBuffer::lock_task, LRT_ALLOW_CLIPPING_BOUNDARIES, LRT_ALLOW_OVERLAPPING_EDGES, LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_CREASE, LRT_EDGE_FLAG_EDGE_MARK, LRT_EDGE_FLAG_INTERSECTION, LRT_EDGE_FLAG_MATERIAL, LRT_EVERYTHING_AS_CONTOUR, LRT_INTERSECTION_AS_CONTOUR, LRT_REMOVE_DOUBLES, M_PI, MEM_callocN, LineartRenderBuffer::near_clip, NULL, Object::obmat, Scene::r, LineartRenderBuffer::remove_doubles, LineartGpencilModifierData::render_buffer, LineartRenderBuffer::render_data_pool, scene, LineartRenderBuffer::shift_x, LineartRenderBuffer::shift_y, LineartRenderBuffer::use_contour, LineartRenderBuffer::use_crease, LineartRenderBuffer::use_edge_marks, LineartRenderBuffer::use_intersections, LineartRenderBuffer::use_material, LineartRenderBuffer::w, RenderData::xsch, and RenderData::ysch.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Definition at line 2592 of file lineart_cpu.c.
References BLI_listbase_clear(), BLI_spin_end(), LineartRenderBuffer::chains, LineartRenderBuffer::contour_count, LineartRenderBuffer::contour_managed, LineartRenderBuffer::contours, LineartRenderBuffer::crease_count, LineartRenderBuffer::crease_lines, LineartRenderBuffer::crease_managed, LineartRenderBuffer::edge_mark_count, LineartRenderBuffer::edge_mark_managed, LineartRenderBuffer::edge_marks, LineartRenderBuffer::intersection_count, LineartRenderBuffer::intersection_lines, LineartRenderBuffer::intersection_managed, LineartRenderBuffer::line_buffer_pointers, lineart_mem_destroy(), LineartRenderBuffer::lock_cuts, LineartStaticMemPool::lock_mem, LineartRenderBuffer::lock_task, LineartRenderBuffer::material_line_count, LineartRenderBuffer::material_lines, LineartRenderBuffer::material_managed, NULL, LineartRenderBuffer::render_data_pool, LineartRenderBuffer::triangle_buffer_pointers, LineartRenderBuffer::vertex_buffer_pointers, and LineartRenderBuffer::wasted_cuts.
Referenced by MOD_lineart_destroy_render_data().
|
static |
Definition at line 112 of file lineart_cpu.c.
References BLI_addtail(), BLI_spin_lock(), BLI_spin_unlock(), LineartRenderBuffer::lock_cuts, and LineartRenderBuffer::wasted_cuts.
Referenced by lineart_edge_cut().
|
static |
Cuts the edge in image space and mark occlusion level for each segment.
Definition at line 146 of file lineart_cpu.c.
References LineartLineSegment::at, BLI_addtail(), BLI_insertlinkbefore(), BLI_remlink(), e, lineart_discard_segment(), lineart_give_segment(), LRT_DOUBLE_CLOSE_ENOUGH, MIN2, LineartLineSegment::next, NULL, LineartLineSegment::occlusion, LineartLineSegment::prev, t, LineartLineSegment::transparency_mask, and UNLIKELY.
Referenced by lineart_occlusion_single_line().
|
static |
This function gets the tile for the point e->v1, and later use lineart_bounding_area_next() to get next along the way.
Definition at line 3391 of file lineart_cpu.c.
References data, e, interp_v2_v2v2_db(), LB, lineart_get_bounding_area(), lineart_LineIntersectTest2d(), r, and RB.
Referenced by lineart_occlusion_single_line().
|
static |
Definition at line 1898 of file lineart_cpu.c.
References e, and LRT_TRI_SAME_POINT.
Referenced by lineart_triangle_edge_image_space_occlusion().
|
static |
Definition at line 697 of file lineart_cpu.c.
References e, LineartTriangle::v, v1, and v2.
Referenced by lineart_triangle_adjacent_assign().
|
static |
Definition at line 1468 of file lineart_cpu.c.
References BKE_editmesh_create(), BKE_mesh_new_from_object(), BKE_object_material_get(), BLI_addtail(), BMEditMesh::bm, bm, BM_EDGE, BM_edge_at_index(), BM_elem_index_get, BM_ELEM_TAG, BM_FACE, BM_face_at_index(), BM_mesh_bm_from_me(), BM_mesh_copy(), BM_mesh_create(), BM_mesh_elem_hflag_disable_all(), BM_mesh_elem_index_ensure(), BM_mesh_elem_table_ensure(), BM_mesh_normals_update(), BM_mesh_triangulate(), BM_VERT, BM_vert_at_index(), BMALLOC_TEMPLATE_FROM_ME, BMO_FLAG_DEFAULTS, BMO_op_exec(), BMO_op_finish(), BMO_op_init(), BMO_op_initf(), BMO_slot_copy, CD_FREESTYLE_EDGE, copy_m4d_m4(), copy_v3db_v3fl(), cosf, LineartRenderBuffer::crease_threshold, ObjectLineArt::crease_threshold, CustomData_has_layer(), Object::data, DEG_get_evaluated_object(), e, BMesh::edata, Mesh::edit_mesh, ELEM, LineartElementLinkNode::element_count, LineartTriangle::flags, LineartElementLinkNode::flags, LineartEdge::flags, MaterialLineArt::flags, ObjectLineArt::flags, LineartTriangle::gn, BMVert::head, BMHeader::hflag, Object::id, LineartVert::index, LineartTriangle::intersecting_verts, invert_m4_m4(), BMFace::l_first, LineartRenderBuffer::line_buffer_pointers, Material::lineart, Object::lineart, lineart_add_edge_to_list(), lineart_identify_feature_line(), lineart_list_append_pointer_pool(), lineart_list_append_pointer_pool_sized(), lineart_mem_aquire(), lineart_triangle_adjacent_assign(), lineart_triangle_from_index(), lineart_vert_transform(), LRT_ELEMENT_BORDER_ONLY, LRT_ELEMENT_NO_INTERSECTION, LRT_MATERIAL_TRANSPARENCY_ENABLED, LRT_MESH_FINISH, LRT_TRIANGLE_INTERSECTION_ONLY, LRT_TRIANGLE_NO_INTERSECTION, M_PI, BMFace::mat_nr, MEM_callocN, MEM_freeN, MOD_TRIANGULATE_NGON_BEAUTY, MOD_TRIANGULATE_QUAD_FIXED, mul_m4db_m4db_m4fl_uniq(), mul_v3_mat3_m4v3_db(), BMLoop::next, BMFace::no, normal, normalize_v3_db(), NULL, OB_CURVE, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, OBJECT_LRT_EXCLUDE, OBJECT_LRT_INCLUDE, OBJECT_LRT_INHERIT, OBJECT_LRT_INTERSECTION_ONLY, OBJECT_LRT_NO_INTERSECTION, OBJECT_LRT_OCCLUSION_ONLY, OBJECT_LRT_OWN_CREASE, LineartElementLinkNode::object_ref, LineartEdge::object_ref, Object::obmat, ID::orig_id, LineartRenderBuffer::remove_doubles, LineartRenderBuffer::render_data_pool, LineartEdge::segments, LineartEdge::t1, LineartEdge::t2, BMesh::totedge, BMesh::totface, BMesh::totvert, LineartTriangle::transparency_mask, MaterialLineArt::transparency_mask, transpose_m4(), LineartRenderBuffer::triangle_adjacent_pointers, LineartRenderBuffer::triangle_buffer_pointers, LineartRenderBuffer::triangle_size, Object::type, ObjectLineArt::usage, BMLoop::v, v, LineartTriangle::v, LineartEdge::v1, LineartEdge::v1_obindex, LineartEdge::v2, LineartEdge::v2_obindex, and LineartRenderBuffer::vertex_buffer_pointers.
Referenced by lineart_main_load_geometries().
|
static |
Definition at line 3298 of file lineart_cpu.c.
References Freestyle::c, LineartBoundingArea::child, LineartBoundingArea::cx, LineartBoundingArea::cy, LineartRenderBuffer::height_per_tile, LineartRenderBuffer::initial_bounding_areas, LRT_BA_ROWS, r, LineartRenderBuffer::tile_count_x, LineartRenderBuffer::tile_count_y, LineartRenderBuffer::width_per_tile, x, and y.
Referenced by lineart_edge_first_bounding_area(), and MOD_lineart_get_bounding_area().
|
static |
Definition at line 3216 of file lineart_cpu.c.
References CLAMP, e, LineartRenderBuffer::height_per_tile, MAX2, MIN2, LineartRenderBuffer::tile_count_x, LineartRenderBuffer::tile_count_y, and LineartRenderBuffer::width_per_tile.
Referenced by lineart_main_link_lines(), and lineart_triangle_intersect().
|
static |
Definition at line 3172 of file lineart_cpu.c.
References LineartVert::fbcoord, LineartRenderBuffer::height_per_tile, MAX3, MIN3, LineartRenderBuffer::tile_count_x, LineartRenderBuffer::tile_count_y, LineartTriangle::v, and LineartRenderBuffer::width_per_tile.
Referenced by lineart_main_add_triangles().
|
static |
Definition at line 125 of file lineart_cpu.c.
References BLI_pophead(), BLI_spin_lock(), BLI_spin_unlock(), ListBase::first, lineart_mem_aquire_thread(), LineartRenderBuffer::lock_cuts, LineartRenderBuffer::render_data_pool, and LineartRenderBuffer::wasted_cuts.
Referenced by lineart_edge_cut().
|
static |
Definition at line 3768 of file lineart_cpu.c.
References BKE_collection_has_object_recursive_instanced(), BKE_defvert_ensure_index(), BKE_gpencil_dvert_ensure(), BKE_gpencil_stroke_add(), BKE_gpencil_stroke_add_points(), BKE_gpencil_stroke_geometry_update(), BKE_gpencil_stroke_set_random_color(), BKE_object_defgroup_name_index(), LineartRenderBuffer::chains, count, Object::data, Object::defbase, DEG_get_evaluated_object(), depsgraph, bGPDstroke::dvert, Mesh::dvert, G, GP_PRIM_DATABUF_SIZE, Collection::id, Object::id, if(), lineart_rb_edge_types(), LISTBASE_FOREACH, LRT_GPENCIL_INVERT_SOURCE_VGROUP, LRT_GPENCIL_MATCH_OUTPUT_VGROUP, LRT_GPENCIL_TRANSPARENCY_ENABLE, LRT_GPENCIL_TRANSPARENCY_MATCH, bGPDstroke::mat_nr, MAX2, max_ii(), MEM_callocN, MEM_freeN, MOD_lineart_chain_count(), mul_m4_v3(), Node::name, NULL, OB_MESH, ID::orig_id, Mesh::totvert, Object::type, types, unit_m4(), and MDeformWeight::weight.
Referenced by MOD_lineart_gpencil_generate().
|
static |
Definition at line 1367 of file lineart_cpu.c.
References BM_elem_index_get, LineartRenderBuffer::cam_is_persp, LineartRenderBuffer::camera_pos, CD_FREESTYLE_EDGE, CustomData_bmesh_get(), BMHeader::data, dot_v3v3_db(), e, BMesh::edata, BMLoop::f, FreestyleEdge::flag, FREESTYLE_EDGE_MARK, LineartTriangle::gn, BMVert::head, l, lineart_triangle_from_index(), LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_CREASE, LRT_EDGE_FLAG_EDGE_MARK, LRT_EDGE_FLAG_MATERIAL, BMFace::mat_nr, NULL, result, sub_v3_v3v3_db(), LineartRenderBuffer::use_crease, LineartRenderBuffer::use_edge_marks, LineartRenderBuffer::use_material, and LineartRenderBuffer::view_vector.
Referenced by lineart_geometry_object_load().
|
static |
Sequentially add triangles into render buffer. This also does intersection along the way.
Definition at line 3354 of file lineart_cpu.c.
References LineartTriangle::flags, LineartRenderBuffer::initial_bounding_areas, lineart_bounding_area_link_triangle(), lineart_get_triangle_bounding_areas(), LISTBASE_FOREACH, LRT_BA_ROWS, LRT_CULL_DISCARD, LRT_CULL_USED, LRT_TRIANGLE_NO_INTERSECTION, r, LineartRenderBuffer::triangle_buffer_pointers, LineartRenderBuffer::triangle_size, x2, and y1.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Definition at line 2709 of file lineart_cpu.c.
References LineartBoundingArea::b, LineartRenderBuffer::bounding_area_count, LineartBoundingArea::bp, col, LineartBoundingArea::cx, LineartBoundingArea::cy, double(), LineartRenderBuffer::height_per_tile, LineartRenderBuffer::initial_bounding_areas, LineartBoundingArea::l, lineart_list_append_pointer_pool(), lineart_mem_aquire(), LineartBoundingArea::lp, LRT_BA_ROWS, LineartBoundingArea::r, LineartRenderBuffer::render_data_pool, LineartBoundingArea::rp, LineartRenderBuffer::tile_count_x, LineartRenderBuffer::tile_count_y, LineartBoundingArea::u, LineartBoundingArea::up, and LineartRenderBuffer::width_per_tile.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
This function cuts triangles with near- or far-plane. Setting clip_far = true for cutting with far-plane. For triangles that's crossing the plane, it will generate new 1 or 2 triangles with new topology that represents the trimmed triangle. (which then became a triangle or a square formed by two triangles)
Definition at line 1166 of file lineart_cpu.c.
References add_v3_v3_db(), LineartRenderBuffer::allow_boundaries, LineartRenderBuffer::cam_is_persp, LineartRenderBuffer::camera_pos, copy_v3_v3_db(), double(), LineartElementLinkNode::element_count, LineartRenderBuffer::far_clip, lineart_memory_get_edge_space(), lineart_memory_get_triangle_space(), lineart_memory_get_vert_space(), lineart_triangle_cull_single(), LISTBASE_FOREACH, LRT_CULL_DECIDE_INSIDE, LRT_CULL_ENSURE_MEMORY, LRT_ELEMENT_IS_ADDITIONAL, mul_v3db_db(), LineartRenderBuffer::near_clip, LineartRenderBuffer::triangle_buffer_pointers, LineartRenderBuffer::triangle_size, LineartRenderBuffer::view_projection, and LineartRenderBuffer::view_vector.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Adjacent data is only used during the initial stages of computing. So we can free it using this function when it is not needed anymore.
Definition at line 1297 of file lineart_cpu.c.
References BLI_pophead(), LinkData::data, LineartTriangle::intersecting_verts, LISTBASE_FOREACH, MEM_freeN, NULL, LineartRenderBuffer::triangle_adjacent_pointers, LineartRenderBuffer::triangle_buffer_pointers, and LineartRenderBuffer::triangle_size.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
The calculated view vector will point towards the far-plane from the camera position.
Definition at line 2573 of file lineart_cpu.c.
References LineartRenderBuffer::cam_obmat, copy_m4_m4(), copy_v3db_v3fl(), invert_m4_m4(), mul_v3_mat3_m4v3(), normalize_v3(), transpose_m4(), and LineartRenderBuffer::view_vector.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Link lines to their respective bounding areas.
Definition at line 3155 of file lineart_cpu.c.
References col, e, LineartRenderBuffer::initial_bounding_areas, lineart_bounding_area_link_line(), lineart_get_edge_bounding_areas(), LRT_BA_ROWS, LRT_ITER_ALL_LINES_BEGIN, and LRT_ITER_ALL_LINES_END.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Definition at line 1805 of file lineart_cpu.c.
References BKE_camera_sensor_fit(), BKE_camera_sensor_size(), BLI_listbase_clear(), LineartRenderBuffer::cam_obmat, CAM_ORTHO, CAM_PERSP, CAMERA_SENSOR_FIT_HOR, CAMERA_SENSOR_FIT_VERT, Camera::clip_end, Camera::clip_start, copy_m4_m4_db(), Object::data, DEG_ITER_OBJECT_FLAG_DUPLI, DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY, DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET, DEG_ITER_OBJECT_FLAG_VISIBLE, DEG_OBJECT_ITER_BEGIN, DEG_OBJECT_ITER_END, depsgraph, double(), focallength_to_fov(), G, LineartRenderBuffer::h, invert_m4_m4(), Camera::lens, lineart_geometry_object_load(), lineart_matrix_ortho_44d(), lineart_matrix_perspective_44d(), lineart_usage_check(), Scene::master_collection, mul_m4db_m4db_m4fl_uniq(), Camera::ortho_scale, PIL_check_seconds_timer(), result, scene, Camera::sensor_fit, Camera::sensor_x, Camera::sensor_y, LineartRenderBuffer::triangle_buffer_pointers, Camera::type, unit_m4_db(), LineartRenderBuffer::vertex_buffer_pointers, view, LineartRenderBuffer::view_projection, w(), and LineartRenderBuffer::w.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
All internal functions starting with lineart_main_ is called inside MOD_lineart_compute_feature_lines function. This function handles all occlusion calculation.
Definition at line 442 of file lineart_cpu.c.
References BLI_task_pool_create(), BLI_task_pool_free(), BLI_task_pool_push(), BLI_task_pool_work_and_wait(), LineartRenderBuffer::contour_managed, LineartRenderBuffer::contours, LineartRenderBuffer::crease_lines, LineartRenderBuffer::crease_managed, LineartRenderBuffer::edge_mark_managed, LineartRenderBuffer::edge_marks, LineartRenderBuffer::intersection_lines, LineartRenderBuffer::intersection_managed, lineart_occlusion_worker(), LineartRenderBuffer::material_lines, LineartRenderBuffer::material_managed, MEM_callocN, MEM_freeN, NULL, LineartRenderTaskInfo::rb, TASK_PRIORITY_HIGH, LineartRenderBuffer::thread_count, and LineartRenderTaskInfo::thread_id.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Definition at line 1315 of file lineart_cpu.c.
References LineartRenderBuffer::cam_is_persp, LineartVert::fbcoord, LISTBASE_FOREACH, LineartRenderBuffer::shift_x, LineartRenderBuffer::shift_y, and LineartRenderBuffer::vertex_buffer_pointers.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
Definition at line 666 of file lineart_cpu.c.
References LineartElementLinkNode::crease_threshold, LineartRenderBuffer::crease_threshold, LineartElementLinkNode::element_count, LineartElementLinkNode::flags, LineartRenderBuffer::line_buffer_pointers, lineart_list_append_pointer_pool_sized(), lineart_mem_aquire(), LRT_ELEMENT_IS_ADDITIONAL, and LineartRenderBuffer::render_data_pool.
Referenced by lineart_main_cull_triangles().
|
static |
The following lineart_memory_get_XXX_space functions are for allocating new memory for some modified geometries in the culling stage.
Definition at line 630 of file lineart_cpu.c.
References LineartElementLinkNode::element_count, LineartElementLinkNode::flags, lineart_list_append_pointer_pool_sized(), lineart_mem_aquire(), LRT_ELEMENT_IS_ADDITIONAL, LineartRenderBuffer::render_data_pool, LineartRenderBuffer::triangle_buffer_pointers, and LineartRenderBuffer::triangle_size.
Referenced by lineart_main_cull_triangles().
|
static |
Definition at line 649 of file lineart_cpu.c.
References LineartElementLinkNode::element_count, LineartElementLinkNode::flags, lineart_list_append_pointer_pool_sized(), lineart_mem_aquire(), LRT_ELEMENT_IS_ADDITIONAL, LineartRenderBuffer::render_data_pool, and LineartRenderBuffer::vertex_buffer_pointers.
Referenced by lineart_main_cull_triangles().
| BLI_INLINE bool lineart_occlusion_is_adjacent_intersection | ( | LineartEdge * | e, |
| LineartTriangle * | rt | ||
| ) |
To see if given line is connected to an adjacent intersection line.
Definition at line 311 of file lineart_cpu.c.
Referenced by lineart_occlusion_single_line().
|
static |
Definition at line 372 of file lineart_cpu.c.
References BLI_spin_lock(), BLI_spin_unlock(), data, LineartRenderBuffer::lock_task, LRT_ASSIGN_OCCLUSION_TASK, and material.
Referenced by lineart_occlusion_worker().
|
static |
Definition at line 319 of file lineart_cpu.c.
References LineartRenderBuffer::allow_overlapping_edges, LineartTriangleThread::base, LineartRenderBuffer::cam_is_persp, LineartRenderBuffer::camera_pos, e, LineartTriangle::flags, l, lineart_bounding_area_next(), lineart_edge_cut(), lineart_edge_first_bounding_area(), lineart_occlusion_is_adjacent_intersection(), lineart_triangle_edge_image_space_occlusion(), LineartBoundingArea::linked_triangles, LISTBASE_FOREACH, LineartRenderBuffer::lock_task, LRT_TRIANGLE_INTERSECTION_ONLY, LineartRenderBuffer::max_occlusion_level, r, LineartRenderBuffer::shift_x, LineartRenderBuffer::shift_y, LineartTriangleThread::testing_e, LineartTriangle::transparency_mask, LineartRenderBuffer::view_projection, LineartRenderBuffer::view_vector, x, and y.
Referenced by lineart_occlusion_worker().
|
static |
Definition at line 408 of file lineart_cpu.c.
References LineartRenderTaskInfo::contour, LineartRenderTaskInfo::contour_end, LineartRenderTaskInfo::crease, LineartRenderTaskInfo::crease_end, LineartRenderTaskInfo::edge_mark, LineartRenderTaskInfo::edge_mark_end, LineartRenderTaskInfo::intersection, LineartRenderTaskInfo::intersection_end, lineart_occlusion_make_task_info(), lineart_occlusion_single_line(), LineartRenderTaskInfo::material, LineartRenderTaskInfo::material_end, LineartEdge::next, LineartRenderTaskInfo::rb, and LineartRenderTaskInfo::thread_id.
Referenced by lineart_main_occlusion_begin().
|
static |
Test if v lies with in the triangle formed by v0, v1, and v2. Returns false when v is exactly on the edge.
For v to be inside the triangle, it needs to be at the same side of v0->v1, v1->v2, and v2->v0, where the "side" is determined by checking the sign of cross(v1-v0, v1-v) and so on.
Definition at line 475 of file lineart_cpu.c.
References Freestyle::c, v, v1, and v2.
Referenced by lineart_bounding_area_triangle_intersect().
|
static |
Similar with lineart_point_inside_triangle, but in 3d. Returns false when not co-planar.
Definition at line 589 of file lineart_cpu.c.
References cross_v3_v3v3_db(), dot_v3v3_db(), l, r, sub_v3_v3v3_db(), v, v1, and v2.
Referenced by lineart_triangle_2v_intersection_test().
Definition at line 507 of file lineart_cpu.c.
References LRT_DOUBLE_CLOSE_ENOUGH, ratiod(), sub_v2_v2v2_db(), v, and v1.
Referenced by lineart_point_triangle_relation().
|
static |
Same algorithm as lineart_point_inside_triangle(), but returns differently: 0-outside 1-on the edge 2-inside.
Definition at line 547 of file lineart_cpu.c.
References Freestyle::c, lineart_point_on_line_segment(), r, v, v1, and v2.
Referenced by lineart_triangle_edge_image_space_occlusion().
|
static |
Definition at line 3757 of file lineart_cpu.c.
References LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_CREASE, LRT_EDGE_FLAG_EDGE_MARK, LRT_EDGE_FLAG_INTERSECTION, LRT_EDGE_FLAG_MATERIAL, types, LineartRenderBuffer::use_contour, LineartRenderBuffer::use_crease, LineartRenderBuffer::use_edge_marks, LineartRenderBuffer::use_intersections, and LineartRenderBuffer::use_material.
Referenced by lineart_gpencil_generate().
|
static |
This tests a triangle against a virtual line represented by v1---v2. The vertices returned after repeated calls to this function is then used to create a triangle/triangle intersection line.
Definition at line 2291 of file lineart_cpu.c.
References copy_v3_v3_db(), dot_v3v3_db(), fabs(), LineartVert::gloc, LineartTriangle::gn, interp_v3_v3v3_db(), LineartTriangle::intersecting_verts, LineartVertIntersection::intersecting_with, l, lineart_mem_aquire(), lineart_point_inside_triangle3d(), lineart_prepend_pool(), lineart_vert_already_intersected_2v(), LRT_DOUBLE_CLOSE_ENOUGH, LRT_VERT_HAS_INTERSECTION_DATA, LinkNode::next, NULL, r, LineartRenderBuffer::render_data_pool, result, sub_v3_v3v3_db(), LineartTriangle::v, v1, and v2.
Referenced by lineart_triangle_intersect().
|
static |
Definition at line 1453 of file lineart_cpu.c.
References e, LineartTriangleAdjacent::e, and lineart_edge_match().
Referenced by lineart_geometry_object_load().
|
static |
Does near-plane cut on 1 triangle only. When cutting with far-plane, the camera vectors gets reversed by the caller so don't need to implement one in a different direction.
(!in0) means "when point 0 is visible". conditions for point 1, 2 are the same idea.
(in0) means "when point 0 is invisible". conditions for point 1, 2 are the same idea.
Definition at line 707 of file lineart_cpu.c.
References Freestyle::a, LineartRenderBuffer::contours, dot_v3v3_db(), e, LineartTriangle::flags, LineartVert::gloc, INCREASE_RL, LineartVert::index, interp_v3_v3v3_db(), LineartTriangle::intersecting_verts, lineart_prepend_edge_direct(), lineart_triangle_post(), lineart_triangle_set_cull_flag(), LRT_CULL_DISCARD, LRT_CULL_GENERATED, LRT_CULL_USED, LRT_EDGE_FLAG_CONTOUR, mul_v4_m4v3_db(), LineartElementLinkNode::pointer, RELINK_RL, REMOVE_TRIANGLE_RL, SELECT_RL, sub_v3_v3v3_db(), LineartRenderBuffer::triangle_size, and LineartTriangle::v.
Referenced by lineart_main_cull_triangles().
|
static |
Referenced by lineart_occlusion_single_line().
|
static |
This is the main function to calculate the occlusion status between 1(one) triangle and 1(one) line. if returns true, then from/to will carry the occluded segments in ratio from e->v1 to e->v2. The line is later cut with these two values.
Definition at line 1960 of file lineart_cpu.c.
References Freestyle::a, Freestyle::c, copy_v3_v3_db(), copy_v4_v4_db(), DBL_TRIANGLE_LIM, dot_v3v3_db(), e, fabs(), LineartVert::fbcoord, from, LineartVert::gloc, LineartTriangle::gn, interp_v3_v3v3_db(), INTERSECT_JUST_GREATER, INTERSECT_JUST_SMALLER, INTERSECT_SORT_MIN_TO_MAX_3, LF, lineart_edge_from_triangle(), lineart_LineIntersectTest2d(), lineart_point_triangle_relation(), LRT_ABC, MAX2, MAX3, MIN2, MIN3, mul_v3db_db(), mul_v4_m4v3_db(), order, ratiod(), RF, sub_v3_v3v3_db(), and LineartTriangle::v.
|
static |
Because we have a variable size for LineartTriangle, we need an access helper. See LineartTriangleThread for more info.
Definition at line 1358 of file lineart_cpu.c.
References LineartRenderBuffer::triangle_size.
Referenced by lineart_geometry_object_load(), and lineart_identify_feature_line().
|
static |
Returns the two other verts of the triangle given a vertex. Returns false if the given vertex doesn't belong to this triangle.
Definition at line 1875 of file lineart_cpu.c.
References l, r, and LineartTriangle::v.
Referenced by lineart_triangle_intersect().
|
static |
Test if two triangles intersect. Generates one intersection line if the check succeeds.
Definition at line 2359 of file lineart_cpu.c.
References BLI_addtail(), LineartRenderBuffer::camera_pos, col, copy_v3_v3_db(), fabs(), LineartRenderBuffer::far_clip, LineartVert::flag, LineartVert::gloc, LineartRenderBuffer::initial_bounding_areas, LineartTriangle::intersecting_verts, LineartRenderBuffer::intersection_count, LineartRenderBuffer::intersection_lines, lineart_bounding_area_link_line(), lineart_get_edge_bounding_areas(), lineart_mem_aquire(), lineart_prepend_edge_direct(), lineart_prepend_pool(), lineart_triangle_2v_intersection_test(), lineart_triangle_get_other_verts(), lineart_triangle_share_point(), lineart_vert_set_intersection_2v(), LRT_BA_ROWS, LRT_EDGE_FLAG_INTERSECTION, LRT_VERT_HAS_INTERSECTION_DATA, mul_v3db_db(), mul_v4_m4v3_db(), LineartRenderBuffer::near_clip, next, NULL, LineartRenderBuffer::render_data_pool, result, LineartRenderBuffer::shift_x, LineartRenderBuffer::shift_y, LineartTriangle::v, v1, v2, and LineartRenderBuffer::view_projection.
Referenced by lineart_triangle_intersect_in_bounding_area().
|
static |
Definition at line 2513 of file lineart_cpu.c.
References LineartBoundingArea::child, LinkData::data, ListBase::first, LineartTriangle::flags, LineartVert::gloc, lineart_triangle_intersect(), lineart_triangle_share_edge(), LineartBoundingArea::linked_triangles, LRT_TRIANGLE_INTERSECTION_ONLY, LRT_TRIANGLE_NO_INTERSECTION, MAX3, MIN3, LinkData::next, LineartTriangleThread::testing_e, and LineartTriangle::v.
Referenced by lineart_bounding_area_link_triangle().
|
static |
Definition at line 683 of file lineart_cpu.c.
References copy_v3_v3_db(), LineartTriangle::flags, LineartTriangle::gn, and LRT_CULL_GENERATED.
Referenced by lineart_triangle_cull_single().
|
static |
Definition at line 690 of file lineart_cpu.c.
References LineartTriangle::flags, and LRT_TRIANGLE_INTERSECTION_ONLY.
Referenced by lineart_triangle_cull_single().
|
static |
At this stage of the computation we don't have triangle adjacent info anymore, so we can only compare the global vert index.
Definition at line 2192 of file lineart_cpu.c.
References l, r, and BMLoop::v.
Referenced by lineart_triangle_intersect_in_bounding_area().
|
static |
Definition at line 2235 of file lineart_cpu.c.
References l, NULL, r, and BMLoop::v.
Referenced by lineart_triangle_intersect().
|
static |
Definition at line 2701 of file lineart_cpu.c.
References BKE_render_num_threads(), Scene::r, scene, and LineartRenderBuffer::thread_count.
Referenced by MOD_lineart_compute_feature_lines().
|
static |
See if this object in such collection is used for generating line art, Disabling a collection for line art will doable all objects inside. _rb is used to provide source selection info. See the definition of rb->_source_type for details.
Definition at line 1749 of file lineart_cpu.c.
References _lineart_object_not_in_source_collection(), LineartRenderBuffer::_source_collection, LineartRenderBuffer::_source_object, LineartRenderBuffer::_source_type, BKE_collection_has_object(), Freestyle::c, COLLECTION_LRT_EXCLUDE, COLLECTION_LRT_INTERSECTION_ONLY, COLLECTION_LRT_NO_INTERSECTION, COLLECTION_LRT_OCCLUSION_ONLY, Object::id, Object::lineart, LISTBASE_FOREACH, LRT_SOURCE_COLLECTION, LRT_SOURCE_OBJECT, NULL, OBJECT_LRT_EXCLUDE, OBJECT_LRT_INHERIT, OBJECT_LRT_INTERSECTION_ONLY, OBJECT_LRT_NO_INTERSECTION, OBJECT_LRT_OCCLUSION_ONLY, ID::orig_id, result, and ObjectLineArt::usage.
Referenced by lineart_main_load_geometries().
|
static |
To save time and prevent overlapping lines when computing intersection lines.
Definition at line 2271 of file lineart_cpu.c.
References LineartVertIntersection::isec1, LineartVertIntersection::isec2, v1, and v2.
Referenced by lineart_triangle_2v_intersection_test().
|
static |
Definition at line 2279 of file lineart_cpu.c.
References LineartVertIntersection::isec1, LineartVertIntersection::isec2, v1, and v2.
Referenced by lineart_triangle_intersect().
|
static |
Transform a single vert to it's viewing position.
Definition at line 1344 of file lineart_cpu.c.
References BMVert::co, copy_v3db_v3fl(), LineartVert::fbcoord, LineartVert::gloc, mul_v3_m4v3_db(), mul_v4_m4v3_db(), and v.
Referenced by lineart_geometry_object_load().
| bool MOD_lineart_compute_feature_lines | ( | Depsgraph * | depsgraph, |
| LineartGpencilModifierData * | lmd | ||
| ) |
This is the entry point of all line art calculations.
Definition at line 3651 of file lineart_cpu.c.
References LineartRenderBuffer::_source_collection, LineartRenderBuffer::_source_object, LineartRenderBuffer::_source_type, LineartRenderBuffer::angle_splitting_threshold, BKE_scene_camera_switch_update(), LineartGpencilModifierData::calculation_flags, Scene::camera, LineartGpencilModifierData::chaining_image_threshold, DEG_get_evaluated_scene(), depsgraph, ListBase::first, G, LineartGpencilModifierData::level_end, LineartGpencilModifierData::level_start, lineart_count_and_print_render_buffer_memory(), lineart_create_render_buffer(), lineart_main_add_triangles(), lineart_main_bounding_area_make_initial(), lineart_main_cull_triangles(), lineart_main_free_adjacent_data(), lineart_main_get_view_vector(), lineart_main_link_lines(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), lineart_main_perspective_division(), lineart_triangle_size_get(), LRT_ALLOW_DUPLI_OBJECTS, MAX2, LineartRenderBuffer::max_occlusion_level, MIN2, MOD_lineart_chain_clear_picked_flag(), MOD_lineart_chain_connect(), MOD_lineart_chain_discard_short(), MOD_lineart_chain_feature_lines(), MOD_lineart_chain_split_angle(), MOD_lineart_chain_split_for_fixed_occlusion(), scene, LineartGpencilModifierData::source_collection, LineartGpencilModifierData::source_object, LineartGpencilModifierData::source_type, LineartRenderBuffer::triangle_size, and LineartRenderBuffer::vertex_buffer_pointers.
Referenced by bake_strokes(), bakeModifier(), and generateStrokes().
| void MOD_lineart_destroy_render_data | ( | LineartGpencilModifierData * | lmd | ) |
Definition at line 2629 of file lineart_cpu.c.
References G, lineart_destroy_render_data(), MEM_freeN, NULL, and LineartGpencilModifierData::render_buffer.
Referenced by bake_strokes(), bakeModifier(), and generateStrokes().
| LineartBoundingArea* MOD_lineart_get_bounding_area | ( | LineartRenderBuffer * | rb, |
| double | x, | ||
| double | y | ||
| ) |
Wrapper for more convenience.
Definition at line 3342 of file lineart_cpu.c.
References lineart_get_bounding_area(), MOD_lineart_get_parent_bounding_area(), NULL, x, and y.
Referenced by MOD_lineart_chain_feature_lines().
| LineartBoundingArea* MOD_lineart_get_parent_bounding_area | ( | LineartRenderBuffer * | rb, |
| double | x, | ||
| double | y | ||
| ) |
This only gets initial "biggest" tile.
Definition at line 3268 of file lineart_cpu.c.
References col, LineartRenderBuffer::height_per_tile, LineartRenderBuffer::initial_bounding_areas, LRT_BA_ROWS, LineartRenderBuffer::tile_count_x, LineartRenderBuffer::tile_count_y, LineartRenderBuffer::width_per_tile, x, and y.
Referenced by lineart_bounding_area_get_end_point(), lineart_bounding_area_link_chain(), and MOD_lineart_get_bounding_area().
| void MOD_lineart_gpencil_generate | ( | LineartRenderBuffer * | rb, |
| Depsgraph * | depsgraph, | ||
| Object * | ob, | ||
| bGPDlayer * | gpl, | ||
| bGPDframe * | gpf, | ||
| char | source_type, | ||
| void * | source_reference, | ||
| int | level_start, | ||
| int | level_end, | ||
| int | mat_nr, | ||
| short | edge_types, | ||
| uchar | transparency_flags, | ||
| uchar | transparency_mask, | ||
| short | thickness, | ||
| float | opacity, | ||
| const char * | source_vgname, | ||
| const char * | vgname, | ||
| int | modifier_flags | ||
| ) |
Wrapper for external calls.
Definition at line 3932 of file lineart_cpu.c.
References depsgraph, invert_m4_m4(), lineart_gpencil_generate(), LRT_EDGE_FLAG_INTERSECTION, LRT_SOURCE_COLLECTION, LRT_SOURCE_OBJECT, NULL, and Object::obmat.
Referenced by bake_strokes(), and generate_strokes_actual().