Blender V5.3
blender::bke::pbvh::pixels Namespace Reference

Classes

struct  BorderTriangle
struct  BuildPixelRow
struct  CopyPixelCommand
struct  CopyPixelGroup
struct  CopyPixelTile
struct  CopyPixelTiles
struct  DeltaCopyPixelCommand
struct  Edge
class  NonManifoldTileEdges
class  NonManifoldUVEdges
struct  PackedPixelRow
struct  PixelData
struct  PixelNode
class  PixelNodesTileData
struct  Rows
struct  UDIMTilePixels
struct  Vertex

Enumerations

enum class  CoordSpace { UV , Tile }

Functions

void mark_image_dirty (bke::pbvh::Node &node, PixelNode &pixel_node, Map< image::TileNumber, ImBuf * > &buffers)
PixelData & data_get (bke::pbvh::Tree &pbvh)
void collect_dirty_tiles (PixelNode &pixel_node, Vector< image::TileNumber > &r_dirty_tiles)
void copy_pixels (bke::pbvh::Tree &pbvh, Map< image::TileNumber, ImBuf * > &buffers, image::TileNumber tile_number, Span< uint8_t > seam_tiles_modified, FunctionRef< void(int x_start, int x_end, int y)> push_undo_tiles)
static float3x3 calc_pixel_to_position_map (const uv_islands::MeshData &mesh_data, const int tri, const float2 uvs[3], const float inv_w, const float inv_h)
static void extract_barycentric_pixels (Vector< BuildPixelRow > &build_rows, const ImBuf *image_buffer, const uv_islands::UVIslandsMask::Tile &mask_tile, const int uv_island_index, const int uv_primitive_index, const float2 uvs[3])
static GroupedSpan< BorderTriangle > build_border_triangles (const uv_islands::MeshData &mesh_data, const int64_t geom_primitive_len, MutableSpan< uv_islands::UVIsland > uv_islands, Array< int > &r_offsets, Array< BorderTriangle > &r_data)
static void build_pixel_row_runs (Vector< BuildPixelRow > &build_rows, UDIMTilePixels &tile_data)
template<typename Fn>
void foreach_uv_triangle (const uv_islands::MeshData &mesh_data, const GroupedSpan< BorderTriangle > border_tris, const int tri, Fn &&fn)
static void do_encode_pixels (const uv_islands::MeshData &mesh_data, const uv_islands::UVIslandsMask &uv_masks, const GroupedSpan< BorderTriangle > border_tris, Image &image, const ImageUser &image_user, MeshNode &node, PixelNode &pixel_node)
static IndexMask find_nodes_to_update (Tree &pbvh, IndexMaskMemory &memory)
static void apply_watertight_check (Tree &pbvh, Image &image, const ImageUser &image_user)
static bool update_pixels (const Depsgraph &depsgraph, const Object &object, Tree &pbvh, Image &image, const ImageUser &image_user)
static rcti get_bounds (const Edge< CoordSpace::Tile > &tile_edge)
static void add_margin (rcti &bounds, int margin)
static void clamp (rcti &bounds, int2 resolution)
static Vertex< CoordSpace::Tile > convert_coord_space (const Vertex< CoordSpace::UV > &uv_vertex, const image::ImageTileWrapper image_tile, const int2 tile_resolution)
static Edge< CoordSpace::Tile > convert_coord_space (const Edge< CoordSpace::UV > &uv_edge, const image::ImageTileWrapper image_tile, const int2 tile_resolution)
static DeltaCopyPixelCommand encode_delta (const CopyPixelCommand &previous, const CopyPixelCommand &next)
static bool can_be_extended (const CopyPixelCommand &previous, const CopyPixelCommand &next)
static int64_t pixel_offset (const int width, const int2 coordinate)
static float4 read_pixel (const float *buffer, const int width, const int2 coordinate)
static void write_pixel (float *buffer, const int width, const int2 coordinate, const float4 &value)
static float4 read_pixel (const uint8_t *buffer, const int width, const int2 coordinate)
static void write_pixel (uint8_t *buffer, const int width, const int2 coordinate, const float4 &value)
template<typename T>
static void copy_pixels (T *buffer, const int width, const Span< CopyPixelGroup > groups, const Span< DeltaCopyPixelCommand > command_deltas)
void copy_update (bke::pbvh::Tree &pbvh, Image &image, const ImageUser &image_user, const uv_islands::MeshData &mesh_data)

Variables

constexpr bool USE_WATERTIGHT_CHECK = false
const int THREADING_GRAIN_SIZE = 128
Fix non-manifold edge bleeding.
constexpr int SEAM_TILE_BITS = 6
constexpr int SEAM_TILE_SIZE = 1 << SEAM_TILE_BITS

Enumeration Type Documentation

◆ CoordSpace

Coordinate space of a coordinate.

Enumerator
UV 

Coordinate is in UV coordinate space. As in unmodified from mesh data.

Tile 

Coordinate is in Tile coordinate space.

With tile coordinate space each unit is a single pixel of the tile. Range is [0..buffer width].

Definition at line 38 of file pbvh_pixels_copy.cc.

Function Documentation

◆ add_margin()

void blender::bke::pbvh::pixels::add_margin ( rcti & bounds,
int margin )
static

◆ apply_watertight_check()

◆ build_border_triangles()

◆ build_pixel_row_runs()

◆ calc_pixel_to_position_map()

float3x3 blender::bke::pbvh::pixels::calc_pixel_to_position_map ( const uv_islands::MeshData & mesh_data,
const int tri,
const float2 uvs[3],
const float inv_w,
const float inv_h )
static

◆ can_be_extended()

bool blender::bke::pbvh::pixels::can_be_extended ( const CopyPixelCommand & previous,
const CopyPixelCommand & next )
static

◆ clamp()

void blender::bke::pbvh::pixels::clamp ( rcti & bounds,
int2 resolution )
static

◆ collect_dirty_tiles()

void blender::bke::pbvh::pixels::collect_dirty_tiles ( PixelNode & pixel_node,
Vector< image::TileNumber > & r_dirty_tiles )

◆ convert_coord_space() [1/2]

Edge< CoordSpace::Tile > blender::bke::pbvh::pixels::convert_coord_space ( const Edge< CoordSpace::UV > & uv_edge,
const image::ImageTileWrapper image_tile,
const int2 tile_resolution )
static

◆ convert_coord_space() [2/2]

◆ copy_pixels() [1/2]

◆ copy_pixels() [2/2]

template<typename T>
void blender::bke::pbvh::pixels::copy_pixels ( T * buffer,
const int width,
const Span< CopyPixelGroup > groups,
const Span< DeltaCopyPixelCommand > command_deltas )
static

◆ copy_update()

◆ data_get()

PixelData & blender::bke::pbvh::pixels::data_get ( bke::pbvh::Tree & pbvh)

Definition at line 576 of file pbvh_pixels.cc.

References blender::BLI_assert(), blender::data, and data_get().

Referenced by copy_pixels(), copy_update(), and data_get().

◆ do_encode_pixels()

void blender::bke::pbvh::pixels::do_encode_pixels ( const uv_islands::MeshData & mesh_data,
const uv_islands::UVIslandsMask & uv_masks,
const GroupedSpan< BorderTriangle > border_tris,
Image & image,
const ImageUser & image_user,
MeshNode & node,
PixelNode & pixel_node )
static

Definition at line 254 of file pbvh_pixels.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_non_duplicates(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), blender::BKE_image_acquire_ibuf(), blender::BKE_image_release_ibuf(), blender::BLI_assert(), blender::BLI_listbase_count(), build_pixel_row_runs(), calc_pixel_to_position_map(), blender::math::clamp(), blender::Vector< T, InlineBufferCapacity, Allocator >::contains(), do_encode_pixels(), blender::Editor, extract_barycentric_pixels(), blender::bke::mesh::face_triangles_range(), blender::bke::pbvh::uv_islands::MeshData::faces, blender::bke::pbvh::uv_islands::UVIslandsMask::find_tile(), blender::bke::pbvh::pixels::PixelNode::flags, blender::math::floor(), FLT_MAX, foreach_uv_triangle(), blender::bke::image::ImageTileWrapper::get_tile_number(), blender::bke::image::ImageTileWrapper::get_tile_offset(), INT_MAX, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::math::max(), blender::math::min(), blender::math::min_max(), node, PRF_scope, blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::ImageUser::tile, tile, blender::bke::pbvh::pixels::UDIMTilePixels::tile_number, blender::bke::pbvh::pixels::PixelNode::tiles, blender::bke::pbvh::pixels::PixelNode::uv_primitives, blender::ImBuf::x, and blender::ImBuf::y.

Referenced by do_encode_pixels(), and update_pixels().

◆ encode_delta()

◆ extract_barycentric_pixels()

◆ find_nodes_to_update()

IndexMask blender::bke::pbvh::pixels::find_nodes_to_update ( Tree & pbvh,
IndexMaskMemory & memory )
static

Find the nodes that needs to be updated.

The nodes that require updated are added to the r_nodes_to_update parameter. Will fill in r_visited_polygons with polygons that are owned by nodes that do not require updates.

returns if there were any nodes found (true).

Definition at line 388 of file pbvh_pixels.cc.

References blender::bke::pbvh::all_leaf_nodes(), find_nodes_to_update(), blender::index_mask::IndexMask::foreach_index(), blender::IndexMask::from_predicate(), blender::index_mask::IndexMask::is_empty(), and blender::bke::pbvh::pixels::PixelData::nodes.

Referenced by find_nodes_to_update(), and update_pixels().

◆ foreach_uv_triangle()

template<typename Fn>
void blender::bke::pbvh::pixels::foreach_uv_triangle ( const uv_islands::MeshData & mesh_data,
const GroupedSpan< BorderTriangle > border_tris,
const int tri,
Fn && fn )
inline

Iterate over all UV triangles, both original triangles and new ones added by border extension. Provides UVs and island index.

Definition at line 238 of file pbvh_pixels.cc.

References blender::bke::pbvh::uv_islands::MeshData::corner_tris, foreach_uv_triangle(), blender::bke::pbvh::uv_islands::MeshData::uv_island_ids, and blender::bke::pbvh::uv_islands::MeshData::uv_map.

Referenced by do_encode_pixels(), and foreach_uv_triangle().

◆ get_bounds()

◆ mark_image_dirty()

◆ pixel_offset()

int64_t blender::bke::pbvh::pixels::pixel_offset ( const int width,
const int2 coordinate )
static

Definition at line 535 of file pbvh_pixels_copy.cc.

References pixel_offset().

Referenced by pixel_offset(), read_pixel(), read_pixel(), write_pixel(), and write_pixel().

◆ read_pixel() [1/2]

float4 blender::bke::pbvh::pixels::read_pixel ( const float * buffer,
const int width,
const int2 coordinate )
static

Definition at line 540 of file pbvh_pixels_copy.cc.

References pixel_offset(), and read_pixel().

Referenced by copy_pixels(), read_pixel(), and read_pixel().

◆ read_pixel() [2/2]

float4 blender::bke::pbvh::pixels::read_pixel ( const uint8_t * buffer,
const int width,
const int2 coordinate )
static

◆ update_pixels()

◆ write_pixel() [1/2]

void blender::bke::pbvh::pixels::write_pixel ( float * buffer,
const int width,
const int2 coordinate,
const float4 & value )
static

Definition at line 545 of file pbvh_pixels_copy.cc.

References pixel_offset(), and write_pixel().

Referenced by copy_pixels(), write_pixel(), and write_pixel().

◆ write_pixel() [2/2]

void blender::bke::pbvh::pixels::write_pixel ( uint8_t * buffer,
const int width,
const int2 coordinate,
const float4 & value )
static

Variable Documentation

◆ SEAM_TILE_BITS

int blender::bke::pbvh::pixels::SEAM_TILE_BITS = 6
constexpr

Each UDIM tile is split into smaller (64x64) seam tiles for which we can do seam bleeding. These are tagged as modified during painting, and only the modified subset will be processed.

Definition at line 163 of file BKE_paint_bvh_pixels.hh.

Referenced by blender::bke::pbvh::pixels::CopyPixelTile::build_seam_tile_map(), blender::ed::sculpt_paint::image::do_paint_pixels(), blender::ed::sculpt_paint::image::mark_seam_tiles_modified(), blender::bke::pbvh::pixels::Rows::pack_into(), and blender::bke::pbvh::pixels::CopyPixelTile::seam_tile_index().

◆ SEAM_TILE_SIZE

◆ THREADING_GRAIN_SIZE

const int blender::bke::pbvh::pixels::THREADING_GRAIN_SIZE = 128

◆ USE_WATERTIGHT_CHECK

bool blender::bke::pbvh::pixels::USE_WATERTIGHT_CHECK = false
constexpr

During debugging this check could be enabled. It will write to each image pixel that is covered by the Tree.

Definition at line 85 of file pbvh_pixels.cc.

Referenced by update_pixels().