22#define NO_EDGE INT_MAX
29 for (
const auto item : edge_hash.
items()) {
30 int v_data = item.value;
35 int v2 = item.key.v_low;
36 int v3 = item.key.v_high;
42 int l2 = vert_to_corner[
v2];
43 int l3 = vert_to_corner[v3];
51 const uint tmp = value[0];
66 for (
int e = 0;
e < 3;
e++) {
70 bool inv_indices = (vert_tri[1] > vert_tri[2]);
72 {vert_tri[1], vert_tri[2]},
74 int new_value =
int(corner_tri[0]) + 1;
75 *value = inv_indices ? -new_value : new_value;
77 vert_to_corner[vert_tri[1]] = corner_tri[1];
78 vert_to_corner[vert_tri[2]] = corner_tri[2];
83 int new_value =
int(corner_tri[0]) + 1;
84 *value = inv_indices ? -new_value : new_value;
86 vert_to_corner[vert_tri[1]] = corner_tri[1];
87 vert_to_corner[vert_tri[2]] = corner_tri[2];
92 bool inv_opposite = (v_data < 0);
93 const int corner_opposite =
abs(v_data) - 1;
95 if (inv_opposite == inv_indices) {
98 &elb, corner_tri[0], corner_tri[1], corner_tri[2], corner_tri[0]);
100 &elb, corner_opposite, corner_tri[1], corner_tri[2], corner_opposite);
105 &elb, corner_tri[0], corner_tri[1], corner_tri[2], corner_opposite);
120 const std::array<BMLoop *, 3> &tri = looptris[i];
146 for (
const int face : faces.index_range()) {
147 if (!hide_poly.
is_empty() && hide_poly[face]) {
151 for (
const int3 &tri : corner_tris.
slice(tris)) {
153 uint3(corner_verts[tri[0]], corner_verts[tri[1]], corner_verts[tri[2]]),
170 edge_hash.
reserve(tess_edge_len);
172 bool is_manifold =
true;
186 r_is_manifold = is_manifold;
202 edge_hash.
reserve(tess_edge_len);
204 bool is_manifold =
true;
210 const uint loop_index = subdiv_quad_index * 4;
211 const uint corner_0 = loop_index + 0;
212 const uint corner_1 = loop_index + 1;
213 const uint corner_2 = loop_index + 2;
214 const uint corner_3 = loop_index + 3;
222 {corner_0, corner_1, corner_2},
228 {corner_0, corner_2, corner_3},
237 r_is_manifold = is_manifold;
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, blender::gpu::IndexBuf *)
void GPU_indexbuf_add_line_adj_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3, uint v4)
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
ItemIterator items() const
auto add_or_modify(const Key &key, const CreateValueF &create_value, const ModifyValueF &modify_value) -> decltype(create_value(nullptr))
constexpr Span slice(int64_t start, int64_t size) const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
void extract_lines_adjacency_subdiv(const DRWSubdivCache &subdiv_cache, gpu::IndexBuf &ibo, bool &r_is_manifold)
static void calc_adjacency_mesh(const MeshRenderData &mr, MutableSpan< int > vert_to_corner, Map< OrderedEdge, int > &edge_hash, GPUIndexBufBuilder &elb, bool &is_manifold)
void lines_adjacency_triangle(uint3 vert_tri, uint3 corner_tri, MutableSpan< int > vert_to_corner, Map< OrderedEdge, int > &edge_hash, GPUIndexBufBuilder &elb, bool &is_manifold)
static void calc_adjacency_bm(const MeshRenderData &mr, MutableSpan< int > vert_to_corner, Map< OrderedEdge, int > &edge_hash, GPUIndexBufBuilder &elb, bool &is_manifold)
static void create_lines_for_remaining_edges(MutableSpan< int > vert_to_corner, Map< OrderedEdge, int > &edge_hash, GPUIndexBufBuilder &elb, bool &is_manifold)
void rotate_vector(uint3 &value)
void extract_lines_adjacency(const MeshRenderData &mr, gpu::IndexBuf &ibo, bool &r_is_manifold)
VecBase< uint32_t, 3 > uint3
blender::Array< std::array< BMLoop *, 3 > > looptris
int * subdiv_loop_subdiv_vert_index
eMRExtractType extract_type
VArraySpan< bool > hide_poly
OffsetIndices< int > faces