Blender
V3.3
|
Go to the source code of this file.
Classes | |
struct | ShrinkwrapBoundaryVertData |
struct | ShrinkwrapBoundaryData |
struct | ShrinkwrapTreeData |
Macros | |
#define | NULL_ShrinkwrapCalcData |
#define | NULL_BVHTreeFromMesh |
#define | NULL_BVHTreeRayHit |
#define | NULL_BVHTreeNearest |
Typedefs | |
typedef struct ShrinkwrapBoundaryVertData | ShrinkwrapBoundaryVertData |
typedef struct ShrinkwrapBoundaryData | ShrinkwrapBoundaryData |
typedef struct ShrinkwrapTreeData | ShrinkwrapTreeData |
#define NULL_BVHTreeFromMesh |
Definition at line 204 of file BKE_shrinkwrap.h.
#define NULL_BVHTreeNearest |
Definition at line 212 of file BKE_shrinkwrap.h.
#define NULL_BVHTreeRayHit |
Definition at line 208 of file BKE_shrinkwrap.h.
#define NULL_ShrinkwrapCalcData |
Definition at line 200 of file BKE_shrinkwrap.h.
typedef struct ShrinkwrapBoundaryData ShrinkwrapBoundaryData |
typedef struct ShrinkwrapBoundaryVertData ShrinkwrapBoundaryVertData |
typedef struct ShrinkwrapTreeData ShrinkwrapTreeData |
Definition at line 323 of file shrinkwrap.c.
References BKE_shrinkwrap_discard_boundary_data(), mesh, Mesh::runtime, shrinkwrap_build_boundary_data(), and Mesh_Runtime::shrinkwrap_data.
Referenced by mesh_build_extra_data().
void BKE_shrinkwrap_compute_smooth_normal | ( | const struct ShrinkwrapTreeData * | tree, |
const struct SpaceTransform * | transform, | ||
int | looptri_idx, | ||
const float | hit_co[3], | ||
const float | hit_no[3], | ||
float | r_no[3] | ||
) |
Compute a smooth normal of the target (if applicable) at the hit location.
tree | information about the mesh. |
transform | transform from the hit coordinate space to the object space; may be null. |
r_no | output in hit coordinate space; may be shared with inputs. |
Definition at line 1170 of file shrinkwrap.c.
References BLI_space_transform_apply(), BLI_space_transform_invert_normal(), MVert::co, copy_v3_v3(), float(), interp_v3_v3v3v3(), interp_weights_tri_v3(), BVHTreeFromMesh::loop, BVHTreeFromMesh::looptri, ME_SMOOTH, normalize_v3(), NULL, MLoopTri::poly, transform(), tree, MLoopTri::tri, MLoop::v, BVHTreeFromMesh::vert, and w().
Referenced by BKE_shrinkwrap_snap_point_to_surface(), and shrinkwrap_get_tarmat().
Free boundary data for target project.
Definition at line 152 of file shrinkwrap.c.
References data, MEM_freeN, mesh, NULL, Mesh::runtime, and Mesh_Runtime::shrinkwrap_data.
Referenced by BKE_mesh_runtime_clear_geometry(), and BKE_shrinkwrap_compute_boundary_data().
void BKE_shrinkwrap_find_nearest_surface | ( | struct ShrinkwrapTreeData * | tree, |
struct BVHTreeNearest * | nearest, | ||
float | co[3], | ||
int | type | ||
) |
Maps the point to the nearest surface, either by simple nearest, or by target normal projection.
Definition at line 1066 of file shrinkwrap.c.
References BLI_bvhtree_find_nearest(), BLI_bvhtree_find_nearest_ex(), BVH_NEAREST_OPTIMAL_ORDER, BVHTreeNearest::dist_sq, BVHTreeNearest::index, mesh_looptri_target_project(), MOD_SHRINKWRAP_TARGET_PROJECT, BVHTreeFromMesh::nearest_callback, tree, and type.
Referenced by shrinkwrap_calc_nearest_surface_point_cb_ex(), and shrinkwrap_get_tarmat().
void BKE_shrinkwrap_free_tree | ( | struct ShrinkwrapTreeData * | data | ) |
Frees the tree data if necessary.
Definition at line 147 of file shrinkwrap.c.
References data, and free_bvhtree_from_mesh().
Referenced by bakeModifier(), BKE_gpencil_cache_data_clear(), BKE_gpencil_cache_data_init(), BKE_shrinkwrap_remesh_target_project(), freeData(), shrinkwrap_calc_normal_projection(), shrinkwrap_get_tarmat(), and shrinkwrapModifier_deform().
bool BKE_shrinkwrap_init_tree | ( | struct ShrinkwrapTreeData * | data, |
Mesh * | mesh, | ||
int | shrinkType, | ||
int | shrinkMode, | ||
bool | force_normals | ||
) |
Initializes the mesh data structure from the given mesh and settings.
Definition at line 97 of file shrinkwrap.c.
References BKE_bvhtree_from_mesh_get(), BKE_mesh_poly_normals_ensure(), BKE_mesh_wrapper_ensure_mdata(), BKE_shrinkwrap_needs_normals(), BVHTREE_FROM_LOOPTRI, BVHTREE_FROM_VERTS, CD_NORMAL, CustomData_get_layer(), data, Mesh::flag, Mesh::ldata, ME_AUTOSMOOTH, mesh, MOD_SHRINKWRAP_NEAREST_VERTEX, MOD_SHRINKWRAP_TARGET_PROJECT, NULL, Mesh::runtime, Mesh_Runtime::shrinkwrap_data, Mesh::totpoly, and Mesh::totvert.
Referenced by bakeModifier(), BKE_gpencil_cache_data_init(), BKE_shrinkwrap_remesh_target_project(), shrinkwrap_calc_normal_projection(), shrinkwrap_get_tarmat(), and shrinkwrapModifier_deform().
void BKE_shrinkwrap_mesh_nearest_surface_deform | ( | struct bContext * | C, |
struct Object * | ob_source, | ||
struct Object * | ob_target | ||
) |
Used in editmesh_mask_extract.c
to shrink-wrap the extracted mesh to the sculpt.
Definition at line 1525 of file shrinkwrap.c.
References BKE_mesh_vert_coords_alloc(), BKE_mesh_vert_coords_apply(), C, CTX_data_depsgraph_pointer(), CTX_data_scene(), Object::data, depsgraph, float(), ShrinkwrapModifierData::keepDist, MEM_freeN, MOD_SHRINKWRAP_NEAREST_SURFACE, MOD_SHRINKWRAP_ON_SURFACE, NULL, ShrinkwrapModifierData::shrinkMode, ShrinkwrapModifierData::shrinkType, shrinkwrapModifier_deform(), and ShrinkwrapModifierData::target.
Referenced by geometry_extract_apply().
bool BKE_shrinkwrap_needs_normals | ( | int | shrinkType, |
int | shrinkMode | ||
) |
Checks if the modifier needs target normals with these settings.
Definition at line 90 of file shrinkwrap.c.
References MOD_SHRINKWRAP_ABOVE_SURFACE, MOD_SHRINKWRAP_NEAREST_VERTEX, and MOD_SHRINKWRAP_TARGET_PROJECT.
Referenced by BKE_shrinkwrap_init_tree(), blender::deg::DepsgraphRelationBuilder::build_constraints(), and updateDepsgraph().
bool BKE_shrinkwrap_project_normal | ( | char | options, |
const float | vert[3], | ||
const float | dir[3], | ||
float | ray_radius, | ||
const struct SpaceTransform * | transf, | ||
struct ShrinkwrapTreeData * | tree, | ||
BVHTreeRayHit * | hit | ||
) |
This function ray-cast a single vertex and updates the hit if the "hit" is considered valid.
options | Opts control whether an hit is valid or not. Supported options are:
|
transf | Take into consideration the space_transform, that is: if transf was configured with SPACE_TRANSFORM_SETUP( &transf, ob1, ob2) then the input (vert, dir, BVHTreeRayHit) must be defined in ob1 coordinates space and the BVHTree must be built in ob2 coordinate space. Thus it provides an easy way to cast the same ray across several trees (where each tree was built on its own coords space). |
Referenced by shrinkwrap_get_tarmat().
void BKE_shrinkwrap_remesh_target_project | ( | struct Mesh * | src_me, |
struct Mesh * | target_me, | ||
struct Object * | ob_target | ||
) |
Used in object_remesh.cc
to preserve the details and volume in the voxel remesher.
Definition at line 1550 of file shrinkwrap.c.
References BKE_mesh_vert_coords_alloc(), BKE_mesh_vert_coords_apply(), BKE_mesh_vertex_normals_ensure(), BKE_shrinkwrap_free_tree(), BKE_shrinkwrap_init_tree(), BLI_SPACE_TRANSFORM_SETUP, float(), ShrinkwrapCalcData::keepDist, ShrinkwrapModifierData::keepDist, ShrinkwrapCalcData::local2target, MEM_freeN, MOD_SHRINKWRAP_ON_SURFACE, MOD_SHRINKWRAP_PROJECT, MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR, MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR, Mesh::mvert, NULL_ShrinkwrapCalcData, ShrinkwrapCalcData::numVerts, ShrinkwrapModifierData::projLimit, Mesh::remesh_voxel_size, ShrinkwrapModifierData::shrinkMode, ShrinkwrapModifierData::shrinkOpts, ShrinkwrapModifierData::shrinkType, shrinkwrap_calc_normal_projection(), ShrinkwrapCalcData::smd, ShrinkwrapCalcData::target, ShrinkwrapModifierData::target, TIMEIT_BENCH, Mesh::totvert, ShrinkwrapCalcData::tree, tree, ShrinkwrapCalcData::vert, ShrinkwrapCalcData::vert_normals, ShrinkwrapCalcData::vertexCos, and ShrinkwrapCalcData::vgroup.
Referenced by voxel_remesh_exec().
void BKE_shrinkwrap_snap_point_to_surface | ( | const struct ShrinkwrapTreeData * | tree, |
const struct SpaceTransform * | transform, | ||
int | mode, | ||
int | hit_idx, | ||
const float | hit_co[3], | ||
const float | hit_no[3], | ||
float | goal_dist, | ||
const float | point_co[3], | ||
float | r_point_co[3] | ||
) |
Apply the shrink to surface modes to the given original coordinates and nearest point.
tree | mesh data for smooth normals. |
transform | transform from the hit coordinate space to the object space; may be null. |
r_point_co | may be the same memory location as point_co , hit_co , or hit_no . |
Definition at line 1288 of file shrinkwrap.c.
References BKE_shrinkwrap_compute_smooth_normal(), copy_v3_v3(), madd_v3_v3v3fl(), MOD_SHRINKWRAP_ABOVE_SURFACE, MOD_SHRINKWRAP_INSIDE, MOD_SHRINKWRAP_ON_SURFACE, MOD_SHRINKWRAP_OUTSIDE, MOD_SHRINKWRAP_OUTSIDE_SURFACE, shrinkwrap_snap_with_side(), transform(), and tree.
Referenced by shrinkwrap_calc_nearest_surface_point_cb_ex(), shrinkwrap_calc_normal_projection_cb_ex(), and shrinkwrap_get_tarmat().
void shrinkwrapGpencilModifier_deform | ( | struct ShrinkwrapGpencilModifierData * | mmd, |
struct Object * | ob, | ||
struct MDeformVert * | dvert, | ||
int | defgrp_index, | ||
float(*) | vertexCos[3], | ||
int | numVerts | ||
) |
Definition at line 1476 of file shrinkwrap.c.
References ShrinkwrapGpencilModifierData::aux_target, ShrinkwrapModifierData::auxTarget, BLI_SPACE_TRANSFORM_SETUP, ShrinkwrapGpencilModifierData::cache_data, ShrinkwrapCalcData::dvert, ShrinkwrapGpencilModifierData::flag, GP_SHRINKWRAP_INVERT_VGROUP, ShrinkwrapCalcData::invert_vgroup, ShrinkwrapGpencilModifierData::keep_dist, ShrinkwrapCalcData::keepDist, ShrinkwrapModifierData::keepDist, ShrinkwrapCalcData::local2target, MOD_SHRINKWRAP_NEAREST_SURFACE, MOD_SHRINKWRAP_NEAREST_VERTEX, MOD_SHRINKWRAP_PROJECT, MOD_SHRINKWRAP_TARGET_PROJECT, NULL_ShrinkwrapCalcData, ShrinkwrapCalcData::numVerts, ShrinkwrapCalcData::ob, ShrinkwrapGpencilModifierData::proj_axis, ShrinkwrapGpencilModifierData::proj_limit, ShrinkwrapModifierData::projAxis, ShrinkwrapModifierData::projLimit, ShrinkwrapGpencilModifierData::shrink_mode, ShrinkwrapGpencilModifierData::shrink_opts, ShrinkwrapGpencilModifierData::shrink_type, ShrinkwrapModifierData::shrinkMode, ShrinkwrapModifierData::shrinkOpts, ShrinkwrapModifierData::shrinkType, shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_nearest_vertex(), shrinkwrap_calc_normal_projection(), ShrinkwrapCalcData::smd, ShrinkwrapGpencilModifierData::target, ShrinkwrapModifierData::target, TIMEIT_BENCH, ShrinkwrapCalcData::tree, ShrinkwrapCalcData::vertexCos, and ShrinkwrapCalcData::vgroup.
Referenced by deformStroke().
void shrinkwrapModifier_deform | ( | struct ShrinkwrapModifierData * | smd, |
const struct ModifierEvalContext * | ctx, | ||
struct Scene * | scene, | ||
struct Object * | ob, | ||
struct Mesh * | mesh, | ||
struct MDeformVert * | dvert, | ||
int | defgrp_index, | ||
float(*) | vertexCos[3], | ||
int | numVerts | ||
) |
Main shrink-wrap function (implementation of the shrink-wrap modifier).
Referenced by deformVerts(), and deformVertsEM().