Blender
V3.3
|
#include "MOD_gpencil_lineart.h"
#include "MOD_lineart.h"
#include "lineart_intern.h"
#include "BKE_global.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_lib_id.h"
#include "BKE_material.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "DEG_depsgraph_query.h"
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_light_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 "BLI_task.h"
#include "PIL_time.h"
Go to the source code of this file.
Classes | |
struct | LineartShadowFinalizeData |
Macros | |
#define | DISCARD_NONSENSE_SEGMENTS |
#define | GET_RATIO(n) |
Typedefs | |
typedef struct LineartShadowFinalizeData | LineartShadowFinalizeData |
#define DISCARD_NONSENSE_SEGMENTS |
#define GET_RATIO | ( | n | ) |
typedef struct LineartShadowFinalizeData LineartShadowFinalizeData |
|
static |
Definition at line 56 of file lineart_shadow.c.
References LineartData::_conf::cam_is_persp, LineartData::_conf::cam_is_persp_secondary, LineartData::_conf::camera_pos, LineartData::_conf::camera_pos_secondary, LineartData::conf, copy_v3_v3_db(), dot_v3v3_db(), e, LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_CONTOUR_SECONDARY, sub_v3_v3v3_db(), LineartData::_conf::view_vector, and LineartData::_conf::view_vector_secondary.
Referenced by lineart_register_shadow_cuts(), and lineart_shadow_cast_generate_edges().
|
static |
This function tries to get the closest projected segments along two end points. The x,y of s1, s2 are aligned in frame-buffer coordinates, only z,w are different. We will get the closest z/w as well as the corresponding global coordinates.
Returns true when a new cut (c
) is needed in the middle, otherwise returns false, and *r_new_xxx
are not touched.
Definition at line 220 of file lineart_shadow.c.
References copy_v3_v3_db(), copy_v4_v4_db(), interp_v3_v3v3_db(), interpd(), and ratiod().
Referenced by lineart_shadow_edge_cut().
LineartEdge* lineart_find_matching_edge | ( | LineartElementLinkNode * | shadow_eln, |
uint64_t | edge_identifier | ||
) |
Definition at line 44 of file lineart_shadow.c.
References LineartElementLinkNode::element_count, NULL, and LineartElementLinkNode::pointer.
Referenced by lineart_geometry_object_load(), and lineart_register_intersection_shadow_cuts().
LineartElementLinkNode* lineart_find_matching_eln | ( | ListBase * | shadow_elns, |
int | obindex | ||
) |
Definition at line 34 of file lineart_shadow.c.
References LISTBASE_FOREACH, and NULL.
Referenced by lineart_create_edges_from_isec_data(), lineart_geometry_object_load(), lineart_shadow_finalize_shadow_edges_task(), and MOD_lineart_chain_find_silhouette_backdrop_objects().
|
static |
Definition at line 162 of file lineart_shadow.c.
References BLI_pophead(), BLI_spin_lock(), BLI_spin_unlock(), ListBase::first, lineart_mem_acquire_thread(), LineartData::lock_cuts, LineartData::render_data_pool, and LineartData::wasted_shadow_cuts.
Referenced by lineart_shadow_edge_cut().
void lineart_main_make_enclosed_shapes | ( | LineartData * | ld, |
LineartData * | shadow_ld | ||
) |
Definition at line 1352 of file lineart_shadow.c.
References LineartPendingEdges::array, LineartData::_conf::cam_is_persp, LineartData::conf, LineartElementLinkNode::element_count, G, lineart_add_edge_to_array(), lineart_finalize_object_edge_array_reserve(), lineart_main_clear_linked_edges(), lineart_main_link_lines(), lineart_main_occlusion_begin(), lineart_shadow_cast(), lineart_shadow_cast_generate_edges(), lineart_shadow_register_enclosed_shapes(), lineart_shadow_register_silhouette(), LineartPendingEdges::max, MEM_freeN, mul_v3db_db(), mul_v4_m4v3_db(), LineartPendingEdges::next, NULL, LineartData::pending_edges, PIL_check_seconds_timer(), LineartElementLinkNode::pointer, LineartData::render_data_pool, LineartData::scheduled_count, LineartData::shadow_data_pool, LineartData::_conf::shadow_use_silhouette, v, and LineartData::_conf::view_projection.
Referenced by MOD_lineart_compute_feature_lines().
void lineart_main_transform_and_add_shadow | ( | LineartData * | ld, |
LineartElementLinkNode * | veln, | ||
LineartElementLinkNode * | eeln | ||
) |
Definition at line 1319 of file lineart_shadow.c.
References BLI_addtail(), BLI_parallel_range_settings_defaults(), BLI_task_parallel_range(), data, LineartElementLinkNode::element_count, LineartData::geom, LineartData::_geom::line_buffer_pointers, lineart_add_edge_to_array(), lineart_shadow_finalize_shadow_edges_task(), lineart_shadow_transform_task(), TaskParallelSettings::min_iter_per_thread, LineartData::pending_edges, LineartElementLinkNode::pointer, and LineartData::_geom::vertex_buffer_pointers.
Referenced by MOD_lineart_compute_feature_lines().
bool lineart_main_try_generate_shadow | ( | Depsgraph * | depsgraph, |
Scene * | scene, | ||
LineartData * | original_ld, | ||
LineartGpencilModifierData * | lmd, | ||
LineartStaticMemPool * | shadow_data_pool, | ||
LineartElementLinkNode ** | r_veln, | ||
LineartElementLinkNode ** | r_eeln, | ||
ListBase * | r_calculated_edges_eln_list, | ||
LineartData ** | r_shadow_ld_if_reproject | ||
) |
Definition at line 1119 of file lineart_shadow.c.
References LineartData::_conf::allow_duplicated_types, BLI_spin_init(), LineartData::_conf::cam_is_persp, LineartData::_conf::cam_is_persp_secondary, LineartData::_conf::cam_obmat, LineartData::_conf::cam_obmat_secondary, LineartData::_conf::camera_pos, LineartData::_conf::camera_pos_secondary, LineartData::conf, copy_m4_m4(), copy_m4_m4_db(), copy_v3_v3_db(), copy_v3db_v3fl(), Object::data, DEG2RAD, depsgraph, LineartData::_conf::do_shadow_cast, LineartData::edge_data_pool, LineartData::_conf::far_clip, ListBase::first, LineartGpencilModifierData::flags, G, LineartData::geom, LineartData::h, if(), invert_m4_m4(), LA_SUN, LineartGpencilModifierData::light_contour_object, LineartData::_geom::line_buffer_pointers, lineart_destroy_render_data_keep_init(), lineart_main_add_triangles(), lineart_main_bounding_area_make_initial(), lineart_main_bounding_areas_connect_post(), lineart_main_cull_triangles(), lineart_main_discard_out_of_frame_edges(), 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_matrix_ortho_44d(), lineart_matrix_perspective_44d(), lineart_shadow_cast(), lineart_shadow_cast_generate_edges(), LineartData::lock_cuts, LineartStaticMemPool::lock_mem, LineartData::lock_task, LRT_ALLOW_DUPLI_OBJECTS, LRT_TILE_RECURSIVE_ORTHO, LRT_TILE_RECURSIVE_PERSPECTIVE, LineartData::_conf::max_occlusion_level, MEM_callocN, MEM_freeN, mul_m4db_m4db_m4fl_uniq(), LineartData::_conf::near_clip, NULL, OB_LAMP, Object::obmat, PIL_check_seconds_timer(), LineartData::qtree, LineartData::_qtree::recursive_level, LineartData::render_data_pool, result, scene, LineartGpencilModifierData::shadow_camera_far, LineartGpencilModifierData::shadow_camera_near, LineartGpencilModifierData::shadow_camera_size, LineartData::shadow_data_pool, LineartData::_conf::shadow_enclose_shapes, LineartData::_conf::shadow_selection, Light::type, Object::type, unit_m4_db(), LineartData::_conf::use_back_face_culling, LineartData::_conf::use_contour, LineartData::_conf::use_contour_secondary, LineartData::_conf::use_crease, LineartData::_conf::use_edge_marks, LineartData::_conf::use_intersections, LineartData::_conf::use_light_contour, LineartData::_conf::use_loose, LineartData::_conf::use_material, LineartData::_conf::use_shadow, LineartData::_geom::vertex_buffer_pointers, view, LineartData::_conf::view, LineartData::_conf::view_projection, and LineartData::w.
Referenced by MOD_lineart_compute_feature_lines().
void lineart_register_intersection_shadow_cuts | ( | LineartData * | ld, |
ListBase * | shadow_elns | ||
) |
Definition at line 123 of file lineart_shadow.c.
References e, LineartElementLinkNode::element_count, LineartData::geom, LineartData::_geom::line_buffer_pointers, lineart_find_matching_edge(), lineart_register_shadow_cuts(), LISTBASE_FOREACH, LRT_ELEMENT_INTERSECTION_DATA, NULL, and LineartElementLinkNode::pointer.
Referenced by MOD_lineart_compute_feature_lines().
void lineart_register_shadow_cuts | ( | LineartData * | ld, |
LineartEdge * | e, | ||
LineartEdge * | shadow_edge | ||
) |
Definition at line 101 of file lineart_shadow.c.
References e, lineart_contour_viewed_from_dark_side(), lineart_edge_cut(), LISTBASE_FOREACH, LRT_SHADOW_MASK_ILLUMINATED, LRT_SHADOW_MASK_SHADED, and LineartEdge::segments.
Referenced by lineart_geometry_object_load(), and lineart_register_intersection_shadow_cuts().
|
static |
Definition at line 867 of file lineart_shadow.c.
References LineartData::_conf::allow_overlapping_edges, LineartTriangleThread::base, LineartData::conf, LineartShadowEdge::e_ref, LineartShadowEdge::fbc1, LineartShadowEdge::fbc2, if(), lineart_edge_from_triangle(), lineart_shadow_cast_onto_triangle(), lineart_shadow_create_shadow_edge_array(), lineart_shadow_edge_cut(), LRT_EDGE_BA_MARCHING_BEGIN, LRT_EDGE_BA_MARCHING_END, LRT_EDGE_BA_MARCHING_NEXT, LineartTriangle::mat_occlusion, LineartData::shadow_edges, LineartData::shadow_edges_count, LineartTriangle::target_reference, and LineartTriangleThread::testing_e.
Referenced by lineart_main_make_enclosed_shapes(), and lineart_main_try_generate_shadow().
|
static |
Definition at line 924 of file lineart_shadow.c.
References BLI_addtail(), copy_v3_v3_db(), e, LineartShadowEdge::e_ref, LineartShadowEdge::e_ref_light_contour, LineartEdge::edge_identifier, LineartElementLinkNode::element_count, G, LineartShadowEdge::g1, LineartShadowEdge::g2, if(), LineartVert::index, lineart_contour_viewed_from_dark_side(), lineart_edge_cut(), lineart_mem_acquire(), LISTBASE_FOREACH, LRT_EDGE_FLAG_LIGHT_CONTOUR, LRT_EDGE_FLAG_PROJECTED_SHADOW, LRT_EDGE_FLAG_SHADOW_FACING_LIGHT, LRT_SHADOW_CASTED, LRT_SHADOW_FACING_LIGHT, LRT_SHADOW_MASK_SHADED, LineartElementLinkNode::pointer, LineartData::shadow_data_pool, LineartData::shadow_edges, LineartData::shadow_edges_count, LineartShadowEdge::shadow_segments, LineartEdge::t1, LineartEdge::t2, LineartTriangle::target_reference, LineartEdge::v1, v1, v2, and LineartEdge::v2.
Referenced by lineart_main_make_enclosed_shapes(), and lineart_main_try_generate_shadow().
|
static |
Definition at line 703 of file lineart_shadow.c.
References LineartData::_conf::cam_is_persp, LineartData::_conf::camera_pos, LineartData::conf, copy_v3_v3_db(), copy_v4_v4_db(), dot_v3v3_db(), fabs(), LineartShadowEdge::fbc1, LineartShadowEdge::fbc2, LineartVert::fbcoord, LineartVert::gloc, LineartTriangle::gn, interp_v3_v3v3_db(), interpd(), lineart_line_isec_2d_ignore_line2pos(), LRT_DOUBLE_CLOSE_ENOUGH, MAX2, MAX3, MIN2, MIN3, mul_v3db_db(), mul_v4_m4v3_db(), ratiod(), sub_v3_v3v3_db(), SWAP, swap_v3_v3_db(), swap_v4_v4_db(), LineartTriangle::v, v1, v2, LineartData::_conf::view_projection, and LineartData::_conf::view_vector.
Referenced by lineart_shadow_cast().
|
static |
Definition at line 295 of file lineart_shadow.c.
References BLI_addtail(), LineartData::_conf::cam_is_persp, LineartData::_conf::camera_pos, LineartData::conf, copy_v4_v4_db(), DISCARD_NONSENSE_SEGMENTS, dot_v3v3_db(), e, G, LineartVert::gloc, LineartTriangle::gn, if(), interp_v3_v3v3_db(), lineart_mem_acquire(), LISTBASE_FOREACH, LRT_EDGE_FLAG_CONTOUR, LRT_EDGE_FLAG_LIGHT_CONTOUR, LRT_EDGE_FLAG_LOOSE, LRT_ITER_ALL_LINES_BEGIN, LRT_ITER_ALL_LINES_END, LineartShadowSegment::ratio, LineartData::render_data_pool, result, LineartData::shadow_edges, LineartData::shadow_edges_count, sub_v3_v3v3_db(), LineartEdge::t1, LineartEdge::t2, LineartEdge::v1, and LineartData::_conf::view_vector.
Referenced by lineart_shadow_cast().
|
static |
Definition at line 486 of file lineart_shadow.c.
References BLI_insertlinkafter(), BLI_insertlinkbefore(), LineartData::_conf::cam_is_persp, LineartData::conf, copy_v3_v3_db(), copy_v4_v4_db(), e, LineartShadowSegment::fbc1, LineartShadowSegment::fbc2, LineartShadowSegment::flag, LineartShadowSegment::g1, LineartShadowSegment::g2, interpf(), lineart_do_closest_segment(), lineart_give_shadow_segment(), lineart_shadow_segment_slice_get(), LRT_DOUBLE_CLOSE_ENOUGH, LRT_SHADOW_CASTED, LRT_SHADOW_FACING_LIGHT, LineartShadowSegment::next, NULL, LineartShadowSegment::ratio, t, LineartShadowSegment::target_reference, and UNLIKELY.
Referenced by lineart_shadow_cast().
|
static |
Definition at line 1291 of file lineart_shadow.c.
References data, e, LineartData::geom, if(), lineart_find_matching_eln(), LRT_CLOSE_LOOSER_v3, LRT_EDGE_FLAG_LIGHT_CONTOUR, LRT_OBINDEX_HIGHER, LRT_OBINDEX_LOWER, LineartElementLinkNode::pointer, v, v1, v2, and LineartData::_geom::vertex_buffer_pointers.
Referenced by lineart_main_transform_and_add_shadow().
|
static |
Definition at line 1055 of file lineart_shadow.c.
References LineartPendingEdges::array, LineartData::_conf::cam_is_persp, LineartData::conf, e, GET_RATIO, interp_v3_v3v3_db(), lineart_edge_cut(), LRT_SHADOW_MASK_ENCLOSED_SHAPE, mul_v3db_db(), mul_v4_m4v3_db(), LineartEdgeSegment::next, LineartPendingEdges::next, LineartEdgeSegment::occlusion, LineartData::pending_edges, LineartEdgeSegment::ratio, LineartData::_conf::shift_x, LineartData::_conf::shift_y, and LineartData::_conf::view_projection.
Referenced by lineart_main_make_enclosed_shapes().
|
static |
Definition at line 1024 of file lineart_shadow.c.
References e, LineartShadowEdge::e_ref, LineartShadowEdge::es_ref, interpd(), lineart_edge_cut(), LISTBASE_FOREACH, LRT_OBINDEX_HIGHER, LRT_SHADOW_CASTED, LRT_SHADOW_SILHOUETTE_ERASED_GROUP, LineartEdgeSegment::next, LineartEdgeSegment::ratio, LineartData::shadow_edges, LineartData::shadow_edges_count, and LineartShadowEdge::shadow_segments.
Referenced by lineart_main_make_enclosed_shapes().
|
static |
Definition at line 180 of file lineart_shadow.c.
References interp_v3_v3v3_db(), and interpd().
Referenced by lineart_shadow_edge_cut().
|
static |
Definition at line 1281 of file lineart_shadow.c.
References LineartData::conf, data, mul_v4_m4v3_db(), v, and LineartData::_conf::view_projection.
Referenced by lineart_main_transform_and_add_shadow().