Blender  V3.3
BLI_scanfill.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
4 #pragma once
5 
10 struct ScanFillVert;
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef struct ScanFillContext {
20 
21  /* increment this value before adding each curve to skip having to calculate
22  * 'poly_nr' for edges and verts (which can take approx half scan-fill time) */
23  unsigned short poly_nr;
24 
25  /* private */
26  struct MemArena *arena;
28 
29 #define BLI_SCANFILL_ARENA_SIZE MEM_SIZE_OPTIMAL(1 << 14)
30 
36 #define SF_POLY_UNSET ((unsigned short)-1)
37 
38 typedef struct ScanFillVert {
39  struct ScanFillVert *next, *prev;
40  union {
41  struct ScanFillVert *v;
42  void *p;
43  int i;
44  unsigned int u;
45  } tmp;
47  float co[3];
49  float xy[2];
51  unsigned int keyindex;
52  unsigned short poly_nr;
54  unsigned char edge_count;
56  unsigned int f : 4;
58  unsigned int user_flag : 4;
60 
61 typedef struct ScanFillEdge {
62  struct ScanFillEdge *next, *prev;
63  struct ScanFillVert *v1, *v2;
64  unsigned short poly_nr;
65  unsigned int f : 4; /* edge status */
66  unsigned int user_flag : 4; /* flag callers can use as they like */
67  union {
68  unsigned char c;
69  } tmp;
71 
72 typedef struct ScanFillFace {
73  struct ScanFillFace *next, *prev;
74  struct ScanFillVert *v1, *v2, *v3;
76 
77 /* scanfill.c */
78 
79 struct ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]);
81  struct ScanFillVert *v1,
82  struct ScanFillVert *v2);
83 
84 enum {
85  /* NOTE(campbell): using BLI_SCANFILL_CALC_REMOVE_DOUBLES
86  * Assumes ordered edges, otherwise we risk an eternal loop
87  * removing double verts. */
89 
90  /* calculate isolated polygons */
92 
93  /* NOTE: This flag removes checks for overlapping polygons.
94  * when this flag is set, we'll never get back more faces than (totvert - 2) */
96 
97  /* checks valid edge users - can skip for simple loops */
99 };
100 void BLI_scanfill_begin(ScanFillContext *sf_ctx);
101 unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag);
102 unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3]);
103 void BLI_scanfill_end(ScanFillContext *sf_ctx);
104 
105 void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
106 void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
107 
108 /* scanfill_utils.c */
109 
116  ListBase *fillvertbase,
117  ListBase *filledgebase);
118 
119 #ifdef __cplusplus
120 }
121 #endif
void BLI_scanfill_begin(ScanFillContext *sf_ctx)
Definition: scanfill.c:779
struct ScanFillVert * BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
Definition: scanfill.c:112
struct ScanFillFace ScanFillFace
unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag)
Definition: scanfill.c:1145
struct ScanFillEdge * BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2)
Definition: scanfill.c:134
void BLI_scanfill_end(ScanFillContext *sf_ctx)
Definition: scanfill.c:793
struct ScanFillEdge ScanFillEdge
bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBase *fillvertbase, ListBase *filledgebase)
struct ScanFillVert ScanFillVert
void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition: scanfill.c:786
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3])
Definition: scanfill.c:813
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition: scanfill.c:803
struct ScanFillContext ScanFillContext
@ BLI_SCANFILL_CALC_LOOSE
Definition: BLI_scanfill.h:98
@ BLI_SCANFILL_CALC_POLYS
Definition: BLI_scanfill.h:91
@ BLI_SCANFILL_CALC_HOLES
Definition: BLI_scanfill.h:95
@ BLI_SCANFILL_CALC_REMOVE_DOUBLES
Definition: BLI_scanfill.h:88
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const BMVert * v2
struct MemArena * arena
Definition: BLI_scanfill.h:26
ListBase fillvertbase
Definition: BLI_scanfill.h:17
ListBase filledgebase
Definition: BLI_scanfill.h:18
unsigned short poly_nr
Definition: BLI_scanfill.h:23
ListBase fillfacebase
Definition: BLI_scanfill.h:19
struct ScanFillEdge * prev
Definition: BLI_scanfill.h:62
unsigned short poly_nr
Definition: BLI_scanfill.h:64
struct ScanFillVert * v1
Definition: BLI_scanfill.h:63
struct ScanFillVert * v2
Definition: BLI_scanfill.h:63
unsigned char c
Definition: BLI_scanfill.h:68
unsigned int f
Definition: BLI_scanfill.h:65
struct ScanFillEdge * next
Definition: BLI_scanfill.h:62
union ScanFillEdge::@122 tmp
unsigned int user_flag
Definition: BLI_scanfill.h:66
struct ScanFillFace * next
Definition: BLI_scanfill.h:73
struct ScanFillVert * v2
Definition: BLI_scanfill.h:74
struct ScanFillVert * v3
Definition: BLI_scanfill.h:74
struct ScanFillFace * prev
Definition: BLI_scanfill.h:73
struct ScanFillVert * v1
Definition: BLI_scanfill.h:74
float xy[2]
Definition: BLI_scanfill.h:49
unsigned short poly_nr
Definition: BLI_scanfill.h:52
unsigned int f
Definition: BLI_scanfill.h:56
unsigned char edge_count
Definition: BLI_scanfill.h:54
struct ScanFillVert * next
Definition: BLI_scanfill.h:39
float co[3]
Definition: BLI_scanfill.h:47
struct ScanFillVert * v
Definition: BLI_scanfill.h:41
union ScanFillVert::@121 tmp
unsigned int user_flag
Definition: BLI_scanfill.h:58
unsigned int u
Definition: BLI_scanfill.h:44
struct ScanFillVert * prev
Definition: BLI_scanfill.h:39
unsigned int keyindex
Definition: BLI_scanfill.h:51