|
Blender V4.3
|
Classes | |
| struct | CornerNormalSpace |
| struct | CornerNormalSpaceArray |
| struct | CornerSplitTaskDataCommon |
| struct | LocalData |
Functions | |
| Array< int > | build_corner_to_face_map (OffsetIndices< int > faces) |
| GroupedSpan< int > | build_vert_to_edge_map (Span< int2 > edges, int verts_num, Array< int > &r_offsets, Array< int > &r_indices) |
| void | build_vert_to_face_indices (OffsetIndices< int > faces, Span< int > corner_verts, OffsetIndices< int > offsets, MutableSpan< int > face_indices) |
| GroupedSpan< int > | build_vert_to_face_map (OffsetIndices< int > faces, Span< int > corner_verts, int verts_num, Array< int > &r_offsets, Array< int > &r_indices) |
| Array< int > | build_vert_to_corner_indices (Span< int > corner_verts, OffsetIndices< int > offsets) |
| GroupedSpan< int > | build_vert_to_corner_map (Span< int > corner_verts, int verts_num, Array< int > &r_offsets, Array< int > &r_indices) |
| GroupedSpan< int > | build_edge_to_corner_map (Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices) |
| GroupedSpan< int > | build_edge_to_face_map (OffsetIndices< int > faces, Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices) |
| static float3 | face_center_calc_ngon (const Span< float3 > vert_positions, const Span< int > face_verts) |
| static float | mesh_calc_face_volume_centroid_with_reference_center (const Span< float3 > positions, const Span< int > face_verts, const float3 &reference_center, float r_cent[3]) |
| static float | face_area_centroid_calc (const Span< float3 > positions, const Span< int > face_verts, float r_cent[3]) |
| static Array< int > | create_reverse_offsets (const Span< int > indices, const int items_num) |
| static void | sort_small_groups (const OffsetIndices< int > groups, const int grain_size, MutableSpan< int > indices) |
| static Array< int > | reverse_indices_in_groups (const Span< int > group_indices, const OffsetIndices< int > offsets) |
| static void | reverse_group_indices_in_groups (const OffsetIndices< int > groups, const Span< int > group_to_elem, const OffsetIndices< int > offsets, MutableSpan< int > results) |
| static GroupedSpan< int > | gather_groups (const Span< int > group_indices, const int groups_num, Array< int > &r_offsets, Array< int > &r_indices) |
| static CornerNormalSpace | corner_fan_space_define (const float3 &lnor, const float3 &vec_ref, const float3 &vec_other, const Span< float3 > edge_vectors) |
| static float3 | corner_space_custom_data_to_normal (const CornerNormalSpace &lnor_space, const short2 clnor_data) |
| static void | mesh_edges_sharp_tag (const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > corner_edges, const Span< int > corner_to_face_map, const Span< float3 > face_normals, const Span< bool > sharp_faces, const Span< bool > sharp_edges, const float split_angle, MutableSpan< int2 > edge_to_corners, MutableSpan< bool > r_sharp_edges) |
| static void | build_edge_to_corner_map_with_flip_and_sharp (const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > corner_edges, const Span< bool > sharp_faces, const Span< bool > sharp_edges, MutableSpan< int2 > edge_to_corners) |
| static void | corner_manifold_fan_around_vert_next (const Span< int > corner_verts, const OffsetIndices< int > faces, const Span< int > corner_to_face, const int2 e2lfan_curr, const int vert_pivot, int *r_fan_corner, int *r_vert_corner) |
| static void | lnor_space_for_single_fan (CornerSplitTaskDataCommon *common_data, const int corner, const int space_index) |
| static void | split_corner_normal_fan_do (CornerSplitTaskDataCommon *common_data, const int corner, const int space_index, Vector< float3, 16 > *edge_vectors) |
| static bool | corner_split_generator_check_cyclic_smooth_fan (const Span< int > corner_verts, const Span< int > corner_edges, const OffsetIndices< int > faces, const Span< int2 > edge_to_corners, const Span< int > corner_to_face, const int2 e2l_prev, MutableBitSpan skip_corners, const int corner, const int corner_prev) |
| static void | corner_split_generator (CornerSplitTaskDataCommon *common_data, Vector< int, 32 > &r_single_corners, Vector< int, 32 > &r_fan_corners) |
| static void | mesh_normals_corner_custom_set (const Span< float3 > positions, const Span< int2 > edges, const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > corner_edges, const Span< float3 > vert_normals, const Span< float3 > face_normals, const Span< bool > sharp_faces, const bool use_vertices, MutableSpan< float3 > r_custom_corner_normals, MutableSpan< bool > sharp_edges, MutableSpan< short2 > r_clnors_data) |
| static void | mesh_set_custom_normals (Mesh *mesh, float(*r_custom_nors)[3], const bool use_vertices) |
Polygon Data Evaluation | |
| float3 | face_normal_calc (Span< float3 > vert_positions, Span< int > face_verts) |
| void | corner_tris_calc (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, MutableSpan< int3 > corner_tris) |
| void | corner_tris_calc_with_normals (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, Span< float3 > face_normals, MutableSpan< int3 > corner_tris) |
| void | corner_tris_calc_face_indices (OffsetIndices< int > faces, MutableSpan< int > tri_faces) |
| void | vert_tris_from_corner_tris (Span< int > corner_verts, Span< int3 > corner_tris, MutableSpan< int3 > vert_tris) |
| int3 | corner_tri_get_real_edges (Span< int2 > edges, Span< int > corner_verts, Span< int > corner_edges, const int3 &corner_tri) |
| float3 | face_center_calc (Span< float3 > vert_positions, Span< int > face_verts) |
| float | face_area_calc (Span< float3 > vert_positions, Span< int > face_verts) |
| void | face_angles_calc (Span< float3 > vert_positions, Span< int > face_verts, MutableSpan< float > angles) |
Medium-Level Normals Calculation | |
| void | normals_calc_faces (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, MutableSpan< float3 > face_normals) |
| void | normals_calc_verts (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face_map, Span< float3 > face_normals, MutableSpan< float3 > vert_normals) |
Face Corner Normal Calculation | |
| short2 | corner_space_custom_normal_to_data (const CornerNormalSpace &lnor_space, const float3 &custom_lnor) |
| void | normals_calc_corners (Span< float3 > vert_positions, Span< int2 > edges, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, Span< int > corner_to_face_map, Span< float3 > vert_normals, Span< float3 > face_normals, Span< bool > sharp_edges, Span< bool > sharp_faces, const short2 *clnors_data, CornerNormalSpaceArray *r_lnors_spacearr, MutableSpan< float3 > r_corner_normals) |
| void | normals_corner_custom_set (Span< float3 > vert_positions, Span< int2 > edges, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, Span< float3 > vert_normals, Span< float3 > face_normals, Span< bool > sharp_faces, MutableSpan< bool > sharp_edges, MutableSpan< float3 > r_custom_corner_normals, MutableSpan< short2 > r_clnors_data) |
| void | normals_corner_custom_set_from_verts (Span< float3 > vert_positions, Span< int2 > edges, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, Span< float3 > vert_normals, Span< float3 > face_normals, Span< bool > sharp_faces, MutableSpan< bool > sharp_edges, MutableSpan< float3 > r_custom_vert_normals, MutableSpan< short2 > r_clnors_data) |
| void | edges_sharp_from_angle_set (OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, Span< float3 > face_normals, Span< int > corner_to_face, Span< bool > sharp_faces, const float split_angle, MutableSpan< bool > sharp_edges) |
Topology Queries | |
| int | face_corner_prev (const IndexRange face, const int corner) |
| int | face_corner_next (const IndexRange face, const int corner) |
| int | face_find_corner_from_vert (const IndexRange face, const Span< int > corner_verts, const int vert) |
| int2 | face_find_adjacent_verts (const IndexRange face, const Span< int > corner_verts, const int vert) |
| int | face_triangles_num (const int face_size) |
| IndexRange | face_triangles_range (OffsetIndices< int > faces, int face_i) |
| int | edge_other_vert (const int2 edge, const int vert) |
Mesh Normal Calculation (Polygons) | |
| static float3 | normal_calc_ngon (const Span< float3 > vert_positions, const Span< int > face_verts) |
Face Tessellation | |
| BLI_INLINE void | mesh_calc_tessellation_for_face_impl (const Span< int > corner_verts, const Span< float3 > positions, const int face_start, const int face_size, int3 *tri, MemArena **pf_arena_p, const bool face_normal, const float normal_precalc[3]) |
| static void | mesh_calc_tessellation_for_face (const Span< int > corner_verts, const Span< float3 > positions, const int face_start, const int face_size, int3 *tri, MemArena **pf_arena_p) |
| static void | mesh_calc_tessellation_for_face_with_normal (const Span< int > corner_verts, const Span< float3 > positions, const int face_start, const int face_size, int3 *tri, MemArena **pf_arena_p, const float normal_precalc[3]) |
| static void | corner_tris_calc_impl (const Span< float3 > positions, const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< float3 > face_normals, MutableSpan< int3 > corner_tris) |
| Array< int > blender::bke::mesh::build_corner_to_face_map | ( | OffsetIndices< int > | faces | ) |
Definition at line 376 of file mesh_mapping.cc.
References build_corner_to_face_map().
Referenced by build_corner_to_face_map(), and mesh_normals_corner_custom_set().
| GroupedSpan< int > blender::bke::mesh::build_edge_to_corner_map | ( | Span< int > | corner_edges, |
| int | edges_num, | ||
| Array< int > & | r_offsets, | ||
| Array< int > & | r_indices ) |
Definition at line 441 of file mesh_mapping.cc.
References build_edge_to_corner_map(), and gather_groups().
Referenced by build_edge_to_corner_map(), and blender::nodes::node_geo_mesh_topology_corners_of_edge_cc::CornersOfEdgeInput::get_varray_for_context().
|
static |
Builds a simplified map from edges to face corners, marking special values when it encounters sharp edges or borders between faces with flipped winding orders.
Definition at line 720 of file mesh_normals.cc.
References INDEX_INVALID, INDEX_UNSET, IS_EDGE_SHARP, and blender::Span< T >::is_empty().
Referenced by normals_calc_corners().
| GroupedSpan< int > blender::bke::mesh::build_edge_to_face_map | ( | OffsetIndices< int > | faces, |
| Span< int > | corner_edges, | ||
| int | edges_num, | ||
| Array< int > & | r_offsets, | ||
| Array< int > & | r_indices ) |
Definition at line 449 of file mesh_mapping.cc.
References build_edge_to_face_map(), create_reverse_offsets(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), and reverse_group_indices_in_groups().
Referenced by build_edge_to_face_map(), blender::nodes::node_geo_input_mesh_face_neighbors_cc::construct_neighbor_count_varray(), face_edge_loop_islands_calc(), blender::ed::sculpt_paint::expand::geodesic_falloff_create(), and blender::nodes::node_geo_edges_to_face_groups_cc::FaceSetFromBoundariesInput::get_varray_for_context().
| Array< int > blender::bke::mesh::build_vert_to_corner_indices | ( | Span< int > | corner_verts, |
| OffsetIndices< int > | offsets ) |
Definition at line 427 of file mesh_mapping.cc.
References build_vert_to_corner_indices(), and reverse_indices_in_groups().
Referenced by build_vert_to_corner_indices().
| GroupedSpan< int > blender::bke::mesh::build_vert_to_corner_map | ( | Span< int > | corner_verts, |
| int | verts_num, | ||
| Array< int > & | r_offsets, | ||
| Array< int > & | r_indices ) |
Definition at line 433 of file mesh_mapping.cc.
References build_vert_to_corner_map(), and gather_groups().
Referenced by build_vert_to_corner_map().
| GroupedSpan< int > blender::bke::mesh::build_vert_to_edge_map | ( | Span< int2 > | edges, |
| int | verts_num, | ||
| Array< int > & | r_offsets, | ||
| Array< int > & | r_indices ) |
Definition at line 383 of file mesh_mapping.cc.
References atomic_fetch_and_add_int32(), BLI_SCOPED_DEFER, build_vert_to_edge_map(), create_reverse_offsets(), int, MEM_freeN(), range, blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), blender::offset_indices::OffsetIndices< T >::size(), sort_small_groups(), and blender::offset_indices::OffsetIndices< T >::total_size().
Referenced by base_skin(), blender::nodes::node_geo_blur_attribute_cc::build_edge_to_edge_by_vert_map(), build_vert_to_edge_map(), blender::nodes::node_geo_blur_attribute_cc::build_vert_to_vert_by_edge_map(), blender::draw::DRW_subdivide_loose_geom(), blender::ed::sculpt_paint::expand::geodesic_falloff_create(), blender::nodes::node_geo_mesh_topology_edges_of_vertex_cc::EdgesOfVertInput::get_varray_for_context(), blender::bke::subdiv::subdiv_to_mesh(), and blender::ed::object::vgroup_smooth_subset().
| void blender::bke::mesh::build_vert_to_face_indices | ( | OffsetIndices< int > | faces, |
| Span< int > | corner_verts, | ||
| OffsetIndices< int > | offsets, | ||
| MutableSpan< int > | face_indices ) |
Definition at line 407 of file mesh_mapping.cc.
References build_vert_to_face_indices(), and reverse_group_indices_in_groups().
Referenced by build_vert_to_face_indices(), and build_vert_to_face_map().
| GroupedSpan< int > blender::bke::mesh::build_vert_to_face_map | ( | OffsetIndices< int > | faces, |
| Span< int > | corner_verts, | ||
| int | verts_num, | ||
| Array< int > & | r_offsets, | ||
| Array< int > & | r_indices ) |
Definition at line 415 of file mesh_mapping.cc.
References build_vert_to_face_indices(), build_vert_to_face_map(), create_reverse_offsets(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), and blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize().
Referenced by build_vert_to_face_map().
|
static |
Definition at line 390 of file mesh_normals.cc.
References beta(), BLI_assert, blender::math::cross(), blender::math::dot(), fabsf, float, blender::Span< T >::is_empty(), LIKELY, LNOR_SPACE_TRIGO_THRESHOLD, M_PI, blender::math::normalize(), blender::math::safe_acos_approx(), blender::Span< T >::size(), and UNLIKELY.
Referenced by lnor_space_for_single_fan(), and split_corner_normal_fan_do().
|
static |
Definition at line 798 of file mesh_normals.cc.
References BLI_assert, ELEM, face_corner_next(), and face_corner_prev().
Referenced by corner_split_generator_check_cyclic_smooth_fan(), and split_corner_normal_fan_do().
|
static |
Definition at line 506 of file mesh_normals.cc.
References beta(), cosf, float, M_PI, madd_v3_v3fl(), mul_v3_v3fl(), blender::bke::mesh::CornerNormalSpace::ref_alpha, blender::bke::mesh::CornerNormalSpace::ref_beta, sinf, unit_short_to_float(), blender::bke::mesh::CornerNormalSpace::vec_lnor, blender::bke::mesh::CornerNormalSpace::vec_ortho, and blender::bke::mesh::CornerNormalSpace::vec_ref.
Referenced by lnor_space_for_single_fan(), and split_corner_normal_fan_do().
| short2 blender::bke::mesh::corner_space_custom_normal_to_data | ( | const CornerNormalSpace & | lnor_space, |
| const float3 & | custom_lnor ) |
Definition at line 558 of file mesh_normals.cc.
References beta(), compare_v3v3(), blender::math::dot(), float, is_zero_v3(), LNOR_SPACE_TRIGO_THRESHOLD, M_PI, blender::math::normalize(), blender::bke::mesh::CornerNormalSpace::ref_alpha, blender::bke::mesh::CornerNormalSpace::ref_beta, blender::math::safe_acos_approx(), unit_float_to_short(), blender::bke::mesh::CornerNormalSpace::vec_lnor, blender::bke::mesh::CornerNormalSpace::vec_ortho, and blender::bke::mesh::CornerNormalSpace::vec_ref.
Referenced by BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), and mesh_normals_corner_custom_set().
|
static |
Definition at line 1085 of file mesh_normals.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_edges, corner_split_generator_check_cyclic_smooth_fan(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_to_face, blender::bke::mesh::CornerSplitTaskDataCommon::corner_verts, blender::bke::mesh::CornerSplitTaskDataCommon::edge_to_corners, face_corner_prev(), blender::bke::mesh::CornerSplitTaskDataCommon::faces, IS_EDGE_SHARP, printf, SCOPED_TIMER_AVERAGED, and blender::Span< T >::size().
Referenced by normals_calc_corners().
|
static |
Check whether given corner is part of an unknown-so-far cyclic smooth fan, or not. Needed because cyclic smooth fans have no obvious 'entry point', and yet we need to walk them once, and only once.
Definition at line 1027 of file mesh_normals.cc.
References BLI_assert, corner_manifold_fan_around_vert_next(), and IS_EDGE_SHARP.
Referenced by corner_split_generator().
| int3 blender::bke::mesh::corner_tri_get_real_edges | ( | Span< int2 > | edges, |
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| const int3 & | corner_tri ) |
Return the triangle's three edge indices they are real edges, otherwise -1.
Definition at line 245 of file mesh_tessellate.cc.
References int.
Referenced by blender::bke::shrinkwrap::shrinkwrap_build_boundary_data().
| void blender::bke::mesh::corner_tris_calc | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| MutableSpan< int3 > | corner_tris ) |
Definition at line 206 of file mesh_tessellate.cc.
References corner_tris_calc(), and corner_tris_calc_impl().
Referenced by blender::ed::object::bake_targets_populate_pixels_color_attributes(), corner_tris_calc(), blender::render::texturemargin::generate_margin(), heat_bone_weighting(), Freestyle::BlenderFileLoader::insertShapeNode(), mesh_calc_tri_tessface(), mesh_faces_to_scratch(), and RE_bake_pixels_populate().
| void blender::bke::mesh::corner_tris_calc_face_indices | ( | OffsetIndices< int > | faces, |
| MutableSpan< int > | tri_faces ) |
Definition at line 214 of file mesh_tessellate.cc.
References corner_tris_calc_face_indices().
Referenced by corner_tris_calc_face_indices(), and blender::render::texturemargin::generate_margin().
|
static |
Definition at line 164 of file mesh_tessellate.cc.
References blender::Span< T >::is_empty(), and blender::threading::parallel_for().
Referenced by corner_tris_calc(), and corner_tris_calc_with_normals().
| void blender::bke::mesh::corner_tris_calc_with_normals | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< float3 > | face_normals, | ||
| MutableSpan< int3 > | corner_tris ) |
A version of corner_tris_calc which takes pre-calculated face normals (used to avoid having to calculate the face normal for NGON tessellation).
Definition at line 226 of file mesh_tessellate.cc.
References BLI_assert, corner_tris_calc_impl(), corner_tris_calc_with_normals(), and blender::Span< T >::is_empty().
Referenced by corner_tris_calc_with_normals(), and mesh_calc_tri_tessface().
|
static |
Definition at line 301 of file mesh_mapping.cc.
References blender::offset_indices::build_reverse_offsets().
Referenced by build_edge_to_face_map(), build_vert_to_edge_map(), build_vert_to_face_map(), and gather_groups().
Return the index of the edge's vertex that is not the vert.
Definition at line 307 of file BKE_mesh.hh.
References BLI_assert, and ELEM.
Referenced by BKE_mesh_remap_calc_edges_from_mesh(), build_edge_mats(), build_emats_stack(), blender::nodes::node_geo_blur_attribute_cc::build_vert_to_vert_by_edge_map(), collect_hull_frames(), blender::bke::subdiv::find_loose_edge_interpolation_positions(), lnor_space_for_single_fan(), MeshFairingContext::other_vertex_index_from_loop(), and split_corner_normal_fan_do().
| void blender::bke::mesh::edges_sharp_from_angle_set | ( | OffsetIndices< int > | faces, |
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| Span< float3 > | face_normals, | ||
| Span< int > | corner_to_face, | ||
| Span< bool > | sharp_faces, | ||
| const float | split_angle, | ||
| MutableSpan< bool > | sharp_edges ) |
Define sharp edges as needed to mimic 'autosmooth' from angle threshold.
Used when defining an empty custom corner normals data layer, to keep same shading as with auto-smooth!
| sharp_faces | Optional array used to mark specific faces for sharp shading. |
Definition at line 769 of file mesh_normals.cc.
References M_PI, mesh_edges_sharp_tag(), and blender::MutableSpan< T >::size().
Referenced by blender::bke::mesh_sharp_edges_set_from_angle().
| void blender::bke::mesh::face_angles_calc | ( | Span< float3 > | vert_positions, |
| Span< int > | face_verts, | ||
| MutableSpan< float > | angles ) |
Calculate the angles at each of the faces corners.
Definition at line 208 of file mesh_evaluate.cc.
References angle_normalized_v3v3(), copy_v3_v3(), normalize_v3(), blender::Span< T >::size(), and sub_v3_v3v3().
Referenced by wn_corner_angle(), and wn_face_with_angle().
Calculate the surface area of the face described by the indexed vertices.
Definition at line 74 of file mesh_evaluate.cc.
References area_poly_v3(), area_tri_v3(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), blender::Span< T >::index_range(), and blender::Span< T >::size().
Referenced by BKE_mesh_calc_area(), blender::nodes::node_geo_input_mesh_face_area_cc::construct_face_area_varray(), wn_face_area(), and wn_face_with_angle().
|
static |
Definition at line 177 of file mesh_evaluate.cc.
References area_tri_signed_v3(), copy_v3_v3(), face_normal_calc(), madd_v3_v3fl(), mid_v3_v3v3v3(), mul_v3_fl(), blender::Span< T >::size(), v2, and zero_v3().
Referenced by BKE_mesh_center_of_surface().
| float3 blender::bke::mesh::face_center_calc | ( | Span< float3 > | vert_positions, |
| Span< int > | face_verts ) |
Calculate the average position of the vertices in the face.
Definition at line 52 of file mesh_evaluate.cc.
References face_center_calc_ngon(), mid_v3_v3v3v3(), mid_v3_v3v3v3v3(), and blender::Span< T >::size().
Referenced by BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), blender::bke::calc_face_centers(), blender::nodes::node_geo_input_mesh_edge_angle_cc::SignedAngleFieldInput::get_varray_for_context(), and mesh_island_to_astar_graph_edge_process().
|
static |
Definition at line 41 of file mesh_evaluate.cc.
References float, blender::Span< T >::index_range(), blender::Span< T >::size(), and w().
Referenced by face_center_calc().
|
inline |
Find the index of the next corner in the face, looping to the start if necessary. The indices are into the entire corners array, not just the face's corners.
Definition at line 252 of file BKE_mesh.hh.
Referenced by adjacent_vertices_index_from_adjacent_edge(), blender::ed::sculpt_paint::hide::affect_visibility_mesh(), corner_manifold_fan_around_vert_next(), blender::geometry::corner_on_edge_connected_to_vert(), blender::draw::edge_from_corners(), blender::draw::extract_edituv_lines_mesh(), blender::draw::extract_edituv_lines_subdiv_bm(), blender::draw::extract_edituv_lines_subdiv_mesh(), face_find_adjacent_verts(), blender::draw::statvis_calc_distort(), and blender::draw::statvis_calc_sharp().
|
inline |
Find the index of the previous corner in the face, looping to the end if necessary. The indices are into the entire corners array, not just the face's corners.
Definition at line 243 of file BKE_mesh.hh.
Referenced by blender::bke::calc_edges::add_face_edges_to_hash_maps(), adjacent_vertices_index_from_adjacent_edge(), blender::ed::sculpt_paint::hide::affect_visibility_mesh(), blender::geometry::calc_corner_groups_for_vertex(), corner_manifold_fan_around_vert_next(), corner_split_generator(), face_find_adjacent_verts(), lnor_space_for_single_fan(), mesh_normals_corner_custom_set(), split_corner_normal_fan_do(), and blender::draw::statvis_calc_distort().
|
inline |
Return the vertex indices on either side of the given vertex, ordered based on the winding direction of the face. The vertex must be in the face.
Definition at line 275 of file BKE_mesh.hh.
References face_corner_next(), face_corner_prev(), and face_find_corner_from_vert().
Referenced by blender::ed::sculpt_paint::vert_neighbors_get_mesh().
|
inline |
Find the index of the corner in the face that uses the given vertex. The index is into the entire corners array, not just the face's corners.
Definition at line 264 of file BKE_mesh.hh.
References blender::Span< T >::first_index(), and blender::Span< T >::slice().
Referenced by adjacent_vertices_index_from_adjacent_edge(), blender::ed::sculpt_paint::color::color_vert_get(), do_vpaint_brush_blur_loops(), do_vpaint_brush_smear(), face_find_adjacent_verts(), and vpaint_do_draw().
| float3 blender::bke::mesh::face_normal_calc | ( | Span< float3 > | vert_positions, |
| Span< int > | face_verts ) |
Calculate the up direction for the face, depending on its winding direction.
Definition at line 108 of file mesh_normals.cc.
References BLI_assert, BLI_ASSERT_UNIT_V3, blender::math::is_zero(), normal_calc_ngon(), normal_quad_v3(), blender::math::normal_tri(), blender::Span< T >::size(), and UNLIKELY.
Referenced by GeometryExporter::create_normals(), face_area_centroid_calc(), blender::io::obj::fixup_invalid_face(), blender::nodes::node_geo_input_mesh_edge_angle_cc::AngleFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_mesh_edge_angle_cc::SignedAngleFieldInput::get_varray_for_context(), mesh_calc_tri_tessface(), blender::bke::mesh_init_origspace(), multires_reshape_apply_base_refit_base_mesh(), blender::bke::pbvh::normals_calc_faces(), and uvprojectModifier_do().
Return the number of triangles needed to tessellate a face with face_size corners.
Definition at line 287 of file BKE_mesh.hh.
References BLI_assert.
Referenced by BKE_mesh_origindex_map_create_corner_tri(), corner_tris_no_hidden_map_get(), blender::draw::pbvh::create_tri_index_mesh(), face_triangles_range(), and blender::ed::sculpt_paint::trim::generate_geometry().
|
inline |
Return the range of triangles that belong to the given face.
Definition at line 296 of file BKE_mesh.hh.
References face_triangles_num(), and blender::IndexRange::start().
Referenced by blender::draw::calc_adjacency_mesh(), blender::draw::pbvh::create_tri_index_mesh(), blender::bke::pbvh::pixels::do_encode_pixels(), blender::draw::extract_edituv_tris_mesh(), blender::bke::pbvh::node_raycast_mesh(), and blender::bke::pbvh::pbvh_faces_node_nearest_to_ray().
|
static |
Definition at line 366 of file mesh_mapping.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), create_reverse_offsets(), gather_groups(), and reverse_indices_in_groups().
Referenced by build_edge_to_corner_map(), build_vert_to_corner_map(), and gather_groups().
|
static |
Definition at line 836 of file mesh_normals.cc.
References blender::bke::mesh::CornerSplitTaskDataCommon::clnors_data, blender::bke::mesh::CornerSplitTaskDataCommon::corner_edges, corner_fan_space_define(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_normals, corner_space_custom_data_to_normal(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_to_face, blender::bke::mesh::CornerSplitTaskDataCommon::corner_verts, edge_other_vert(), blender::bke::mesh::CornerSplitTaskDataCommon::edges, face_corner_prev(), blender::bke::mesh::CornerSplitTaskDataCommon::face_normals, blender::bke::mesh::CornerSplitTaskDataCommon::faces, blender::Span< T >::is_empty(), blender::bke::mesh::CornerSplitTaskDataCommon::lnors_spacearr, blender::math::normalize(), and blender::bke::mesh::CornerSplitTaskDataCommon::positions.
|
static |
A version of mesh_calc_face_volume_centroid that takes an initial reference center, use this to increase numeric stability as the quality of the result becomes very low quality as the value moves away from 0.0, see: #65986.
Definition at line 147 of file mesh_evaluate.cc.
References copy_v3_v3(), blender::Span< T >::size(), sub_v3_v3v3(), volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().
Referenced by BKE_mesh_center_of_volume().
|
static |
Definition at line 130 of file mesh_tessellate.cc.
References mesh_calc_tessellation_for_face_impl().
| BLI_INLINE void blender::bke::mesh::mesh_calc_tessellation_for_face_impl | ( | const Span< int > | corner_verts, |
| const Span< float3 > | positions, | ||
| const int | face_start, | ||
| const int | face_size, | ||
| int3 * | tri, | ||
| MemArena ** | pf_arena_p, | ||
| const bool | face_normal, | ||
| const float | normal_precalc[3] ) |
| face_normal | This will be optimized out as a constant. |
Definition at line 38 of file mesh_tessellate.cc.
References add_newell_cross_v3_v3v3(), axis_dominant_v3_to_m3_negate(), BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_polyfill_calc_arena(), float, is_quad_flip_v3_first_third_fast(), mul_v2_m3v3(), normalize_v3(), UNLIKELY, and zero_v3().
Referenced by mesh_calc_tessellation_for_face(), and mesh_calc_tessellation_for_face_with_normal().
|
static |
Definition at line 141 of file mesh_tessellate.cc.
References mesh_calc_tessellation_for_face_impl().
|
static |
Definition at line 649 of file mesh_normals.cc.
References cosf, blender::math::dot(), INDEX_INVALID, INDEX_UNSET, IS_EDGE_SHARP, and blender::Span< T >::is_empty().
Referenced by edges_sharp_from_angle_set().
|
static |
Compute internal representation of given custom normals (as an array of float[2]). It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed to get a same custom lnor for all corners sharing the same smooth fan. If use_vertices if true, r_custom_corner_normals is assumed to be per-vertex, not per-corner (this allows to set whole vert's normals at once, useful in some cases). r_custom_corner_normals is expected to have normalized normals, or zero ones, in which case they will be replaced by default corner/vertex normal.
Definition at line 1273 of file mesh_normals.cc.
References build_corner_to_face_map(), copy_v3_v3(), corner_space_custom_normal_to_data(), blender::bke::mesh::CornerNormalSpaceArray::corner_space_indices, blender::bke::mesh::CornerNormalSpaceArray::corners_by_space, blender::bke::mesh::CornerNormalSpaceArray::create_corners_by_space, blender::MutableSpan< T >::data(), dot_v3v3(), face_corner_prev(), blender::bits::BitVector< InlineBufferCapacity, Allocator >::fill(), blender::MutableSpan< T >::fill_indices(), G, G_DEBUG, blender::Span< T >::index_range(), blender::Span< T >::is_empty(), is_zero_v3(), blender::IndexRange::last(), blender::Span< T >::last(), LNOR_SPACE_TRIGO_THRESHOLD, mesh_normals_corner_custom_set(), mul_v3_fl(), nor, normals_calc_corners(), printf, blender::Span< T >::size(), and blender::bke::mesh::CornerNormalSpaceArray::spaces.
Referenced by mesh_normals_corner_custom_set(), mesh_set_custom_normals(), normals_corner_custom_set(), and normals_corner_custom_set_from_verts().
|
static |
Definition at line 1530 of file mesh_normals.cc.
References CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, CustomData_add_layer(), CustomData_get_layer_for_write(), blender::bke::SpanAttributeWriter< T >::finish(), mesh_normals_corner_custom_set(), mesh_set_custom_normals(), and blender::bke::SpanAttributeWriter< T >::span.
Referenced by BKE_mesh_set_custom_normals(), BKE_mesh_set_custom_normals_from_verts(), BKE_mesh_set_custom_normals_from_verts_normalized(), BKE_mesh_set_custom_normals_normalized(), and mesh_set_custom_normals().
|
static |
Definition at line 88 of file mesh_normals.cc.
References add_newell_cross_v3_v3v3(), blender::Span< T >::index_range(), blender::Span< T >::last(), normalize_v3(), and UNLIKELY.
Referenced by face_normal_calc().
| void blender::bke::mesh::normals_calc_corners | ( | Span< float3 > | vert_positions, |
| Span< int2 > | edges, | ||
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| Span< int > | corner_to_face_map, | ||
| Span< float3 > | vert_normals, | ||
| Span< float3 > | face_normals, | ||
| Span< bool > | sharp_edges, | ||
| Span< bool > | sharp_faces, | ||
| const short2 * | clnors_data, | ||
| CornerNormalSpaceArray * | r_lnors_spacearr, | ||
| MutableSpan< float3 > | r_corner_normals ) |
Compute split normals, i.e. vertex normals associated with each face. Used to visualize sharp edges (or non-smooth faces) without actually modifying the geometry (splitting edges).
| sharp_edges | Optional array of sharp edge tags, used to split the evaluated normals on each side of the edge. |
| sharp_faces | Optional array of sharp face tags, used to split the evaluated normals on the face's edges. |
| r_lnors_spacearr | Optional return data filled with information about the custom normals spaces for each grouped fan of face corners. |
Mapping edge -> corners. If that edge is used by more than two corners (faces), it is always sharp (and tagged as such, see below). We also use the second corner index as a kind of flag:
Note that currently we only have two values for second corner of sharp edges. However, if needed, we can store the negated value of corner index instead of INDEX_INVALID to retrieve the real value later in code). Note also that loose edges always have both values set to 0!
Mapping edge -> corners. If that edge is used by more than two corners (faces), it is always sharp (and tagged as such, see below). We also use the second corner index as a kind of flag:
Note that currently we only have two values for second corner of sharp edges. However, if needed, we can store the negated value of corner index instead of INDEX_INVALID to retrieve the real value later in code). Note also that loose edges always have both values set to 0!
Definition at line 1166 of file mesh_normals.cc.
References build_edge_to_corner_map_with_flip_and_sharp(), blender::bke::mesh::CornerSplitTaskDataCommon::clnors_data, blender::bke::mesh::CornerSplitTaskDataCommon::corner_edges, blender::bke::mesh::CornerSplitTaskDataCommon::corner_normals, blender::bke::mesh::CornerNormalSpaceArray::corner_space_indices, corner_split_generator(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_to_face, blender::bke::mesh::CornerSplitTaskDataCommon::corner_verts, blender::bke::mesh::CornerNormalSpaceArray::corners_by_space, blender::bke::mesh::CornerNormalSpaceArray::create_corners_by_space, blender::bke::mesh::CornerSplitTaskDataCommon::edge_to_corners, blender::bke::mesh::CornerSplitTaskDataCommon::edges, blender::bke::mesh::CornerSplitTaskDataCommon::face_normals, blender::bke::mesh::CornerSplitTaskDataCommon::faces, faces, blender::array_utils::gather(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::bke::mesh::CornerSplitTaskDataCommon::lnors_spacearr, blender::threading::parallel_for(), blender::bke::mesh::CornerSplitTaskDataCommon::positions, SCOPED_TIMER_AVERAGED, blender::Span< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::bke::mesh::CornerNormalSpaceArray::spaces, and blender::bke::mesh::CornerSplitTaskDataCommon::vert_normals.
Referenced by apply_weights_vertex_normal(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), mesh_normals_corner_custom_set(), and normalEditModifier_do().
| void blender::bke::mesh::normals_calc_faces | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| MutableSpan< float3 > | face_normals ) |
Calculate face normals directly into a result array.
Definition at line 145 of file mesh_normals.cc.
References BLI_assert, blender::threading::parallel_for(), and blender::MutableSpan< T >::size().
| void blender::bke::mesh::normals_calc_verts | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| GroupedSpan< int > | vert_to_face_map, | ||
| Span< float3 > | face_normals, | ||
| MutableSpan< float3 > | vert_normals ) |
Calculate vertex normals directly into the result array.
Definition at line 158 of file mesh_normals.cc.
References normals_calc_verts().
Referenced by normals_calc_verts().
| void blender::bke::mesh::normals_corner_custom_set | ( | Span< float3 > | vert_positions, |
| Span< int2 > | edges, | ||
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| Span< float3 > | vert_normals, | ||
| Span< float3 > | face_normals, | ||
| Span< bool > | sharp_faces, | ||
| MutableSpan< bool > | sharp_edges, | ||
| MutableSpan< float3 > | r_custom_corner_normals, | ||
| MutableSpan< short2 > | r_clnors_data ) |
| sharp_faces | Optional array used to mark specific faces for sharp shading. |
Definition at line 1478 of file mesh_normals.cc.
References mesh_normals_corner_custom_set(), and normals_corner_custom_set().
Referenced by apply_weights_vertex_normal(), data_transfer_dtdata_type_postprocess(), and normals_corner_custom_set().
| void blender::bke::mesh::normals_corner_custom_set_from_verts | ( | Span< float3 > | vert_positions, |
| Span< int2 > | edges, | ||
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| Span< float3 > | vert_normals, | ||
| Span< float3 > | face_normals, | ||
| Span< bool > | sharp_faces, | ||
| MutableSpan< bool > | sharp_edges, | ||
| MutableSpan< float3 > | r_custom_vert_normals, | ||
| MutableSpan< short2 > | r_clnors_data ) |
| sharp_faces | Optional array used to mark specific faces for sharp shading. |
Definition at line 1504 of file mesh_normals.cc.
References mesh_normals_corner_custom_set(), and normals_corner_custom_set_from_verts().
Referenced by apply_weights_vertex_normal(), and normals_corner_custom_set_from_verts().
|
static |
Definition at line 348 of file mesh_mapping.cc.
References atomic_fetch_and_add_int32(), BLI_SCOPED_DEFER, int, MEM_freeN(), range, reverse_group_indices_in_groups(), blender::offset_indices::OffsetIndices< T >::size(), blender::Span< T >::slice(), and sort_small_groups().
Referenced by build_edge_to_face_map(), build_vert_to_face_indices(), and reverse_group_indices_in_groups().
|
static |
Definition at line 320 of file mesh_mapping.cc.
References blender::Span< T >::begin(), BLI_assert, BLI_SCOPED_DEFER, blender::Span< T >::end(), blender::Span< T >::index_range(), blender::Span< T >::is_empty(), MEM_freeN(), reverse_indices_in_groups(), blender::offset_indices::OffsetIndices< T >::size(), and blender::Span< T >::size().
Referenced by build_vert_to_corner_indices(), gather_groups(), and reverse_indices_in_groups().
|
static |
Definition at line 308 of file mesh_mapping.cc.
References blender::threading::parallel_for().
Referenced by build_vert_to_edge_map(), and reverse_group_indices_in_groups().
|
static |
Definition at line 879 of file mesh_normals.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), blender::bke::mesh::CornerSplitTaskDataCommon::clnors_data, blender::bke::mesh::CornerSplitTaskDataCommon::corner_edges, corner_fan_space_define(), corner_manifold_fan_around_vert_next(), blender::bke::mesh::CornerSplitTaskDataCommon::corner_normals, corner_space_custom_data_to_normal(), blender::bke::mesh::CornerNormalSpaceArray::corner_space_indices, blender::bke::mesh::CornerSplitTaskDataCommon::corner_to_face, blender::bke::mesh::CornerSplitTaskDataCommon::corner_verts, blender::bke::mesh::CornerNormalSpaceArray::corners_by_space, blender::math::dot(), edge_other_vert(), blender::bke::mesh::CornerSplitTaskDataCommon::edge_to_corners, blender::bke::mesh::CornerSplitTaskDataCommon::edges, face_corner_prev(), blender::bke::mesh::CornerSplitTaskDataCommon::face_normals, blender::bke::mesh::CornerSplitTaskDataCommon::faces, blender::MutableSpan< T >::fill_indices(), IS_EDGE_SHARP, blender::Span< T >::is_empty(), length(), LIKELY, blender::bke::mesh::CornerSplitTaskDataCommon::lnors_spacearr, blender::math::normalize(), blender::math::normalize_and_get_length(), blender::bke::mesh::CornerSplitTaskDataCommon::positions, blender::math::safe_acos_approx(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::bke::mesh::CornerNormalSpaceArray::spaces, and UNLIKELY.
| void blender::bke::mesh::vert_tris_from_corner_tris | ( | Span< int > | corner_verts, |
| Span< int3 > | corner_tris, | ||
| MutableSpan< int3 > | vert_tris ) |
Convert triangles encoded as face corner indices to triangles encoded as vertex indices.
Definition at line 238 of file mesh_tessellate.cc.
References blender::MutableSpan< T >::cast(), blender::Span< T >::cast(), and vert_tris_from_corner_tris().
Referenced by cloth_from_mesh(), blender::io::hydra::copy_submesh(), deform_verts(), blender::bke::pbvh::pixels::update_geom_primitives(), and vert_tris_from_corner_tris().