55 #ifdef WITH_QUADRIFLOW
60 struct OpenVDBLevelSet *BKE_mesh_remesh_voxel_ovdb_mesh_to_level_set_create(
74 totfaces * 3,
sizeof(
unsigned int),
"remesh_input_faces");
76 for (
unsigned int i = 0; i < totverts; i++) {
79 verts[i * 3 + 1] = mvert->
co[1];
80 verts[i * 3 + 2] = mvert->
co[2];
83 for (
unsigned int i = 0; i < totfaces; i++) {
103 bool relax_disoriented_triangles)
107 level_set, &output_mesh, isovalue, adaptivity, relax_disoriented_triangles);
112 (output_mesh.totquads * 4) + (output_mesh.tottriangles * 3),
113 output_mesh.totquads + output_mesh.tottriangles);
115 for (
int i = 0; i < output_mesh.totvertices; i++) {
121 for (
int i = 0; i < output_mesh.totquads; i++, mp++, ml += 4) {
125 ml[0].
v = output_mesh.quads[i * 4 + 3];
126 ml[1].v = output_mesh.quads[i * 4 + 2];
127 ml[2].v = output_mesh.quads[i * 4 + 1];
128 ml[3].v = output_mesh.quads[i * 4];
131 for (
int i = 0; i < output_mesh.tottriangles; i++, mp++, ml += 3) {
135 ml[0].v = output_mesh.triangles[i * 3 + 2];
136 ml[1].v = output_mesh.triangles[i * 3 + 1];
137 ml[2].v = output_mesh.triangles[i * 3];
146 if (output_mesh.tottriangles > 0) {
154 #ifdef WITH_QUADRIFLOW
155 static Mesh *BKE_mesh_remesh_quadriflow(
Mesh *input_mesh,
159 bool preserve_boundary,
162 void *update_cb_data)
175 unsigned int totverts = input_mesh->
totvert;
178 totfaces * 3,
sizeof(
unsigned int),
"remesh_input_faces");
180 for (
unsigned int i = 0; i < totverts; i++) {
183 verts[i * 3 + 1] = mvert->
co[1];
184 verts[i * 3 + 2] = mvert->
co[2];
187 for (
unsigned int i = 0; i < totfaces; i++) {
241 for (
int i = 0; i < qrd.
out_totfaces; i++, mp++, ml += 4) {
265 bool preserve_boundary,
268 void *update_cb_data)
271 #ifdef WITH_QUADRIFLOW
272 if (target_faces <= 0) {
275 new_mesh = BKE_mesh_remesh_quadriflow(
mesh,
306 level_set = BKE_mesh_remesh_voxel_ovdb_mesh_to_level_set_create(
mesh, xform);
307 new_mesh = BKE_mesh_remesh_voxel_ovdb_volume_to_mesh_nomain(
308 level_set, (
double)isovalue, (
double)adaptivity,
false);
343 for (
int i = 0; i < target->
totvert; i++) {
350 if (nearest.
index != -1) {
351 target_mask[i] = source_mask[nearest.
index];
367 int *target_face_sets;
376 int *source_face_sets;
388 for (
int i = 0; i < target->
totpoly; i++) {
393 const MPoly *mpoly = &target_polys[i];
396 if (nearest.
index != -1) {
397 target_face_sets[i] = source_face_sets[looptri[nearest.
index].
poly];
400 target_face_sets[i] = 1;
415 for (
int layer_n = 0; layer_n < tot_color_layer; layer_n++) {
423 for (
int i = 0; i < target->
totvert; i++) {
429 if (nearest.
index != -1) {
443 .use_toolflags =
true,
449 .calc_face_normal =
true,
492 bool dissolve =
true;
514 for (
int i = 0; i < 4; i++) {
533 "recalc_face_normals faces=%hf",
539 .calc_object_remap =
false,
BVHTree * BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, struct Mesh *mesh, const BVHCacheType bvh_cache_type, const int tree_type)
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
CustomData interface, see also DNA_customdata_types.h.
const char * CustomData_get_layer_name(const struct CustomData *data, int type, int n)
int CustomData_number_of_layers(const struct CustomData *data, int type)
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void * CustomData_get_layer(const struct CustomData *data, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
void BKE_id_free(struct Main *bmain, void *idv)
void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_cent[3])
struct Mesh * BKE_mesh_from_bmesh_nomain(struct BMesh *bm, const struct BMeshToMeshParams *params, const struct Mesh *me_settings)
struct Mesh * BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, const bool select_new_edges)
void BKE_mesh_runtime_verttri_from_looptri(struct MVertTri *r_verttri, const struct MLoop *mloop, const struct MLoopTri *looptri, int looptri_num)
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh)
void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh)
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh)
int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
Object is a sort of wrapper for general info.
_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
Read Guarded memory(de)allocation.
void BM_face_kill(BMesh *bm, BMFace *f)
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type)
void BM_mesh_edgenet(BMesh *bm, const bool use_edge_tag, const bool use_new_face_tag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_MUTABLE(ele, ele_next, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params)
BMesh Make Mesh.
void BM_mesh_normals_update(BMesh *bm)
BMesh Compute Normals.
#define BMALLOC_TEMPLATE_FROM_ME(...)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
Mesh -> BMesh.
BMVert * BM_edge_collapse(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool kill_degenerate_faces)
#define BMO_FLAG_DEFAULTS
bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt,...)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
int BM_edge_face_count(const BMEdge *e)
int BM_vert_edge_count(const BMVert *v)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static unsigned long seed
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, Mesh *source)
Mesh * BKE_mesh_remesh_voxel_to_mesh_nomain(Mesh *mesh, float voxel_size, float adaptivity, float isovalue)
Mesh * BKE_mesh_remesh_quadriflow_to_mesh_nomain(Mesh *mesh, int target_faces, int seed, bool preserve_sharp, bool preserve_boundary, bool adaptive_scale, void *update_cb, void *update_cb_data)
void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, Mesh *source)
struct Mesh * BKE_mesh_remesh_voxel_fix_poles(struct Mesh *mesh)
void BKE_remesh_reproject_vertex_paint(Mesh *target, Mesh *source)
void OpenVDBTransform_free(OpenVDBTransform *transform)
void OpenVDBLevelSet_volume_to_mesh(struct OpenVDBLevelSet *level_set, struct OpenVDBVolumeToMeshData *mesh, const double isovalue, const double adaptivity, const bool relax_disoriented_triangles)
OpenVDBLevelSet * OpenVDBLevelSet_create(bool initGrid, OpenVDBTransform *xform)
OpenVDBTransform * OpenVDBTransform_create()
void OpenVDBLevelSet_free(OpenVDBLevelSet *level_set)
void OpenVDBLevelSet_mesh_to_level_set(struct OpenVDBLevelSet *level_set, const float *vertices, const unsigned int *faces, const unsigned int totvertices, const unsigned int totfaces, OpenVDBTransform *xform)
void OpenVDBTransform_create_linear_transform(OpenVDBTransform *transform, double voxel_size)
void QFLOW_quadriflow_remesh(QuadriflowRemeshData *qrd, void(*update_cb)(void *, float progress, int *cancel), void *update_cb_data)
static void update_cb(PBVHNode *node, void *rebuild)
BVHTree_NearestPointCallback nearest_callback
struct CustomData pdata ldata