Blender V2.61 - r43446
|
#include <string.h>
#include <float.h>
#include <math.h>
#include <memory.h>
#include <stdio.h>
#include <time.h>
#include <assert.h>
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_shrinkwrap.h"
#include "BKE_DerivedMesh.h"
#include "BKE_lattice.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_subsurf.h"
Go to the source code of this file.
Definition in file shrinkwrap.c.
#define BENCH | ( | a | ) | (a) |
Definition at line 81 of file shrinkwrap.c.
Referenced by shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_nearest_vertex(), and shrinkwrapModifier_deform().
#define OUT_OF_MEMORY | ( | ) | ((void)printf("Shrinkwrap: Out of memory\n")) |
Definition at line 59 of file shrinkwrap.c.
Referenced by shrinkwrap_calc_nearest_surface_point(), and shrinkwrap_calc_nearest_vertex().
typedef void( * Shrinkwrap_ForeachVertexCallback)(DerivedMesh *target, float *co, float *normal) |
Definition at line 85 of file shrinkwrap.c.
int normal_projection_project_vertex | ( | char | options, |
const float * | vert, | ||
const float * | dir, | ||
const SpaceTransform * | transf, | ||
BVHTree * | tree, | ||
BVHTreeRayHit * | hit, | ||
BVHTree_RayCastCallback | callback, | ||
void * | userdata | ||
) |
Definition at line 217 of file shrinkwrap.c.
References BLI_bvhtree_ray_cast(), BVHTreeRayHit::co, co, copy_v3_v3(), BVHTreeRayHit::dist, dot(), dot_v3v3(), FALSE, BVHTreeRayHit::index, len_v3v3(), mat4_to_scale(), MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, BVHTreeRayHit::no, space_transform_apply(), space_transform_apply_normal(), space_transform_invert(), space_transform_invert_normal(), and TRUE.
Referenced by shrinkwrap_calc_normal_projection(), and shrinkwrap_get_tarmat().
DerivedMesh* object_get_derived_final | ( | Object * | ob | ) | [read] |
Definition at line 89 of file shrinkwrap.c.
References BKE_mesh_end_editmesh(), BKE_mesh_get_editmesh(), Object::data, Object::derivedFinal, and EditMesh::derivedFinal.
Referenced by shrinkwrap_calc_normal_projection(), shrinkwrap_get_tarmat(), and shrinkwrapModifier_deform().
static void shrinkwrap_calc_nearest_surface_point | ( | ShrinkwrapCalcData * | calc | ) | [static] |
Definition at line 410 of file shrinkwrap.c.
References BENCH, BLI_bvhtree_find_nearest(), bvhtree_from_mesh_faces(), BVHTreeNearest::co, MVert::co, co, copy_v3_v3(), defvert_array_find_weight_safe(), BVHTreeNearest::dist, ShrinkwrapCalcData::dvert, FLT_MAX, free_bvhtree_from_mesh(), i, BVHTreeNearest::index, interp_v3_v3v3(), ShrinkwrapCalcData::keepDist, len_squared_v3v3(), ShrinkwrapCalcData::local2target, madd_v3_v3v3fl(), MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE, BVHTreeFromMesh::nearest_callback, BVHTreeNearest::no, NULL, NULL_BVHTreeFromMesh, NULL_BVHTreeNearest, ShrinkwrapCalcData::numVerts, OUT_OF_MEMORY, sasqrt(), ShrinkwrapModifierData::shrinkOpts, ShrinkwrapCalcData::smd, space_transform_apply(), space_transform_invert(), ShrinkwrapCalcData::target, BVHTreeFromMesh::tree, ShrinkwrapCalcData::vert, ShrinkwrapCalcData::vertexCos, and ShrinkwrapCalcData::vgroup.
Referenced by shrinkwrapModifier_deform().
static void shrinkwrap_calc_nearest_vertex | ( | ShrinkwrapCalcData * | calc | ) | [static] |
Definition at line 140 of file shrinkwrap.c.
References BENCH, BLI_bvhtree_find_nearest(), bvhtree_from_mesh_verts(), BVHTreeNearest::co, MVert::co, co, copy_v3_v3(), defvert_array_find_weight_safe(), BVHTreeNearest::dist, ShrinkwrapCalcData::dvert, FLT_MAX, free_bvhtree_from_mesh(), i, BVHTreeNearest::index, interp_v3_v3v3(), ShrinkwrapCalcData::keepDist, len_squared_v3v3(), ShrinkwrapCalcData::local2target, BVHTreeFromMesh::nearest_callback, NULL, NULL_BVHTreeFromMesh, NULL_BVHTreeNearest, ShrinkwrapCalcData::numVerts, OUT_OF_MEMORY, sasqrt(), space_transform_apply(), space_transform_invert(), ShrinkwrapCalcData::target, BVHTreeFromMesh::tree, ShrinkwrapCalcData::vert, ShrinkwrapCalcData::vertexCos, and ShrinkwrapCalcData::vgroup.
Referenced by shrinkwrapModifier_deform().
static void shrinkwrap_calc_normal_projection | ( | ShrinkwrapCalcData * | calc | ) | [static] |
Definition at line 278 of file shrinkwrap.c.
References ShrinkwrapModifierData::auxTarget, bvhtree_from_mesh_faces(), BVHTreeRayHit::co, MVert::co, co, copy_v3_v3(), defvert_array_find_weight_safe(), BVHTreeRayHit::dist, dot_v3v3(), ShrinkwrapCalcData::dvert, free_bvhtree_from_mesh(), i, BVHTreeRayHit::index, interp_v3_v3v3(), ShrinkwrapCalcData::keepDist, ShrinkwrapCalcData::local2target, madd_v3_v3v3fl(), MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR, MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR, MOD_SHRINKWRAP_PROJECT_OVER_NORMAL, MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS, MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS, MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS, negate_v3_v3(), MVert::no, normal_projection_project_vertex(), normal_short_to_float_v3(), normalize_v3(), NULL, NULL_BVHTreeFromMesh, ShrinkwrapCalcData::numVerts, ShrinkwrapCalcData::ob, object_get_derived_final(), ShrinkwrapModifierData::projAxis, BVHTreeFromMesh::raycast_callback, ShrinkwrapModifierData::shrinkOpts, ShrinkwrapCalcData::smd, space_transform_setup, ShrinkwrapCalcData::target, BVHTreeFromMesh::tree, ShrinkwrapCalcData::vert, ShrinkwrapCalcData::vertexCos, and ShrinkwrapCalcData::vgroup.
Referenced by shrinkwrapModifier_deform().
void shrinkwrapModifier_deform | ( | ShrinkwrapModifierData * | smd, |
Object * | ob, | ||
DerivedMesh * | dm, | ||
float(*) | vertexCos[3], | ||
int | numVerts | ||
) |
Definition at line 492 of file shrinkwrap.c.
References assert, ShrinkwrapModifierData::auxTarget, BENCH, CD_MDEFORMVERT, CD_MVERT, defgroup_name_index(), ShrinkwrapCalcData::dvert, SubsurfModifierData::emCache, FALSE, DerivedMesh::getNumVerts, DerivedMesh::getVertDataArray, ShrinkwrapModifierData::keepDist, ShrinkwrapCalcData::keepDist, lattice_get_deform_verts(), SubsurfModifierData::levels, ShrinkwrapCalcData::local2target, SubsurfModifierData::mCache, ME_CC_SUBSURF, MOD_SHRINKWRAP_NEAREST_SURFACE, MOD_SHRINKWRAP_NEAREST_VERTEX, MOD_SHRINKWRAP_PROJECT, Object::mode, NULL, NULL_ShrinkwrapCalcData, ShrinkwrapCalcData::numVerts, ShrinkwrapCalcData::ob, OB_LATTICE, OB_MODE_EDIT, object_get_derived_final(), DerivedMesh::release, ShrinkwrapModifierData::shrinkType, shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_nearest_vertex(), shrinkwrap_calc_normal_projection(), ShrinkwrapCalcData::smd, space_transform_setup, SubsurfModifierData::subdivType, subsurf_make_derived_from_derived(), ShrinkwrapModifierData::subsurfLevels, ShrinkwrapCalcData::target, ShrinkwrapModifierData::target, Object::type, ShrinkwrapCalcData::vert, ShrinkwrapCalcData::vertexCos, ShrinkwrapCalcData::vgroup, and ShrinkwrapModifierData::vgroup_name.
Referenced by deformVerts(), and deformVertsEM().
void space_transform_apply | ( | const SpaceTransform * | data, |
float * | co | ||
) |
Definition at line 112 of file shrinkwrap.c.
References mul_v3_m4v3().
static void space_transform_apply_normal | ( | const SpaceTransform * | data, |
float * | no | ||
) | [static] |
Definition at line 122 of file shrinkwrap.c.
References mul_mat3_m4_v3(), and normalize_v3().
Referenced by normal_projection_project_vertex().
void space_transform_from_matrixs | ( | SpaceTransform * | data, |
float | local[4][4], | ||
float | target[4][4] | ||
) |
Definition at line 104 of file shrinkwrap.c.
References invert_m4_m4(), SpaceTransform::local2target, mul_serie_m4(), NULL, and SpaceTransform::target2local.
Referenced by shrinkwrap_get_tarmat(), and SimpleDeformModifier_do().
void space_transform_invert | ( | const SpaceTransform * | data, |
float * | co | ||
) |
Definition at line 117 of file shrinkwrap.c.
References mul_v3_m4v3().
static void space_transform_invert_normal | ( | const SpaceTransform * | data, |
float * | no | ||
) | [static] |
Definition at line 128 of file shrinkwrap.c.
References mul_mat3_m4_v3(), and normalize_v3().
Referenced by normal_projection_project_vertex().