BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
*/
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
struct CustomData;
|
2019-03-08 11:45:00 +01:00
|
|
|
struct CustomData_MeshMasks;
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
struct MVert;
|
|
|
|
struct MemArena;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Mesh;
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
|
|
|
|
/* Generic ways to map some geometry elements from a source mesh to a dest one. */
|
|
|
|
|
|
|
|
typedef struct MeshPairRemapItem {
|
|
|
|
int sources_num;
|
|
|
|
int *indices_src; /* NULL if no source found. */
|
|
|
|
float *weights_src; /* NULL if no source found, else, always normalized! */
|
|
|
|
/* UNUSED (at the moment)*/
|
|
|
|
// float hit_dist; /* FLT_MAX if irrelevant or no source found. */
|
|
|
|
int island; /* For loops only. */
|
|
|
|
} MeshPairRemapItem;
|
|
|
|
|
|
|
|
/* All mapping computing func return this. */
|
|
|
|
typedef struct MeshPairRemap {
|
|
|
|
int items_num;
|
|
|
|
MeshPairRemapItem *items; /* array, one item per dest element. */
|
|
|
|
|
|
|
|
struct MemArena *mem; /* memory arena, internal use only. */
|
|
|
|
} MeshPairRemap;
|
|
|
|
|
|
|
|
/* Helpers! */
|
|
|
|
void BKE_mesh_remap_init(MeshPairRemap *map, const int items_num);
|
|
|
|
void BKE_mesh_remap_free(MeshPairRemap *map);
|
|
|
|
|
|
|
|
void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, const int index);
|
|
|
|
|
|
|
|
/* TODO:
|
|
|
|
* Add other 'from/to' mapping sources, like e.g. using an UVMap, etc.
|
2019-04-27 12:07:07 +10:00
|
|
|
* https://blenderartists.org/t/619105
|
|
|
|
*
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
* We could also use similar topology mappings inside a same mesh
|
|
|
|
* (cf. Campbell's 'select face islands from similar topology' wip work).
|
2019-04-27 12:07:07 +10:00
|
|
|
* Also, users will have to check, whether we can get rid of some modes here,
|
|
|
|
* not sure all will be useful!
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
MREMAP_USE_VERT = 1 << 4,
|
|
|
|
MREMAP_USE_EDGE = 1 << 5,
|
|
|
|
MREMAP_USE_LOOP = 1 << 6,
|
|
|
|
MREMAP_USE_POLY = 1 << 7,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MREMAP_USE_NEAREST = 1 << 8,
|
|
|
|
MREMAP_USE_NORPROJ = 1 << 9,
|
|
|
|
MREMAP_USE_INTERP = 1 << 10,
|
|
|
|
MREMAP_USE_NORMAL = 1 << 11,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* ***** Target's vertices ***** */
|
|
|
|
MREMAP_MODE_VERT = 1 << 24,
|
|
|
|
/* Nearest source vert. */
|
|
|
|
MREMAP_MODE_VERT_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_VERT | MREMAP_USE_NEAREST,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Nearest vertex of nearest edge. */
|
|
|
|
MREMAP_MODE_VERT_EDGE_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_EDGE | MREMAP_USE_NEAREST,
|
|
|
|
/* This one uses two verts of selected edge (weighted interpolation). */
|
|
|
|
/* Nearest point on nearest edge. */
|
|
|
|
MREMAP_MODE_VERT_EDGEINTERP_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_EDGE | MREMAP_USE_NEAREST |
|
|
|
|
MREMAP_USE_INTERP,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Nearest vertex of nearest poly. */
|
|
|
|
MREMAP_MODE_VERT_POLY_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_POLY | MREMAP_USE_NEAREST,
|
|
|
|
/* Those two use all verts of selected poly (weighted interpolation). */
|
|
|
|
/* Nearest point on nearest poly. */
|
|
|
|
MREMAP_MODE_VERT_POLYINTERP_NEAREST = MREMAP_MODE_VERT | MREMAP_USE_POLY | MREMAP_USE_NEAREST |
|
|
|
|
MREMAP_USE_INTERP,
|
|
|
|
/* Point on nearest face hit by ray from target vertex's normal. */
|
|
|
|
MREMAP_MODE_VERT_POLYINTERP_VNORPROJ = MREMAP_MODE_VERT | MREMAP_USE_POLY | MREMAP_USE_NORPROJ |
|
|
|
|
MREMAP_USE_INTERP,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* ***** Target's edges ***** */
|
|
|
|
MREMAP_MODE_EDGE = 1 << 25,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Source edge which both vertices are nearest of dest ones. */
|
|
|
|
MREMAP_MODE_EDGE_VERT_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_VERT | MREMAP_USE_NEAREST,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Nearest source edge (using mid-point). */
|
|
|
|
MREMAP_MODE_EDGE_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_EDGE | MREMAP_USE_NEAREST,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Nearest edge of nearest poly (using mid-point). */
|
|
|
|
MREMAP_MODE_EDGE_POLY_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_POLY | MREMAP_USE_NEAREST,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-27 12:07:07 +10:00
|
|
|
/* Cast a set of rays from along dest edge,
|
|
|
|
* interpolating its vertices' normals, and use hit source edges. */
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ = MREMAP_MODE_EDGE | MREMAP_USE_VERT | MREMAP_USE_NORPROJ |
|
|
|
|
MREMAP_USE_INTERP,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* ***** Target's loops ***** */
|
2019-04-27 12:07:07 +10:00
|
|
|
/* Note: when islands are given to loop mapping func,
|
|
|
|
* all loops from the same destination face will always be mapped
|
|
|
|
* to loops of source faces within a same island, regardless of mapping mode. */
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MREMAP_MODE_LOOP = 1 << 26,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Best normal-matching loop from nearest vert. */
|
|
|
|
MREMAP_MODE_LOOP_NEAREST_LOOPNOR = MREMAP_MODE_LOOP | MREMAP_USE_LOOP | MREMAP_USE_VERT |
|
|
|
|
MREMAP_USE_NEAREST | MREMAP_USE_NORMAL,
|
|
|
|
/* Loop from best normal-matching poly from nearest vert. */
|
|
|
|
MREMAP_MODE_LOOP_NEAREST_POLYNOR = MREMAP_MODE_LOOP | MREMAP_USE_POLY | MREMAP_USE_VERT |
|
|
|
|
MREMAP_USE_NEAREST | MREMAP_USE_NORMAL,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Loop from nearest vertex of nearest poly. */
|
|
|
|
MREMAP_MODE_LOOP_POLY_NEAREST = MREMAP_MODE_LOOP | MREMAP_USE_POLY | MREMAP_USE_NEAREST,
|
|
|
|
/* Those two use all verts of selected poly (weighted interpolation). */
|
|
|
|
/* Nearest point on nearest poly. */
|
|
|
|
MREMAP_MODE_LOOP_POLYINTERP_NEAREST = MREMAP_MODE_LOOP | MREMAP_USE_POLY | MREMAP_USE_NEAREST |
|
|
|
|
MREMAP_USE_INTERP,
|
|
|
|
/* Point on nearest face hit by ray from target loop's normal. */
|
|
|
|
MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ = MREMAP_MODE_LOOP | MREMAP_USE_POLY | MREMAP_USE_NORPROJ |
|
|
|
|
MREMAP_USE_INTERP,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* ***** Target's polygons ***** */
|
|
|
|
MREMAP_MODE_POLY = 1 << 27,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* Nearest source poly. */
|
|
|
|
MREMAP_MODE_POLY_NEAREST = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NEAREST,
|
|
|
|
/* Source poly from best normal-matching dest poly. */
|
|
|
|
MREMAP_MODE_POLY_NOR = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NORMAL,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-27 12:07:07 +10:00
|
|
|
/* Project dest poly onto source mesh using its normal,
|
|
|
|
* and use interpolation of all intersecting source polys. */
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MREMAP_MODE_POLY_POLYINTERP_PNORPROJ = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NORPROJ |
|
|
|
|
MREMAP_USE_INTERP,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
/* ***** Same topology, applies to all four elements types. ***** */
|
|
|
|
MREMAP_MODE_TOPOLOGY = MREMAP_MODE_VERT | MREMAP_MODE_EDGE | MREMAP_MODE_LOOP | MREMAP_MODE_POLY,
|
|
|
|
};
|
|
|
|
|
2019-03-08 11:45:00 +01:00
|
|
|
void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(
|
|
|
|
const int vert_mode,
|
|
|
|
const int edge_mode,
|
|
|
|
const int loop_mode,
|
|
|
|
const int poly_mode,
|
|
|
|
struct CustomData_MeshMasks *cddata_mask);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
float BKE_mesh_remap_calc_difference_from_mesh(const struct SpaceTransform *space_transform,
|
|
|
|
const struct MVert *verts_dst,
|
|
|
|
const int numverts_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
struct Mesh *me_src);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
void BKE_mesh_remap_find_best_match_from_mesh(const struct MVert *verts_dst,
|
|
|
|
const int numverts_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
struct Mesh *me_src,
|
|
|
|
struct SpaceTransform *r_space_transform);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-21 15:32:01 +02:00
|
|
|
void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
const struct SpaceTransform *space_transform,
|
|
|
|
const float max_dist,
|
|
|
|
const float ray_radius,
|
2018-06-21 15:32:01 +02:00
|
|
|
const struct MVert *verts_dst,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
const int numverts_dst,
|
|
|
|
const bool dirty_nors_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
struct Mesh *me_src,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MeshPairRemap *r_map);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
|
2015-07-13 18:00:08 +02:00
|
|
|
const struct SpaceTransform *space_transform,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
const float max_dist,
|
|
|
|
const float ray_radius,
|
|
|
|
const struct MVert *verts_dst,
|
|
|
|
const int numverts_dst,
|
|
|
|
const struct MEdge *edges_dst,
|
|
|
|
const int numedges_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
const bool dirty_nors_dst,
|
|
|
|
struct Mesh *me_src,
|
|
|
|
MeshPairRemap *r_map);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-21 15:32:01 +02:00
|
|
|
void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
const struct SpaceTransform *space_transform,
|
|
|
|
const float max_dist,
|
|
|
|
const float ray_radius,
|
|
|
|
struct MVert *verts_dst,
|
|
|
|
const int numverts_dst,
|
|
|
|
struct MEdge *edges_dst,
|
|
|
|
const int numedges_dst,
|
|
|
|
struct MLoop *loops_dst,
|
|
|
|
const int numloops_dst,
|
|
|
|
struct MPoly *polys_dst,
|
|
|
|
const int numpolys_dst,
|
|
|
|
struct CustomData *ldata_dst,
|
|
|
|
struct CustomData *pdata_dst,
|
2015-01-19 14:11:40 +01:00
|
|
|
const bool use_split_nors_dst,
|
|
|
|
const float split_angle_dst,
|
|
|
|
const bool dirty_nors_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
struct Mesh *me_src,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
MeshRemapIslandsCalc gen_islands_src,
|
|
|
|
const float islands_precision_src,
|
|
|
|
struct MeshPairRemap *r_map);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-21 15:32:01 +02:00
|
|
|
void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
|
BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.
No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).
This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.
Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).
For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.
Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:23:17 +01:00
|
|
|
const struct SpaceTransform *space_transform,
|
|
|
|
const float max_dist,
|
|
|
|
const float ray_radius,
|
|
|
|
struct MVert *verts_dst,
|
|
|
|
const int numverts_dst,
|
|
|
|
struct MLoop *loops_dst,
|
|
|
|
const int numloops_dst,
|
|
|
|
struct MPoly *polys_dst,
|
|
|
|
const int numpolys_dst,
|
|
|
|
struct CustomData *pdata_dst,
|
|
|
|
const bool dirty_nors_dst,
|
2018-06-21 15:32:01 +02:00
|
|
|
struct Mesh *me_src,
|
|
|
|
struct MeshPairRemap *r_map);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|