26 array_utils::copy(mr.vert_positions, vert_data);
27 extract_mesh_loose_edge_data(mr.vert_positions, mr.edges, mr.loose_edges, loose_edge_data);
28 array_utils::gather(mr.vert_positions, mr.loose_verts, loose_vert_data);
41 for (const int i : range) {
42 vert_data[i] = bm_vert_co_get(mr, BM_vert_at_index(&const_cast<BMesh &>(bm), i));
46 mr.loose_edges.foreach_index(
47 [&](
const int i,
const int pos) {
54 mr.loose_verts.foreach_index(
55 [&](
const int i,
const int pos) {
65 "pos", gpu::VertAttrType::SFLOAT_32_32_32);
90 if (loose_verts.
is_empty() && loose_edges_num == 0) {
97 const int resolution = subdiv_cache.
resolution;
105 for (
const int i :
IndexRange(loose_edges_num)) {
106 const int edge_offset = loose_geom_start + i * verts_per_edge;
107 const Span<float3> positions = cached_positions.
slice(i * resolution, resolution);
108 for (
const int edge :
IndexRange(edges_per_edge)) {
109 edge_data[0] = positions[edge + 0];
110 edge_data[1] = positions[edge + 1];
112 &vbo, (edge_offset + edge * 2) *
sizeof(
float3),
sizeof(
float3) * 2, &edge_data);
116 const int loose_verts_start = loose_geom_start + loose_edges_num * verts_per_edge;
120 &vbo, (loose_verts_start + pos) *
sizeof(
float3),
sizeof(
float3), &positions[i]);
129 "pos", gpu::VertAttrType::SFLOAT_32_32_32);
144 "orco", gpu::VertAttrType::SFLOAT_32_32_32_32);
Span< T > as_span() const
constexpr IndexRange()=default
constexpr MutableSpan take_back(const int64_t n) 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
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
static void extract_vert_positions_bm(const MeshRenderData &mr, MutableSpan< float3 > vert_data, MutableSpan< float3 > loose_data)
int subdiv_verts_per_coarse_edge(const DRWSubdivCache &cache)
int subdiv_edges_per_coarse_edge(const DRWSubdivCache &cache)
static void extract_vert_positions_mesh(const MeshRenderData &mr, MutableSpan< float3 > vert_data, MutableSpan< float3 > loose_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, MeshBufferCache &cache)
void gather_vert_to_corner_gpu(const MeshRenderData &mr, MeshBufferCache &cache, gpu::VertBuf &src, gpu::VertBuf &dst)
void loose_data_upload(const MeshRenderData &mr, const Span< T > loose_data, gpu::VertBuf &dst)
BLI_INLINE const float * bm_vert_co_get(const MeshRenderData &mr, const BMVert *eve)
constexpr ParallelGrainSize grain_size(int grain_size)
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)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
gpu::VertBuf * GPU_vertbuf_create_on_device(const GPUVertFormat &format, uint v_len)
GPUVertFormat GPU_vertformat_from_attribute(StringRef name, gpu::VertAttrType type)
void GPU_vertbuf_use(gpu::VertBuf *)
void GPU_vertbuf_update_sub(gpu::VertBuf *verts, uint start, uint len, const void *data)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
VecBase< float, 3 > float3
Array< float3 > loose_edge_positions
Span< float3 > vert_positions
MeshExtractType extract_type