Blender  V2.93
BKE_subsurf.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 #pragma once
20 
25 /* struct DerivedMesh is used directly */
26 #include "BKE_DerivedMesh.h"
27 
28 /* Thread sync primitives used directly. */
29 #include "BLI_threads.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 struct CCGEdge;
36 struct CCGElem;
37 struct CCGFace;
38 struct CCGVert;
39 struct DMFlagMat;
40 struct DerivedMesh;
41 struct EdgeHash;
42 struct MPoly;
43 struct Mesh;
44 struct MeshElemMap;
45 struct Object;
46 struct PBVH;
47 struct SubsurfModifierData;
48 
49 /**************************** External *****************************/
50 
51 typedef enum {
59 } SubsurfFlags;
60 
62  struct SubsurfModifierData *smd,
63  const struct Scene *scene,
64  float (*vertCos)[3],
65  SubsurfFlags flags);
66 
67 void subsurf_calculate_limit_positions(struct Mesh *me, float (*r_positions)[3]);
68 
69 /* get gridsize from 'level', level must be greater than zero */
70 int BKE_ccg_gridsize(int level);
71 
72 /* x/y grid coordinates at 'low_level' can be multiplied by the result
73  * of this function to convert to grid coordinates at 'high_level' */
74 int BKE_ccg_factor(int low_level, int high_level);
75 
77  const struct MPoly *mpoly,
78  struct MVert *mvert,
79  const struct MDisps *mdisps);
80 
82  const struct MPoly *mpoly,
83  float *paint_mask,
84  const struct GridPaintMask *grid_paint_mask);
85 
86 bool subsurf_has_edges(struct DerivedMesh *dm);
87 bool subsurf_has_faces(struct DerivedMesh *dm);
88 
89 typedef enum MultiresModifiedFlags {
90  /* indicates the grids have been sculpted on, so MDisps
91  * have to be updated */
93  /* indicates elements have been hidden or unhidden */
96 
97 /**************************** Internal *****************************/
98 
99 typedef struct CCGDerivedMesh {
101 
102  struct CCGSubSurf *ss;
103  int freeSS;
105 
106  struct {
108  struct CCGVert *vert;
109  } * vertMap;
110  struct {
111  int startVert;
113  struct CCGEdge *edge;
114  } * edgeMap;
115  struct {
116  int startVert;
117  int startEdge;
119  struct CCGFace *face;
120  } * faceMap;
121 
122  short *edgeFlags;
124 
126 
127  struct PBVH *pbvh;
128 
129  struct MeshElemMap *pmap;
130  int *pmap_mem;
131 
132  struct CCGElem **gridData;
134  struct CCGFace **gridFaces;
136  unsigned int **gridHidden;
137  /* Elements in arrays above. */
138  unsigned int numGrid;
139 
140  struct {
143 
144  int lvl, totlvl;
145  float (*orco)[3];
146 
147  struct Object *ob;
150 
151  struct EdgeHash *ehash;
152 
156 
157 #ifdef __cplusplus
158 }
159 #endif
typedef float(TangentPoint)[2]
struct CCGElem CCGElem
Definition: BKE_ccg.h:46
int BKE_ccg_gridsize(int level)
Definition: CCGSubSurf.c:37
void subsurf_copy_grid_paint_mask(struct DerivedMesh *dm, const struct MPoly *mpoly, float *paint_mask, const struct GridPaintMask *grid_paint_mask)
MultiresModifiedFlags
Definition: BKE_subsurf.h:89
@ MULTIRES_HIDDEN_MODIFIED
Definition: BKE_subsurf.h:94
@ MULTIRES_COORDS_MODIFIED
Definition: BKE_subsurf.h:92
struct CCGDerivedMesh CCGDerivedMesh
struct DerivedMesh * subsurf_make_derived_from_derived(struct DerivedMesh *dm, struct SubsurfModifierData *smd, const struct Scene *scene, float(*vertCos)[3], SubsurfFlags flags)
Definition: subsurf_ccg.c:2343
SubsurfFlags
Definition: BKE_subsurf.h:51
@ SUBSURF_FOR_EDIT_MODE
Definition: BKE_subsurf.h:54
@ SUBSURF_IN_EDIT_MODE
Definition: BKE_subsurf.h:55
@ SUBSURF_USE_GPU_BACKEND
Definition: BKE_subsurf.h:57
@ SUBSURF_ALLOC_PAINT_MASK
Definition: BKE_subsurf.h:56
@ SUBSURF_USE_RENDER_PARAMS
Definition: BKE_subsurf.h:52
@ SUBSURF_IS_FINAL_CALC
Definition: BKE_subsurf.h:53
@ SUBSURF_IGNORE_SIMPLIFY
Definition: BKE_subsurf.h:58
void subsurf_copy_grid_hidden(struct DerivedMesh *dm, const struct MPoly *mpoly, struct MVert *mvert, const struct MDisps *mdisps)
int BKE_ccg_factor(int low_level, int high_level)
Definition: CCGSubSurf.c:42
void subsurf_calculate_limit_positions(struct Mesh *me, float(*r_positions)[3])
Definition: subsurf_ccg.c:2458
bool subsurf_has_edges(struct DerivedMesh *dm)
Definition: subsurf_ccg.c:2510
bool subsurf_has_faces(struct DerivedMesh *dm)
Definition: subsurf_ccg.c:2515
pthread_rwlock_t ThreadRWMutex
Definition: BLI_threads.h:126
pthread_mutex_t ThreadMutex
Definition: BLI_threads.h:83
Scene scene
struct MeshElemMap * pmap
Definition: BKE_subsurf.h:129
struct CCGFace ** gridFaces
Definition: BKE_subsurf.h:134
float(* orco)[3]
Definition: BKE_subsurf.h:145
struct CCGDerivedMesh::@72 * faceMap
struct DMFlagMat * faceFlags
Definition: BKE_subsurf.h:123
struct CCGVert * vert
Definition: BKE_subsurf.h:108
struct CCGSubSurf * ss
Definition: BKE_subsurf.h:102
struct CCGDerivedMesh::@71 * edgeMap
struct MultiresModifierData * mmd
Definition: BKE_subsurf.h:141
unsigned int numGrid
Definition: BKE_subsurf.h:138
struct EdgeHash * ehash
Definition: BKE_subsurf.h:151
MultiresModifiedFlags modified_flags
Definition: BKE_subsurf.h:148
ThreadMutex loops_cache_lock
Definition: BKE_subsurf.h:153
int * reverseFaceMap
Definition: BKE_subsurf.h:125
unsigned int ** gridHidden
Definition: BKE_subsurf.h:136
DerivedMesh dm
Definition: BKE_subsurf.h:100
struct CCGEdge * edge
Definition: BKE_subsurf.h:113
struct PBVH * pbvh
Definition: BKE_subsurf.h:127
struct Object * ob
Definition: BKE_subsurf.h:147
struct CCGElem ** gridData
Definition: BKE_subsurf.h:132
struct CCGFace * face
Definition: BKE_subsurf.h:119
short * edgeFlags
Definition: BKE_subsurf.h:122
struct CCGDerivedMesh::@73 multires
struct DMFlagMat * gridFlagMats
Definition: BKE_subsurf.h:135
struct CCGDerivedMesh::@70 * vertMap
ThreadRWMutex origindex_cache_rwlock
Definition: BKE_subsurf.h:154