|
Blender V5.3
|
Classes | |
| struct | CornerNormalSpace |
| struct | CornerNormalSpaceArray |
| struct | CornerSpaceGroup |
| struct | EdgeOneCorner |
| struct | EdgeSharp |
| struct | EdgeTwoCorners |
| struct | LocalData |
| struct | MeshToTangentQuadsTris |
| class | NormalJoinInfo |
| struct | SGLSLMeshToTangent |
| struct | VertCornerInfo |
Typedefs | |
| using | EdgeUninitialized = std::monostate |
| using | VertEdgeInfo = std::variant<EdgeUninitialized, EdgeOneCorner, EdgeTwoCorners, EdgeSharp> |
| using | LocalEdgeVectorSet |
Functions | |
| 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) |
| bool | is_uv_map (const AttributeMetaData &meta_data) |
| bool | is_uv_map (const std::optional< AttributeMetaData > &meta_data) |
| bool | is_color_attribute (const AttributeMetaData &meta_data) |
| bool | is_color_attribute (const std::optional< AttributeMetaData > &meta_data) |
| 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) |
| void | calc_uv_tangent_tris_quads (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, Span< float3 > corner_normals, Span< float2 > uv_map, MutableSpan< float4 > results, ReportList *reports) |
| bool | is_color_attribute (const std::optional< bke::AttributeMetaData > &meta_data) |
| 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 | mix_normals_corner_to_vert (const Span< float3 > vert_positions, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face_map, const Span< float3 > corner_normals, MutableSpan< float3 > vert_normals) |
| static void | mix_normals_vert_to_face (const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< float3 > vert_normals, MutableSpan< float3 > face_normals) |
| static void | mix_normals_corner_to_face (const OffsetIndices< int > faces, const Span< float3 > corner_normals, MutableSpan< float3 > face_normals) |
| 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 | collect_corner_info (const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > vert_faces, const int vert, MutableSpan< VertCornerInfo > r_corner_infos) |
| static void | add_corner_to_edge (const Span< int > corner_edges, const Span< bool > sharp_edges, const int local_corner, const int corner, const int other_corner, const bool winding_torwards_vert, VertEdgeInfo &info) |
| static void | calc_local_edge_indices (MutableSpan< VertCornerInfo > corner_infos, LocalEdgeVectorSet &r_other_vert_to_edge) |
| static void | calc_connecting_edge_info (const Span< int > corner_edges, const Span< bool > sharp_edges, const Span< bool > sharp_faces, const Span< VertCornerInfo > corner_infos, MutableSpan< VertEdgeInfo > edge_infos) |
| static void | traverse_fan_local_corners (const Span< VertCornerInfo > corner_infos, const Span< VertEdgeInfo > edge_infos, const int start_local_corner, Vector< int, 16 > &result_fan) |
| static void | calc_edge_directions (const Span< float3 > vert_positions, const Span< int > local_edge_by_vert, const float3 &vert_position, MutableSpan< float3 > edge_dirs) |
| static float3 | accumulate_fan_normal (const Span< VertCornerInfo > corner_infos, const Span< float3 > edge_dirs, const Span< float3 > face_normals, const Span< int > local_corners_in_fan) |
| static BLI_NOINLINE void | handle_fan_result_and_custom_normals (const Span< short2 > custom_normals, const Span< VertCornerInfo > corner_infos, const Span< float3 > edge_dirs, const Span< int > local_corners_in_fan, float3 &fan_normal, CornerNormalSpaceArray *r_fan_spaces, Vector< CornerSpaceGroup, 0 > *r_local_space_groups) |
| static void | mesh_normals_corner_custom_set (const Span< float3 > positions, const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > corner_edges, const GroupedSpan< int > vert_to_face_map, 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, MutableSpan< float3 > r_custom_nors, const bool use_vertices) |
| static bke::AttrDomain | normal_domain_to_domain (bke::MeshNormalDomain domain) |
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, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, GroupedSpan< int > vert_to_face_map, Span< float3 > face_normals, Span< bool > sharp_edges, Span< bool > sharp_faces, Span< short2 > custom_normals, CornerNormalSpaceArray *r_fan_spaces, MutableSpan< float3 > r_corner_normals) |
| void | normals_corner_custom_set (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, GroupedSpan< int > vert_to_face_map, 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, OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, GroupedSpan< int > vert_to_face_map, 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) |
| bool | is_corner_fan_normals (const AttributeMetaData &meta_data) |
Mesh Tangent Calculations (All Layers) | |
| Array< Array< float4 > > | calc_uv_tangents (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, Span< int3 > corner_tris, Span< int > corner_tri_faces, Span< bool > sharp_faces, Span< float3 > vert_normals, Span< float3 > face_normals, Span< float3 > corner_normals, Span< Span< float2 > > uv_maps) |
| Array< float4 > | calc_orco_tangents (Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, Span< int3 > corner_tris, Span< int > corner_tri_faces, Span< bool > sharp_faces, Span< float3 > vert_normals, Span< float3 > face_normals, Span< float3 > corner_normals, Span< float3 > vert_orco) |
| static void | calc_face_as_quad_map (const OffsetIndices< int > faces, const Span< int3 > corner_tris, const Span< int > corner_tri_faces, int &num_face_as_quad_map, int *&face_as_quad_map) |
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) |
Variables | |
| constexpr AttributeMetaData | CORNER_FAN_META_DATA {AttrDomain::Corner, AttrType::Int16_2D} |
| using blender::bke::mesh::EdgeUninitialized = std::monostate |
The edge hasn't been handled yet while the edge info is being created.
Definition at line 968 of file mesh_normals.cc.
Use a custom VectorSet type to use int32 instead of int64 for the key indices.
Definition at line 1037 of file mesh_normals.cc.
| using blender::bke::mesh::VertEdgeInfo = std::variant<EdgeUninitialized, EdgeOneCorner, EdgeTwoCorners, EdgeSharp> |
Definition at line 996 of file mesh_normals.cc.
|
static |
The normal for all the corners in the fan is a weighted combination of their face normals.
Definition at line 1162 of file mesh_normals.cc.
References accumulate_fan_normal(), blender::math::dot(), blender::bke::mesh::VertCornerInfo::face, blender::Span< T >::first(), blender::bke::mesh::VertCornerInfo::local_edge_next, blender::bke::mesh::VertCornerInfo::local_edge_prev, blender::math::normalize(), blender::math::safe_acos_approx(), and blender::Span< T >::size().
Referenced by accumulate_fan_normal().
|
static |
Definition at line 998 of file mesh_normals.cc.
References add_corner_to_edge(), and blender::Span< T >::is_empty().
Referenced by add_corner_to_edge(), and calc_connecting_edge_info().
| Array< int > blender::bke::mesh::build_corner_to_face_map | ( | OffsetIndices< int > | faces | ) |
Definition at line 271 of file mesh_mapping.cc.
References build_corner_to_face_map(), blender::offset_indices::build_reverse_map(), and blender::offset_indices::OffsetIndices< T >::total_size().
Referenced by build_corner_to_face_map(), blender::geometry::ExtendableMesh::ExtendableMesh(), 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 330 of file mesh_mapping.cc.
References build_edge_to_corner_map(), and blender::offset_indices::build_groups_from_indices().
Referenced by build_edge_to_corner_map(), blender::nodes::node_geo_mesh_topology_corners_of_edge_cc::CornersOfEdgeInput::get_varray_for_context(), and blender::geometry::split_edges().
| 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 338 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 blender::offset_indices::reverse_indices_in_groups().
Referenced by blender::BKE_mesh_remap_calc_loops_from_mesh(), build_edge_to_face_map(), blender::nodes::node_geo_blur_attribute_cc::build_face_to_face_by_edge_map(), blender::nodes::node_geo_input_mesh_face_neighbors_cc::construct_neighbor_count_varray(), blender::geometry::ExtendableMesh::ExtendableMesh(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::face_edge_loop_islands_calc(), blender::ed::sculpt_paint::expand::geodesic_falloff_create(), blender::nodes::node_geo_edges_to_face_groups_cc::FaceSetFromBoundariesInput::get_varray_for_context(), blender::ed::sculpt_paint::face_set::init_flood_fill(), blender::mesh_calc_islands_loop_face_uv(), blender::bke::pbvh::uv_islands::mesh_data_init_topology(), blender::paintface_select_loop(), blender::paintvert_select_less(), blender::paintvert_select_loop(), and blender::paintvert_select_more().
| Array< int > blender::bke::mesh::build_vert_to_corner_indices | ( | Span< int > | corner_verts, |
| OffsetIndices< int > | offsets ) |
Definition at line 314 of file mesh_mapping.cc.
References build_vert_to_corner_indices(), blender::offset_indices::reverse_indices_in_groups(), and blender::offset_indices::OffsetIndices< T >::total_size().
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 322 of file mesh_mapping.cc.
References blender::offset_indices::build_groups_from_indices(), and build_vert_to_corner_map().
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 278 of file mesh_mapping.cc.
References build_vert_to_edge_map(), blender::Span< T >::cast(), create_reverse_offsets(), blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), blender::offset_indices::reverse_indices_in_groups(), and blender::offset_indices::OffsetIndices< T >::total_size().
Referenced by blender::base_skin(), blender::BKE_mesh_remap_calc_edges_from_mesh(), blender::nodes::node_geo_blur_attribute_cc::build_edge_to_edge_by_vert_map(), build_vert_to_edge_map(), blender::nodes::node_geo_extrude_mesh_cc::build_vert_to_edge_map(), blender::nodes::node_geo_blur_attribute_cc::build_vert_to_vert_by_edge_map(), blender::bke::compare_geometry::construct_vert_mapping(), blender::draw::DRW_subdivide_loose_geom(), blender::geometry::ExtendableMesh::ExtendableMesh(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_vertices(), blender::ed::sculpt_paint::expand::geodesic_falloff_create(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsCostFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsNextVertFieldInput::get_varray_for_context(), blender::nodes::node_geo_mesh_topology_edges_of_vertex_cc::EdgesOfVertInput::get_varray_for_context(), blender::ed::object::modifier_skin_armature_create(), blender::paintvert_select_loop(), blender::geometry::split_edges(), 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 294 of file mesh_mapping.cc.
References build_vert_to_face_indices(), and blender::offset_indices::reverse_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 302 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(), and blender::face_edge_loop_islands_calc().
|
static |
Definition at line 1060 of file mesh_normals.cc.
References add_corner_to_edge(), calc_connecting_edge_info(), blender::bke::mesh::VertCornerInfo::corner, blender::bke::mesh::VertCornerInfo::corner_next, blender::bke::mesh::VertCornerInfo::corner_prev, blender::bke::mesh::VertCornerInfo::face, blender::Span< T >::index_range(), blender::Span< T >::is_empty(), blender::bke::mesh::VertCornerInfo::local_edge_next, and blender::bke::mesh::VertCornerInfo::local_edge_prev.
Referenced by calc_connecting_edge_info().
|
static |
The edge directions are used to compute factors for the face normals from each corner. Since they involve a normalization it's worth it to compute them once, especially since we've deduplicated the edge indices and can easily index them with VertCornerInfo.
Definition at line 1151 of file mesh_normals.cc.
References calc_edge_directions(), blender::Span< T >::index_range(), and blender::math::normalize().
Referenced by calc_edge_directions().
|
static |
Definition at line 267 of file mesh_tangent.cc.
References calc_face_as_quad_map(), blender::MEM_new_array_uninitialized(), blender::offset_indices::OffsetIndices< T >::size(), and blender::Span< T >::size().
Referenced by calc_face_as_quad_map(), calc_orco_tangents(), and calc_uv_tangents().
|
static |
Create a local indexing for the edges connected to the vertex (not including loose edges of course). We could look up the edge indices from the VectorSet as necessary later, but it should be better to just use a bit more space in VertCornerInfo to simplify things instead.
Definition at line 1050 of file mesh_normals.cc.
References calc_local_edge_indices(), blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_or_add(), blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), and blender::MutableSpan< T >::size().
Referenced by calc_local_edge_indices().
| Array< float4 > blender::bke::mesh::calc_orco_tangents | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int3 > | corner_tris, | ||
| Span< int > | corner_tri_faces, | ||
| Span< bool > | sharp_faces, | ||
| Span< float3 > | vert_normals, | ||
| Span< float3 > | face_normals, | ||
| Span< float3 > | corner_normals, | ||
| Span< float3 > | vert_orco ) |
Definition at line 350 of file mesh_tangent.cc.
References calc_face_as_quad_map(), calc_orco_tangents(), blender::bke::mesh::SGLSLMeshToTangent::corner_normals, blender::bke::mesh::SGLSLMeshToTangent::corner_tris, blender::bke::mesh::SGLSLMeshToTangent::corner_verts, blender::bke::mesh::SGLSLMeshToTangent::face_as_quad_map, blender::bke::mesh::SGLSLMeshToTangent::face_normals, blender::bke::mesh::SGLSLMeshToTangent::faces, blender::Span< T >::is_empty(), blender::bke::mesh::SGLSLMeshToTangent::num_face_as_quad_map, blender::bke::mesh::SGLSLMeshToTangent::orco, blender::bke::mesh::SGLSLMeshToTangent::positions, blender::bke::mesh::SGLSLMeshToTangent::sharp_faces, blender::Span< T >::size(), blender::bke::mesh::SGLSLMeshToTangent::tangents, blender::bke::mesh::SGLSLMeshToTangent::tri_faces, and blender::bke::mesh::SGLSLMeshToTangent::vert_normals.
Referenced by calc_orco_tangents(), and blender::draw::extract_tan_init_common().
| void blender::bke::mesh::calc_uv_tangent_tris_quads | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< float3 > | corner_normals, | ||
| Span< float2 > | uv_map, | ||
| MutableSpan< float4 > | results, | ||
| ReportList * | reports ) |
Compute simplified tangent space normals, i.e. tangent vector + sign of bi-tangent one, which combined with custom normals can be used to recreate the full tangent space.
Definition at line 77 of file mesh_tangent.cc.
References blender::BKE_report(), calc_uv_tangent_tris_quads(), blender::bke::mesh::MeshToTangentQuadsTris::corner_normals, blender::bke::mesh::MeshToTangentQuadsTris::corner_verts, blender::bke::mesh::MeshToTangentQuadsTris::faces, blender::offset_indices::OffsetIndices< T >::index_range(), blender::bke::mesh::MeshToTangentQuadsTris::positions, blender::RPT_ERROR, blender::bke::mesh::MeshToTangentQuadsTris::tangents, and blender::bke::mesh::MeshToTangentQuadsTris::uv_map.
Referenced by calc_uv_tangent_tris_quads().
| Array< Array< float4 > > blender::bke::mesh::calc_uv_tangents | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int3 > | corner_tris, | ||
| Span< int > | corner_tri_faces, | ||
| Span< bool > | sharp_faces, | ||
| Span< float3 > | vert_normals, | ||
| Span< float3 > | face_normals, | ||
| Span< float3 > | corner_normals, | ||
| Span< Span< float2 > > | uv_maps ) |
See: BKE_editmesh_uv_tangents_calc (matching logic).
Definition at line 298 of file mesh_tangent.cc.
References calc_face_as_quad_map(), calc_uv_tangents(), blender::Span< T >::is_empty(), and blender::threading::parallel_for().
Referenced by calc_uv_tangents(), blender::draw::extract_tan_init_common(), blender::nodes::node_geo_uv_tangent_cc::TangentFieldInput::get_varray_for_context(), and blender::mesh_calc_tri_tessface().
|
static |
Gather data related to all the connected faces / face corners. This makes accessing it simpler later on in the various per-vertex hot loops. It also means we can be sure it will be in CPU caches. Gathering it into a single Vector of an "info" struct rather than multiple vectors is expected to be worth it because there are typically very few connected corners; the overhead of a Vector for each piece of data would be significant.
Definition at line 950 of file mesh_normals.cc.
References collect_corner_info(), face_corner_next(), face_corner_prev(), face_find_corner_from_vert(), and blender::Span< T >::index_range().
Referenced by collect_corner_info().
|
static |
Definition at line 595 of file mesh_normals.cc.
References beta(), blender::BLI_assert(), corner_fan_space_define(), blender::math::cross(), blender::math::dot(), float, blender::Span< T >::is_empty(), 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(), blender::bke::mesh::CornerNormalSpace::vec_lnor, blender::bke::mesh::CornerNormalSpace::vec_ortho, and blender::bke::mesh::CornerNormalSpace::vec_ref.
Referenced by blender::BKE_lnor_space_define(), corner_fan_space_define(), and handle_fan_result_and_custom_normals().
|
static |
Definition at line 711 of file mesh_normals.cc.
References beta(), corner_space_custom_data_to_normal(), cosf, float, M_PI, blender::madd_v3_v3fl(), blender::mul_v3_v3fl(), blender::bke::mesh::CornerNormalSpace::ref_alpha, blender::bke::mesh::CornerNormalSpace::ref_beta, sinf, blender::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 blender::BKE_lnor_space_custom_data_to_normal(), corner_space_custom_data_to_normal(), and handle_fan_result_and_custom_normals().
| short2 blender::bke::mesh::corner_space_custom_normal_to_data | ( | const CornerNormalSpace & | lnor_space, |
| const float3 & | custom_lnor ) |
Definition at line 763 of file mesh_normals.cc.
References beta(), blender::compare_v3v3(), corner_space_custom_normal_to_data(), blender::math::dot(), float, blender::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(), blender::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 blender::BKE_lnor_space_custom_normal_to_data(), blender::BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), corner_space_custom_normal_to_data(), and mesh_normals_corner_custom_set().
| 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 if they are real edges, otherwise -1.
Definition at line 245 of file mesh_tessellate.cc.
References corner_tri_get_real_edges().
Referenced by corner_tri_get_real_edges(), blender::bke::pbvh::uv_islands::find_triangles_near_border(), blender::mesh_corner_tris_target_project(), blender::bke::pbvh::pixels::NonManifoldUVEdges::NonManifoldUVEdges(), and 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(), blender::heat_bone_weighting(), Freestyle::BlenderFileLoader::insertShapeNode(), blender::mesh_calc_tri_tessface(), blender::mesh_faces_to_scratch(), and blender::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(), blender::offset_indices::OffsetIndices< T >::index_range(), and blender::threading::parallel_for().
Referenced by corner_tris_calc_face_indices(), and blender::render::texturemargin::generate_margin().
|
static |
Definition at line 164 of file mesh_tessellate.cc.
References corner_tris_calc_impl(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::Span< T >::is_empty(), and blender::threading::parallel_for().
Referenced by corner_tris_calc(), corner_tris_calc_impl(), 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 blender::BLI_assert(), corner_tris_calc_impl(), corner_tris_calc_with_normals(), blender::offset_indices::OffsetIndices< T >::is_empty(), and blender::Span< T >::is_empty().
Referenced by corner_tris_calc_with_normals(), and blender::mesh_calc_tri_tessface().
|
static |
Definition at line 264 of file mesh_mapping.cc.
References blender::offset_indices::build_reverse_offsets(), and create_reverse_offsets().
Referenced by build_edge_to_face_map(), build_vert_to_edge_map(), build_vert_to_face_map(), and create_reverse_offsets().
|
inline |
Return the index of the edge's vertex that is not the vert.
Definition at line 370 of file BKE_mesh.hh.
References blender::BLI_assert(), edge_other_vert(), and ELEM.
Referenced by blender::BKE_mesh_remap_calc_edges_from_mesh(), blender::build_edge_mats(), blender::build_emats_stack(), blender::nodes::node_geo_blur_attribute_cc::build_vert_to_vert_by_edge_map(), blender::collect_hull_frames(), edge_other_vert(), blender::bke::subdiv::find_loose_edge_interpolation_positions(), blender::follow_edge_loop(), blender::MeshFairingContext::other_vertex_index_from_loop(), blender::ed::object::skin_armature_bone_create(), and traverse_fan_local_corners().
| 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 "auto-smooth" 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 903 of file mesh_normals.cc.
References edges_sharp_from_angle_set(), M_PI, mesh_edges_sharp_tag(), and blender::MutableSpan< T >::size().
Referenced by edges_sharp_from_angle_set(), and 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 201 of file mesh_evaluate.cc.
References blender::angle_normalized_v3v3(), blender::copy_v3_v3(), face_angles_calc(), blender::normalize_v3(), blender::Span< T >::size(), and blender::sub_v3_v3v3().
Referenced by face_angles_calc(), blender::wn_corner_angle(), and blender::wn_face_with_angle().
Calculate the surface area of the face described by the indexed vertices.
Definition at line 67 of file mesh_evaluate.cc.
References blender::area_poly_v3(), blender::area_tri_v3(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), face_area_calc(), blender::Span< T >::index_range(), and blender::Span< T >::size().
Referenced by blender::BKE_mesh_calc_area(), blender::nodes::node_geo_input_mesh_face_area_cc::construct_face_area_varray(), face_area_calc(), blender::wn_face_area(), and blender::wn_face_with_angle().
|
static |
Definition at line 170 of file mesh_evaluate.cc.
References blender::area_tri_signed_v3(), blender::copy_v3_v3(), face_area_centroid_calc(), face_normal_calc(), blender::madd_v3_v3fl(), blender::mid_v3_v3v3v3(), blender::mul_v3_fl(), blender::Span< T >::size(), blender::v2, and blender::zero_v3().
Referenced by blender::BKE_mesh_center_of_surface(), and face_area_centroid_calc().
| 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 45 of file mesh_evaluate.cc.
References face_center_calc(), face_center_calc_ngon(), blender::mid_v3_v3v3v3(), blender::mid_v3_v3v3v3v3(), and blender::Span< T >::size().
Referenced by blender::BKE_mesh_foreach_mapped_face_center(), blender::BKE_mesh_remap_calc_faces_from_mesh(), blender::BKE_mesh_remap_calc_loops_from_mesh(), blender::bke::calc_face_centers(), blender::ed::sculpt_paint::face_set::calc_face_centers(), face_center_calc(), blender::ed::sculpt_paint::face_set::gesture_apply_mesh(), blender::ed::transform::SnapData_Mesh::get_face_center(), blender::mesh_island_to_astar_graph_edge_process(), and blender::multires_subdivide_create_object_space_linear_grids().
|
static |
Definition at line 34 of file mesh_evaluate.cc.
References face_center_calc_ngon(), float, blender::Span< T >::index_range(), blender::Span< T >::size(), and w().
Referenced by face_center_calc(), and face_center_calc_ngon().
|
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 315 of file BKE_mesh.hh.
References face_corner_next(), blender::IndexRange::last(), and blender::IndexRange::start().
Referenced by blender::bke::adapt_mesh_domain_corner_to_edge_impl(), blender::bke::adapt_mesh_domain_corner_to_edge_impl(), blender::adjacent_vertices_index_from_adjacent_edge(), blender::ed::sculpt_paint::hide::affect_visibility_mesh(), blender::BKE_crazyspace_set_quats_mesh(), blender::BKE_sculpt_mask_layers_ensure(), collect_corner_info(), blender::geometry::corner_on_edge_connected_to_vert(), blender::geometry::edge_from_corner(), blender::draw::edge_from_corners(), blender::draw::extract_lines_paint_mask_subdiv(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), face_corner_next(), face_find_adjacent_verts(), blender::bke::pbvh::uv_islands::faces_have_shared_uv_edge(), blender::bke::find_faces_bad_edges(), blender::bke::find_faces_missing_edges(), blender::bke::subdiv::interpolate_corner_data_for_subdivided_irregular_face(), blender::bke::subdiv::interpolate_vert_data_for_subdivided_irregular_face(), 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 306 of file BKE_mesh.hh.
References face_corner_prev(), blender::IndexRange::size(), and blender::IndexRange::start().
Referenced by blender::bke::adapt_mesh_domain_edge_to_corner_impl(), blender::bke::calc_edges::add_face_edges_to_hash_maps(), blender::adjacent_vertices_index_from_adjacent_edge(), blender::ed::sculpt_paint::hide::affect_visibility_mesh(), blender::BKE_crazyspace_set_quats_mesh(), blender::BKE_sculpt_mask_layers_ensure(), blender::geometry::calc_corner_groups_for_vertex(), collect_corner_info(), face_corner_prev(), face_find_adjacent_verts(), blender::bke::subdiv::interpolate_corner_data_for_subdivided_irregular_face(), blender::bke::subdiv::interpolate_vert_data_for_subdivided_irregular_face(), mesh_normals_corner_custom_set(), 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 338 of file BKE_mesh.hh.
References face_corner_next(), face_corner_prev(), face_find_adjacent_verts(), and face_find_corner_from_vert().
Referenced by blender::MeshFairingContext::adjacents_coords_from_loop(), blender::ed::sculpt_paint::append_neighbors_to_vector(), face_find_adjacent_verts(), and 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 327 of file BKE_mesh.hh.
References face_find_corner_from_vert(), blender::Span< T >::first_index(), and blender::Span< T >::slice().
Referenced by blender::adjacent_vertices_index_from_adjacent_edge(), blender::calculate_average_color(), collect_corner_info(), blender::ed::sculpt_paint::color::color_vert_get(), blender::geometry::uv::UVMapInfo::contig_uv_maps_across_edge(), blender::do_vpaint_brush_blur_loops(), blender::do_vpaint_brush_smear(), face_find_adjacent_verts(), face_find_corner_from_vert(), and blender::ed::sculpt_paint::sample_mesh_attribute_color().
| 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 143 of file mesh_normals.cc.
References blender::BLI_assert(), BLI_ASSERT_UNIT_V3, face_normal_calc(), blender::math::is_zero(), normal_calc_ngon(), blender::normal_quad_v3(), blender::math::normal_tri(), and blender::Span< T >::size().
Referenced by blender::BKE_mesh_foreach_mapped_face_center(), blender::geometry::ngon::calc_corner_tris(), face_area_centroid_calc(), face_normal_calc(), blender::io::obj::fixup_invalid_face(), blender::ed::sculpt_paint::face_set::gesture_apply_mesh(), 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(), blender::mesh_calc_tri_tessface(), blender::bke::mesh_init_origspace(), blender::multires_reshape_apply_base_refit_base_mesh(), blender::bke::pbvh::normals_calc_faces(), and blender::uvprojectModifier_do().
|
inline |
Return the number of triangles needed to tessellate a face with face_size corners.
Definition at line 350 of file BKE_mesh.hh.
References blender::BLI_assert(), and face_triangles_num().
Referenced by blender::BKE_mesh_origindex_map_create_corner_tri(), blender::draw::calc_face_tri_starts_mesh(), blender::geometry::ngon::calc_tris_by_ngon(), blender::bke::create_tree_from_tris(), blender::draw::pbvh::create_tri_index_mesh(), face_triangles_num(), 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 359 of file BKE_mesh.hh.
References face_triangles_num(), face_triangles_range(), blender::IndexRange::IndexRange(), blender::IndexRange::size(), and blender::IndexRange::start().
Referenced by blender::draw::calc_adjacency_mesh(), create_mesh(), blender::bke::create_tree_from_tris(), blender::draw::pbvh::create_tri_index_mesh(), blender::bke::pbvh::pixels::do_encode_pixels(), face_triangles_range(), blender::bke::pbvh::uv_islands::Fan::Fan(), blender::bke::pbvh::uv_islands::find_fill_primitive(), blender::nodes::node_geo_input_mesh_edge_angle_cc::find_other_vert_of_edge_triangle(), blender::bke::pbvh::node_raycast_mesh(), and blender::bke::pbvh::pbvh_faces_node_nearest_to_ray().
|
static |
Don't inline this function to simplify the code path without custom normals.
Definition at line 1190 of file mesh_normals.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_unchecked(), BLI_NOINLINE, blender::bke::mesh::VertCornerInfo::corner, corner_fan_space_define(), corner_space_custom_data_to_normal(), blender::Span< T >::first(), handle_fan_result_and_custom_normals(), blender::Span< T >::index_range(), blender::Span< T >::is_empty(), blender::Span< T >::last(), blender::bke::mesh::VertCornerInfo::local_edge_next, blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), and blender::Span< T >::size().
Referenced by handle_fan_result_and_custom_normals().
| bool blender::bke::mesh::is_color_attribute | ( | const AttributeMetaData & | meta_data | ) |
Whether the meta-data refers to a color type on the point or corner domain.
Definition at line 1400 of file blenkernel/intern/mesh.cc.
References blender::bke::ColorByte, blender::bke::ColorFloat, blender::bke::Corner, blender::bke::AttributeMetaData::data_type, blender::bke::AttributeMetaData::domain, ELEM, is_color_attribute(), and blender::bke::Point.
Referenced by blender::ed::sculpt_paint::color::active_color_attribute(), blender::ed::sculpt_paint::color::active_color_attribute_for_write(), blender::ed::geometry::convert_attribute(), blender::fill_texpaint_slots_cb(), blender::ed::geometry::geometry_color_attribute_convert_poll(), blender::ed::geometry::geometry_color_attribute_set_render_exec(), is_color_attribute(), is_color_attribute(), is_color_attribute(), blender::bke::mesh_ensure_default_color_attribute_on_add(), blender::workbench::mesh_has_color_attribute(), blender::bke::mesh_remove_invalid_attribute_strings(), blender::ed::sculpt_paint::undo::save_active_attribute(), blender::ed::geometry::set_active_default_status_on_add(), blender::transfer_active_color_string(), and blender::transfer_default_color_string().
| bool blender::bke::mesh::is_color_attribute | ( | const std::optional< AttributeMetaData > & | meta_data | ) |
References is_color_attribute().
| bool blender::bke::mesh::is_color_attribute | ( | const std::optional< bke::AttributeMetaData > & | meta_data | ) |
Definition at line 1406 of file blenkernel/intern/mesh.cc.
References is_color_attribute().
| bool blender::bke::mesh::is_corner_fan_normals | ( | const AttributeMetaData & | meta_data | ) |
Return true if the type and domain represent the tangent-space custom normals storage.
Definition at line 1720 of file mesh_normals.cc.
References CORNER_FAN_META_DATA, and is_corner_fan_normals().
Referenced by is_corner_fan_normals(), blender::ed::mesh::join_normals(), and blender::geometry::preprocess_meshes().
| bool blender::bke::mesh::is_uv_map | ( | const AttributeMetaData & | meta_data | ) |
Whether the meta-data refers to a float2 type on the face corner domain.
Definition at line 1390 of file blenkernel/intern/mesh.cc.
References blender::bke::Corner, blender::bke::AttributeMetaData::data_type, blender::bke::AttributeMetaData::domain, blender::bke::Float2, and is_uv_map().
Referenced by blender::ed::object::bake(), blender::BKE_attribute_remove(), blender::ed::geometry::convert_attribute(), blender::nodes::node_geo_duplicate_elements_cc::copy_attributes_from_other_domains(), blender::draw::overlay::MeshUVs::edit_object_sync(), blender::has_uv_map_attribute(), blender::geometry::uv::UVMapInfo::init(), is_uv_map(), is_uv_map(), blender::bke::mesh_ensure_default_uv_attribute_on_add(), blender::workbench::mesh_has_uv_map_attribute(), blender::bke::mesh_remove_invalid_attribute_strings(), blender::draw::overlay::MeshUVs::object_sync(), blender::ed::geometry::set_active_default_status_on_add(), blender::transfer_active_uv_map_string(), and blender::transfer_default_uv_map_string().
| bool blender::bke::mesh::is_uv_map | ( | const std::optional< AttributeMetaData > & | meta_data | ) |
Definition at line 1395 of file blenkernel/intern/mesh.cc.
References is_uv_map().
|
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 140 of file mesh_evaluate.cc.
References blender::copy_v3_v3(), mesh_calc_face_volume_centroid_with_reference_center(), blender::Span< T >::size(), blender::sub_v3_v3v3(), blender::volume_tri_tetrahedron_signed_v3_6x(), and blender::zero_v3().
Referenced by blender::BKE_mesh_center_of_volume(), and mesh_calc_face_volume_centroid_with_reference_center().
|
static |
Definition at line 130 of file mesh_tessellate.cc.
References mesh_calc_tessellation_for_face(), and mesh_calc_tessellation_for_face_impl().
Referenced by mesh_calc_tessellation_for_face().
| 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 blender::add_newell_cross_v3_v3v3(), blender::axis_dominant_v3_to_m3_negate(), BLI_INLINE, blender::BLI_memarena_alloc(), blender::BLI_memarena_clear(), blender::BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, blender::BLI_polyfill_calc_arena(), float, blender::is_quad_flip_v3_first_third_fast(), mesh_calc_tessellation_for_face_impl(), blender::mul_v2_m3v3(), blender::normalize_v3(), and blender::zero_v3().
Referenced by mesh_calc_tessellation_for_face(), mesh_calc_tessellation_for_face_impl(), 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(), and mesh_calc_tessellation_for_face_with_normal().
Referenced by mesh_calc_tessellation_for_face_with_normal().
|
static |
Definition at line 836 of file mesh_normals.cc.
References cosf, blender::math::dot(), INDEX_INVALID, blender::offset_indices::OffsetIndices< T >::index_range(), INDEX_UNSET, IS_EDGE_SHARP, blender::Span< T >::is_empty(), and mesh_edges_sharp_tag().
Referenced by edges_sharp_from_angle_set(), and mesh_edges_sharp_tag().
|
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 1409 of file mesh_normals.cc.
References build_corner_to_face_map(), blender::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::dot_v3v3(), face_corner_prev(), blender::bits::BitVector< InlineBufferCapacity, Allocator >::fill(), blender::MutableSpan< T >::fill_indices(), blender::G, blender::G_DEBUG, blender::Span< T >::index_range(), blender::Span< T >::is_empty(), blender::is_zero_v3(), blender::IndexRange::last(), blender::Span< T >::last(), LNOR_SPACE_TRIGO_THRESHOLD, mesh_normals_corner_custom_set(), blender::mul_v3_fl(), normals_calc_corners(), blender::gpu::shader::metadata::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 1652 of file mesh_normals.cc.
References blender::bke::Corner, blender::bke::Edge, blender::bke::Face, blender::bke::SpanAttributeWriter< T >::finish(), blender::bke::AttributeAccessor::lookup(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span(), mesh_normals_corner_custom_set(), mesh_set_custom_normals(), and blender::bke::SpanAttributeWriter< T >::span.
Referenced by mesh_set_custom_normals(), blender::bke::mesh_set_custom_normals(), blender::bke::mesh_set_custom_normals_from_verts(), blender::bke::mesh_set_custom_normals_from_verts_normalized(), and blender::bke::mesh_set_custom_normals_normalized().
|
static |
Definition at line 280 of file mesh_normals.cc.
References blender::Default, blender::offset_indices::OffsetIndices< T >::index_range(), mix_normals_corner_to_face(), blender::threading::parallel_for(), and PRF_scope.
Referenced by mix_normals_corner_to_face().
|
static |
Definition at line 228 of file mesh_normals.cc.
References blender::Default, blender::Span< T >::index_range(), mix_normals_corner_to_vert(), blender::threading::parallel_for(), and PRF_scope.
Referenced by mix_normals_corner_to_vert().
|
static |
Definition at line 263 of file mesh_normals.cc.
References blender::Default, blender::offset_indices::OffsetIndices< T >::index_range(), mix_normals_vert_to_face(), blender::threading::parallel_for(), and PRF_scope.
Referenced by mix_normals_vert_to_face().
|
static |
Definition at line 123 of file mesh_normals.cc.
References blender::add_newell_cross_v3_v3v3(), blender::Span< T >::index_range(), blender::Span< T >::last(), normal_calc_ngon(), and blender::normalize_v3().
Referenced by face_normal_calc(), and normal_calc_ngon().
|
static |
Definition at line 1725 of file mesh_normals.cc.
References BLI_assert_unreachable, blender::bke::Corner, blender::bke::Face, normal_domain_to_domain(), and blender::bke::Point.
Referenced by blender::bke::mesh::NormalJoinInfo::add_no_custom_normals(), and normal_domain_to_domain().
| void blender::bke::mesh::normals_calc_corners | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| GroupedSpan< int > | vert_to_face_map, | ||
| Span< float3 > | face_normals, | ||
| Span< bool > | sharp_edges, | ||
| Span< bool > | sharp_faces, | ||
| Span< short2 > | custom_normals, | ||
| CornerNormalSpaceArray * | r_fan_spaces, | ||
| MutableSpan< float3 > | r_corner_normals ) |
Compute custom 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_fan_spaces | Optional return data filled with information about the custom normals spaces for each grouped fan of face corners. |
Definition at line 1239 of file mesh_normals.cc.
References blender::BLI_assert(), blender::Default, blender::Span< T >::index_range(), blender::Span< T >::is_empty(), normals_calc_corners(), blender::offset_indices::GroupedSpan< T >::offsets, blender::threading::parallel_for(), PRF_scope, blender::MutableSpan< T >::size(), blender::Span< T >::size(), and blender::OffsetIndices< T >::total_size().
Referenced by blender::apply_weights_vertex_normal(), attr_create_motion_corner_normals(), blender::BKE_keyblock_mesh_calc_normals(), blender::BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), mesh_normals_corner_custom_set(), blender::normalEditModifier_do(), and normals_calc_corners().
| 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 180 of file mesh_normals.cc.
References blender::BLI_assert(), blender::Default, blender::offset_indices::OffsetIndices< T >::index_range(), normals_calc_faces(), blender::threading::parallel_for(), PRF_scope, blender::MutableSpan< T >::size(), and blender::offset_indices::OffsetIndices< T >::size().
Referenced by attr_create_motion_corner_normals(), blender::BKE_keyblock_mesh_calc_normals(), normals_calc_faces(), and blender::bke::pbvh::update_normals_mesh().
| 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 194 of file mesh_normals.cc.
References blender::Default, blender::Span< T >::index_range(), normals_calc_verts(), blender::threading::parallel_for(), and PRF_scope.
Referenced by blender::BKE_keyblock_mesh_calc_normals(), normals_calc_verts(), and blender::bke::pbvh::update_normals_mesh().
| void blender::bke::mesh::normals_corner_custom_set | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| GroupedSpan< int > | vert_to_face_map, | ||
| 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 1600 of file mesh_normals.cc.
References mesh_normals_corner_custom_set(), and normals_corner_custom_set().
Referenced by blender::apply_weights_vertex_normal(), blender::data_transfer_dtdata_type_postprocess(), blender::normalEditModifier_do_directional(), blender::normalEditModifier_do_radial(), and normals_corner_custom_set().
| void blender::bke::mesh::normals_corner_custom_set_from_verts | ( | Span< float3 > | vert_positions, |
| OffsetIndices< int > | faces, | ||
| Span< int > | corner_verts, | ||
| Span< int > | corner_edges, | ||
| GroupedSpan< int > | vert_to_face_map, | ||
| 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 1626 of file mesh_normals.cc.
References mesh_normals_corner_custom_set(), and normals_corner_custom_set_from_verts().
Referenced by blender::apply_weights_vertex_normal(), and normals_corner_custom_set_from_verts().
|
static |
From a starting corner, follow the connected edges to find the other corners "fanning" around the vertex. Crucially, we've removed ambiguity from the process already by marking edges connected to three faces and edges between faces with opposite winding direction sharp.
Definition at line 1097 of file mesh_normals.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_mutable_span(), b, blender::Vector< T, InlineBufferCapacity, Allocator >::begin(), edge_other_vert(), blender::Vector< T, InlineBufferCapacity, Allocator >::end(), and traverse_fan_local_corners().
Referenced by traverse_fan_local_corners().
| 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(), blender::array_utils::gather(), and vert_tris_from_corner_tris().
Referenced by blender::cloth_from_mesh(), blender::io::hydra::copy_submesh(), create_mesh(), blender::deform_verts(), and vert_tris_from_corner_tris().
|
constexpr |
Definition at line 1718 of file mesh_normals.cc.
Referenced by blender::bke::mesh::NormalJoinInfo::add_mesh(), and is_corner_fan_normals().