28 array_utils::gather(mr.vert_positions, mr.corner_verts, corners_data);
29 extract_mesh_loose_edge_data(mr.vert_positions, mr.edges, mr.loose_edges, loose_edge_data);
30 array_utils::gather(mr.vert_positions, mr.loose_verts, loose_vert_data);
42 for (const int face_index : range) {
43 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
44 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
45 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
46 const int index = BM_elem_index_get(loop);
47 corners_data[index] = bm_vert_co_get(mr, loop->v);
53 const Span<int> loose_edges = mr.loose_edges;
55 for (const int i : range) {
56 const BMEdge &edge = *BM_edge_at_index(&const_cast<BMesh &>(bm), loose_edges[i]);
57 loose_edge_data[i * 2 + 0] = bm_vert_co_get(mr, edge.v1);
58 loose_edge_data[i * 2 + 1] = bm_vert_co_get(mr, edge.v2);
62 const Span<int> loose_verts = mr.loose_verts;
64 for (const int i : range) {
65 const BMVert &vert = *BM_vert_at_index(&const_cast<BMesh &>(bm), loose_verts[i]);
66 loose_vert_data[i] = bm_vert_co_get(mr, &vert);
74 "pos", gpu::VertAttrType::SFLOAT_32_32_32);
95 if (loose_verts.
is_empty() && loose_edges_num == 0) {
102 const int resolution = subdiv_cache.
resolution;
111 const int edge_offset = loose_geom_start +
i * verts_per_edge;
113 for (
const int edge :
IndexRange(edges_per_edge)) {
114 edge_data[0] = positions[edge + 0];
115 edge_data[1] = positions[edge + 1];
117 &vbo, (edge_offset + edge * 2) *
sizeof(
float3),
sizeof(
float3) * 2, &edge_data);
121 const int loose_verts_start = loose_geom_start + loose_edges_num * verts_per_edge;
125 (loose_verts_start +
i) *
sizeof(
float3),
127 &positions[loose_verts[
i]]);
136 "pos", gpu::VertAttrType::SFLOAT_32_32_32);
151 "orco", gpu::VertAttrType::SFLOAT_32_32_32_32);
blender::gpu::VertBuf * GPU_vertbuf_create_on_device(const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_use(blender::gpu::VertBuf *)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_update_sub(blender::gpu::VertBuf *verts, uint start, uint len, const void *data)
constexpr int64_t size_in_bytes() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr MutableSpan take_back(const int64_t n) const
constexpr T * data() const
constexpr int64_t size_in_bytes() const
constexpr MutableSpan take_front(const int64_t n) const
constexpr Span slice(int64_t start, int64_t size) const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
int subdiv_verts_per_coarse_edge(const DRWSubdivCache &cache)
int subdiv_edges_per_coarse_edge(const DRWSubdivCache &cache)
static void extract_positions_mesh(const MeshRenderData &mr, MutableSpan< float3 > vbo_data)
static void extract_positions_bm(const MeshRenderData &mr, MutableSpan< float3 > vbo_data)
static void extract_loose_positions_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBuf &vbo)
void draw_subdiv_extract_pos(const DRWSubdivCache &cache, gpu::VertBuf *pos, gpu::VertBuf *orco)
gpu::VertBufPtr extract_positions_subdiv(const DRWSubdivCache &subdiv_cache, const MeshRenderData &mr, gpu::VertBufPtr *orco_vbo)
int subdiv_full_vbo_size(const MeshRenderData &mr, const DRWSubdivCache &cache)
gpu::VertBufPtr extract_positions(const MeshRenderData &mr)
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
void memory_bandwidth_bound_task(const int64_t approximate_bytes_touched, const Function &function)
VecBase< float, 3 > float3
Array< float3 > loose_edge_positions
Span< float3 > vert_positions
MeshExtractType extract_type