42 SNPRINTF(attr_name,
"a%s", attr_safe_name);
54 if (build_on_device) {
69 using VBOType =
typename Converter::VBOType;
72 if constexpr (std::is_same_v<T, VBOType>) {
77 for (const int i : range) {
78 data[i] = Converter::convert(attribute[indices[i]]);
90 using VBOType =
typename Converter::VBOType;
94 for (const int i : range) {
95 data.slice(faces[i]).fill(Converter::convert(attribute[i]));
104 using VBOType =
typename Converter::VBOType;
113 *
data = Converter::convert(*src);
124 using VBOType =
typename Converter::VBOType;
133 *
data = Converter::convert(src);
144 using VBOType =
typename Converter::VBOType;
151 std::fill_n(
data, face->
len, Converter::convert(src));
160 using VBOType =
typename Converter::VBOType;
169 *
data = Converter::convert(src);
202 using T = decltype(dummy);
203 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
204 switch (request.domain) {
205 case bke::AttrDomain::Point:
206 extract_data_bmesh_vert<T>(*mr.bm, cd_offset, vbo);
208 case bke::AttrDomain::Edge:
209 extract_data_bmesh_edge<T>(*mr.bm, cd_offset, vbo);
211 case bke::AttrDomain::Face:
212 extract_data_bmesh_face<T>(*mr.bm, cd_offset, vbo);
214 case bke::AttrDomain::Corner:
215 extract_data_bmesh_loop<T>(*mr.bm, cd_offset, vbo);
218 BLI_assert_unreachable();
225 const StringRef name = request.attribute_name;
230 using T = decltype(dummy);
231 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
232 switch (request.domain) {
233 case bke::AttrDomain::Point:
234 extract_data_mesh_mapped_corner(attribute.typed<T>(), mr.corner_verts, vbo);
236 case bke::AttrDomain::Edge:
237 extract_data_mesh_mapped_corner(attribute.typed<T>(), mr.corner_edges, vbo);
239 case bke::AttrDomain::Face:
240 extract_data_mesh_face(mr.faces, attribute.typed<T>(), vbo);
242 case bke::AttrDomain::Corner:
243 vertbuf_data_extract_direct(attribute.typed<T>(), vbo);
246 BLI_assert_unreachable();
274 const Mesh *coarse_mesh = subdiv_cache.
mesh;
290 using T = decltype(dummy);
291 using Converter = AttributeConverter<T>;
292 if constexpr (!std::is_void_v<typename Converter::VBOType>) {
293 draw_subdiv_interp_custom_data(subdiv_cache,
296 Converter::gpu_component_type,
297 Converter::gpu_component_len,
310 if (
format.attr_len == 0) {
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
#define SNPRINTF(dst, format,...)
#define POINTER_OFFSET(v, ofs)
void GPU_vertbuf_init_build_on_device(blender::gpu::VertBuf &verts, const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_tag_dirty(blender::gpu::VertBuf *verts)
#define GPU_vertbuf_init_with_format(verts, format)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_init_with_format_ex(blender::gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
void GPU_vertbuf_discard(blender::gpu::VertBuf *)
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
#define BM_FACE_FIRST_LOOP(p)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
constexpr IndexRange index_range() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
Utilities for rendering attributes.
bool DRW_vbo_requested(blender::gpu::VertBuf *vbo)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
GPUVertFormat init_format_for_attribute(const eCustomDataType data_type, const StringRefNull vbo_name)
static void extract_data_bmesh_edge(const BMesh &bm, const int cd_offset, gpu::VertBuf &vbo)
static void init_vbo_for_attribute(const MeshRenderData &mr, gpu::VertBuf &vbo, const DRW_AttributeRequest &request, bool build_on_device, uint32_t len)
void extract_attributes_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, const Span< DRW_AttributeRequest > requests, const Span< gpu::VertBuf * > vbos)
static void extract_data_bmesh_vert(const BMesh &bm, const int cd_offset, gpu::VertBuf &vbo)
static const CustomData * get_custom_data_for_domain(const BMesh &bm, bke::AttrDomain domain)
static void extract_data_bmesh_loop(const BMesh &bm, const int cd_offset, gpu::VertBuf &vbo)
static void extract_data_mesh_face(const OffsetIndices< int > faces, const Span< T > attribute, gpu::VertBuf &vbo)
static void extract_data_bmesh_face(const BMesh &bm, const int cd_offset, gpu::VertBuf &vbo)
static void extract_attribute(const MeshRenderData &mr, const DRW_AttributeRequest &request, gpu::VertBuf &vbo)
void extract_attr_viewer(const MeshRenderData &mr, gpu::VertBuf &vbo)
void extract_attributes(const MeshRenderData &mr, const Span< DRW_AttributeRequest > requests, const Span< gpu::VertBuf * > vbos)
static void extract_data_mesh_mapped_corner(const Span< T > attribute, const Span< int > indices, gpu::VertBuf &vbo)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
blender::bke::AttrDomain domain
const char * default_color_name
const char * active_color_name
eMRExtractType extract_type