13#define NOR_AND_FLAG_DEFAULT 0
14#define NOR_AND_FLAG_SELECT 1
15#define NOR_AND_FLAG_ACTIVE -1
16#define NOR_AND_FLAG_HIDDEN -2
18template<
typename GPUType>
24 for (const int i : range) {
25 const BMFace *face = bm_original_face_get(mr, i);
26 if (!face || BM_elem_flag_test(face, BM_ELEM_HIDDEN)) {
27 normals[i] = invalid_normal;
28 normals[i].w = NOR_AND_FLAG_HIDDEN;
30 else if (BM_elem_flag_test(face, BM_ELEM_SELECT)) {
31 normals[i].w = (face == mr.efa_act) ? NOR_AND_FLAG_ACTIVE : NOR_AND_FLAG_SELECT;
37template<
typename GPUType>
40 const GPUType invalid_normal = convert_normal<GPUType>(
float3(0));
42 for (const int i : range) {
43 BMFace *face = BM_face_at_index(mr.bm, i);
44 if (BM_elem_flag_test(face, BM_ELEM_HIDDEN)) {
45 normals[i] = invalid_normal;
46 normals[i].w = NOR_AND_FLAG_HIDDEN;
49 normals[i] = convert_normal<GPUType>(bm_face_no_get(mr, face));
50 normals[i].w = (BM_elem_flag_test(face, BM_ELEM_SELECT) ?
51 ((face == mr.efa_act) ? NOR_AND_FLAG_ACTIVE : NOR_AND_FLAG_SELECT) :
52 NOR_AND_FLAG_DEFAULT);
62 if (
format.attr_len == 0) {
78 if (
format.attr_len == 0) {
#define GPU_vertbuf_init_with_format(verts, format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
GPUType convert_normal(const float3 &src)
static void extract_face_dot_normals_mesh(const MeshRenderData &mr, MutableSpan< GPUType > normals)
void convert_normals(Span< float3 > src, MutableSpan< GPUType > dst)
void extract_face_dot_normals(const MeshRenderData &mr, const bool use_hq, gpu::VertBuf &vbo)
void extract_face_dot_normals_bm(const MeshRenderData &mr, MutableSpan< GPUType > normals)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 3 > float3
eMRExtractType extract_type
Span< float3 > face_normals