Blender V5.0
blender::bke::pbvh::MeshNode Struct Reference

#include <BKE_paint_bvh.hh>

Inherits blender::bke::pbvh::Node.

Public Types

using LocalVertMapIndexT = int16_t
using LocalVertMap
Public Types inherited from blender::bke::pbvh::Node
enum  Flags : uint32_t {
  None = 0 , Leaf = 1 << 0 , FullyHidden = 1 << 10 , FullyMasked = 1 << 11 ,
  FullyUnmasked = 1 << 12 , UpdateTopology = 1 << 13 , RebuildPixels = 1 << 15 , TexLeaf = 1 << 16 ,
  TopologyUpdated = 1 << 17
}

Public Member Functions

Span< int > faces () const
Span< int > verts () const
Span< int > all_verts () const
int corners_num () const
Public Member Functions inherited from blender::bke::pbvh::Node
std::optional< int > parent () const
const Bounds< float3 > & bounds () const
const Bounds< float3 > & bounds_orig () const

Public Attributes

Span< int > face_indices_
LocalVertMap vert_indices_
int unique_verts_num_ = 0
int corners_num_
Public Attributes inherited from blender::bke::pbvh::Node
int parent_ = -1
Bounds< float3bounds_ = {}
Bounds< float3bounds_orig_ = {}
int children_offset_ = 0
Flags flag_ = None
float tmin_ = 0.0f
int debug_draw_gen_ = 0
pixels::NodeDatapixels_ = nullptr

Detailed Description

Definition at line 120 of file BKE_paint_bvh.hh.

Member Typedef Documentation

◆ LocalVertMap

Initial value:

Global vertices are mapped to local indices with a vector set, with a specialized type in order to use 32 bit integers for slot values. .

Definition at line 130 of file BKE_paint_bvh.hh.

◆ LocalVertMapIndexT

Use a 16 bit integer for the slot index type because there will always be less than leaf_limit vertices in a node.

Definition at line 125 of file BKE_paint_bvh.hh.

Member Function Documentation

◆ all_verts()

Span< int > blender::bke::pbvh::MeshNode::all_verts ( ) const
inline

Return all vertices used by faces in this node. The same as verts(), with the shared vertices added at the end of the array.

Definition at line 663 of file BKE_paint_bvh.hh.

References vert_indices_.

Referenced by blender::ed::sculpt_paint::undo::fill_node_data_mesh(), blender::bke::pbvh::node_update_mask_mesh(), blender::bke::pbvh::node_update_visibility_mesh(), and blender::bke::pbvh::update_node_bounds_mesh().

◆ corners_num()

int blender::bke::pbvh::MeshNode::corners_num ( ) const
inline

The number of corners in all of the node's faces.

Definition at line 667 of file BKE_paint_bvh.hh.

References corners_num_.

Referenced by blender::draw::pbvh::create_tri_index_mesh().

◆ faces()

◆ verts()

Span< int > blender::bke::pbvh::MeshNode::verts ( ) const
inline

Return the "unique" vertices owned by the node, excluding vertices owned by other nodes.

Definition at line 659 of file BKE_paint_bvh.hh.

References unique_verts_num_, and vert_indices_.

Referenced by blender::ed::sculpt_paint::cloth::apply_filter_forces_mesh(), blender::ed::sculpt_paint::mask::apply_mask_mesh(), blender::ed::sculpt_paint::project::apply_projection_mesh(), blender::ed::sculpt_paint::calc_area_normal_and_center_node_mesh(), blender::ed::sculpt_paint::boundary::calc_bend_mesh(), blender::ed::sculpt_paint::brushes::calc_faces(), blender::ed::sculpt_paint::calc_factors_common_from_orig_data_mesh(), blender::ed::sculpt_paint::calc_factors_common_mesh(), blender::ed::sculpt_paint::calc_factors_common_mesh_indexed(), blender::ed::sculpt_paint::calc_factors_common_mesh_indexed(), blender::ed::sculpt_paint::cloth::calc_forces_mesh(), blender::ed::sculpt_paint::boundary::calc_grab_mesh(), blender::ed::sculpt_paint::boundary::calc_inflate_mesh(), blender::ed::sculpt_paint::pose::calc_mesh(), blender::ed::sculpt_paint::boundary::calc_slide_mesh(), blender::ed::sculpt_paint::boundary::calc_smooth_mesh(), blender::ed::sculpt_paint::boundary::calc_twist_mesh(), blender::ed::sculpt_paint::color::color_filter_task(), blender::ed::sculpt_paint::expand::colors_update_task(), blender::ed::sculpt_paint::color::do_color_smooth_task(), blender::ed::sculpt_paint::color::do_paint_brush_task(), blender::ed::sculpt_paint::color::do_sample_wet_paint_task(), blender::ed::sculpt_paint::color::do_smear_brush_task(), blender::ed::sculpt_paint::elastic_transform_node_mesh(), blender::ed::sculpt_paint::fake_neighbor_search_mesh(), blender::ed::sculpt_paint::undo::fill_node_data_mesh(), blender::ed::sculpt_paint::mask::get_hidden_verts(), blender::ed::sculpt_paint::mask::grow_mask_mesh(), blender::ed::sculpt_paint::hide::node_visible_verts(), blender::ed::sculpt_paint::orig_position_data_lookup_mesh(), blender::ed::sculpt_paint::brushes::sample_node_surface_mesh(), blender::ed::sculpt_paint::mask::sharpen_mask_mesh(), blender::ed::sculpt_paint::mask::shrink_mask_mesh(), blender::ed::sculpt_paint::mask::smooth_mask_mesh(), blender::ed::sculpt_paint::undo::store_color(), and blender::ed::sculpt_paint::transform_node_mesh().

Member Data Documentation

◆ corners_num_

int blender::bke::pbvh::MeshNode::corners_num_

The number of corners in all of the node's referenced faces. This value can easily be recalculated but currently it's faster to avoid that and store it here.

Definition at line 165 of file BKE_paint_bvh.hh.

Referenced by corners_num().

◆ face_indices_

Span<int> blender::bke::pbvh::MeshNode::face_indices_

Indices into the #Mesh::faces() array. Refers to a subset of Tree::prim_indices_.

Definition at line 139 of file BKE_paint_bvh.hh.

Referenced by blender::bke::pbvh::build_nodes_recursive_mesh(), and faces().

◆ unique_verts_num_

int blender::bke::pbvh::MeshNode::unique_verts_num_ = 0

The number of vertices in #vert_indices not shared with (owned by) another node.

Definition at line 160 of file BKE_paint_bvh.hh.

Referenced by blender::bke::pbvh::update_normals_mesh(), and verts().

◆ vert_indices_

LocalVertMap blender::bke::pbvh::MeshNode::vert_indices_

Array of indices into the mesh's vertex array. Contains the indices of all vertices used by faces that are within this node's bounding box. Also contains a mapping from global vertex index to indices within only the node.

Vertices might be used by a multiple faces, and these faces might be in different leaf nodes. Such vertices will appear in the vertex indices array of each of those leaf nodes.

In order to support accessing to multiple nodes' vertices without duplication, the array is ordered such that the first part of the array, up to index unique_verts_num_, contains "unique" vertex indices. These vertices might not be truly unique to this node, but if they appear in another node's vertex indices, they will not be in the first "unique" section.

Used for leaf nodes. Accessed with verts() and all_verts().

Todo
Find a way to disable the VectorSet inline buffer.

Definition at line 158 of file BKE_paint_bvh.hh.

Referenced by all_verts(), blender::bke::pbvh::node_raycast_mesh(), blender::bke::pbvh::pbvh_faces_node_nearest_to_ray(), blender::bke::pbvh::update_normals_mesh(), and verts().


The documentation for this struct was generated from the following file: