Blender V5.3
BLI_scanfill.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "DNA_listBase.h"
12
13#include <stdbool.h>
14
15namespace blender {
16
17struct ScanFillVert;
18struct ScanFillEdge;
19struct ScanFillFace;
20
22 ListBaseT<ScanFillVert> fillvertbase;
23 ListBaseT<ScanFillEdge> filledgebase;
24 ListBaseT<ScanFillFace> fillfacebase;
25
26 /* increment this value before adding each curve to skip having to calculate
27 * 'poly_nr' for edges and verts (which can take approx half scan-fill time) */
28 unsigned short poly_nr;
29
30 /* private */
31 struct MemArena *arena;
32};
33
34#define BLI_SCANFILL_ARENA_SIZE MEM_SIZE_OPTIMAL(1 << 14)
35
41#define SF_POLY_UNSET ((unsigned short)-1)
42
45 union {
46 struct ScanFillVert *v;
47 void *p;
48 int i;
49 unsigned int u;
50 } tmp;
52 float co[3];
54 float xy[2];
56 unsigned int keyindex;
57 unsigned short poly_nr;
59 unsigned char edge_count;
61 unsigned int f : 4;
63 unsigned int user_flag : 4;
64};
65
68 struct ScanFillVert *v1, *v2;
69 unsigned short poly_nr;
70 unsigned int f : 4; /* edge status */
71 unsigned int user_flag : 4; /* flag callers can use as they like */
72 union {
73 unsigned char c;
74 } tmp;
75};
76
79 struct ScanFillVert *v1, *v2, *v3;
80};
81
82/* scanfill.cc */
83
84struct ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]);
86 struct ScanFillVert *v1,
87 struct ScanFillVert *v2);
88
89enum {
90 /* NOTE(@ideasman42): using #BLI_SCANFILL_CALC_REMOVE_DOUBLES
91 * Assumes ordered edges, otherwise we risk an eternal loop
92 * removing double verts. */
94
95 /* calculate isolated polygons */
97
98 /* NOTE: This flag removes checks for overlapping polygons.
99 * when this flag is set, we'll never get back more faces than (totvert - 2) */
101
102 /* checks valid edge users - can skip for simple loops */
104};
105void BLI_scanfill_begin(ScanFillContext *sf_ctx);
106unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag);
107unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3]);
108void BLI_scanfill_end(ScanFillContext *sf_ctx);
109
110void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
111void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
112
113/* scanfill_utils.cc */
114
120bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx,
121 ListBaseT<ScanFillVert> *remvertbase,
122 ListBaseT<ScanFillEdge> *remedgebase);
123
124} // namespace blender
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBaseT< ScanFillVert > *remvertbase, ListBaseT< ScanFillEdge > *remedgebase)
void BLI_scanfill_end(ScanFillContext *sf_ctx)
Definition scanfill.cc:798
@ BLI_SCANFILL_CALC_LOOSE
@ BLI_SCANFILL_CALC_POLYS
@ BLI_SCANFILL_CALC_HOLES
@ BLI_SCANFILL_CALC_REMOVE_DOUBLES
void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.cc:791
struct ScanFillVert * BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
Definition scanfill.cc:105
void BLI_scanfill_begin(ScanFillContext *sf_ctx)
Definition scanfill.cc:784
unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag)
Definition scanfill.cc:1141
struct ScanFillEdge * BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2)
Definition scanfill.cc:127
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.cc:808
ATTR_WARN_UNUSED_RESULT const BMVert * v2
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3])
Definition scanfill.cc:818
ListBaseT< ScanFillFace > fillfacebase
ListBaseT< ScanFillEdge > filledgebase
struct MemArena * arena
ListBaseT< ScanFillVert > fillvertbase
struct ScanFillEdge * prev
unsigned short poly_nr
union blender::ScanFillEdge::@262251053107234334274134243151221246013035300046 tmp
struct ScanFillVert * v2
struct ScanFillEdge * next
struct ScanFillVert * v1
struct ScanFillFace * next
struct ScanFillVert * v2
struct ScanFillVert * v1
struct ScanFillFace * prev
struct ScanFillVert * v3
unsigned char edge_count
unsigned short poly_nr
struct ScanFillVert * prev
struct ScanFillVert * next
union blender::ScanFillVert::@124355022001164321030006076112165043115032300246 tmp