Blender V2.61 - r43446
|
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_lattice.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
Go to the source code of this file.
Defines | |
#define | SET_VERTS(a, b, c, d) |
#define | GET_ES(v1, v2) edgecut_get(eh, v1, v2); |
#define | INT_UV(uvf, c0, c1) interp_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1], 0.5f); |
Functions | |
static void | initData (ModifierData *md) |
static void | freeData (ModifierData *md) |
static void | copyData (ModifierData *md, ModifierData *target) |
static int | dependsOnTime (ModifierData *UNUSED(md)) |
static CustomDataMask | requiredDataMask (Object *UNUSED(ob), ModifierData *md) |
static void | createFacepa (ExplodeModifierData *emd, ParticleSystemModifierData *psmd, DerivedMesh *dm) |
static int | edgecut_get (EdgeHash *edgehash, int v1, int v2) |
static MFace * | get_dface (DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFace *mf) |
static void | remap_faces_3_6_9_12 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) |
static void | remap_uvs_3_6_9_12 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) |
static void | remap_faces_5_10 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) |
static void | remap_uvs_5_10 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) |
static void | remap_faces_15 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) |
static void | remap_uvs_15 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) |
static void | remap_faces_7_11_13_14 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) |
static void | remap_uvs_7_11_13_14 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) |
static void | remap_faces_19_21_22 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3) |
static void | remap_uvs_19_21_22 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2) |
static void | remap_faces_23 (DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3) |
static void | remap_uvs_23 (DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2) |
static DerivedMesh * | cutEdges (ExplodeModifierData *emd, DerivedMesh *dm) |
static DerivedMesh * | explodeMesh (ExplodeModifierData *emd, ParticleSystemModifierData *psmd, Scene *scene, Object *ob, DerivedMesh *to_explode) |
static ParticleSystemModifierData * | findPrecedingParticlesystem (Object *ob, ModifierData *emd) |
static DerivedMesh * | applyModifier (ModifierData *md, Object *ob, DerivedMesh *derivedData, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) |
Variables | |
static const short | add_faces [24] |
ModifierTypeInfo | modifierType_Explode |
Definition in file MOD_explode.c.
#define GET_ES | ( | v1, | |
v2 | |||
) | edgecut_get(eh, v1, v2); |
Definition at line 213 of file MOD_explode.c.
Referenced by remap_faces_15(), remap_faces_19_21_22(), remap_faces_23(), remap_faces_3_6_9_12(), remap_faces_5_10(), and remap_faces_7_11_13_14().
#define INT_UV | ( | uvf, | |
c0, | |||
c1 | |||
) | interp_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1], 0.5f); |
Definition at line 214 of file MOD_explode.c.
Referenced by remap_uvs_15(), remap_uvs_19_21_22(), remap_uvs_23(), remap_uvs_3_6_9_12(), remap_uvs_5_10(), and remap_uvs_7_11_13_14().
#define SET_VERTS | ( | a, | |
b, | |||
c, | |||
d | |||
) |
v[0]=mf->v##a; uv[0]=a-1; \ v[1]=mf->v##b; uv[1]=b-1; \ v[2]=mf->v##c; uv[2]=c-1; \ v[3]=mf->v##d; uv[3]=d-1;
Definition at line 207 of file MOD_explode.c.
Referenced by cutEdges().
static DerivedMesh* applyModifier | ( | ModifierData * | md, |
Object * | ob, | ||
DerivedMesh * | derivedData, | ||
int | UNUSEDuseRenderParams, | ||
int | UNUSEDisFinalCalc | ||
) | [static] |
Definition at line 970 of file MOD_explode.c.
References createFacepa(), cutEdges(), ParticleSystemModifierData::dm, eExplodeFlag_CalcFaces, eExplodeFlag_EdgeCut, eParticleSystemFlag_Pars, explodeMesh(), ExplodeModifierData::facepa, findPrecedingParticlesystem(), ExplodeModifierData::flag, ParticleSystemModifierData::flag, DerivedMesh::getNumFaces, MEM_allocN_len(), MEM_freeN(), NULL, ParticleSystem::part, ParticleSystem::particles, ParticleSystemModifierData::psys, DerivedMesh::release, ModifierData::scene, and ParticleSystem::totpart.
static void copyData | ( | ModifierData * | md, |
ModifierData * | target | ||
) | [static] |
Definition at line 72 of file MOD_explode.c.
References ExplodeModifierData::facepa, ExplodeModifierData::flag, NULL, ExplodeModifierData::protect, and ExplodeModifierData::vgroup.
static void createFacepa | ( | ExplodeModifierData * | emd, |
ParticleSystemModifierData * | psmd, | ||
DerivedMesh * | dm | ||
) | [static] |
Definition at line 97 of file MOD_explode.c.
References add_v3_v3(), add_v3_v3v3(), BLI_frand(), BLI_kdtree_balance(), BLI_kdtree_find_nearest(), BLI_kdtree_free(), BLI_kdtree_insert(), BLI_kdtree_new(), BLI_srandom(), CD_MDEFORMVERT, MVert::co, co, defvert_find_weight(), ExplodeModifierData::facepa, ParticleData::foffset, ParticleSettings::from, ParticleData::fuv, DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, DerivedMesh::getVertDataArray, i, MEM_callocN(), MEM_freeN(), mul_v3_fl(), NULL, ParticleData::num, ParticleData::num_dmcache, p, ParticleSystem::part, ParticleSystem::particles, ExplodeModifierData::protect, ParticleSystemModifierData::psys, psys_particle_on_emitter(), ParticleSystem::seed, ParticleSystem::totpart, MFace::v1, MFace::v2, MFace::v3, MFace::v4, simple_enum_gen::val, and ExplodeModifierData::vgroup.
Referenced by applyModifier().
static DerivedMesh* cutEdges | ( | ExplodeModifierData * | emd, |
DerivedMesh * | dm | ||
) | [static] |
Definition at line 544 of file MOD_explode.c.
References add_v3_v3(), BLI_edgehash_free(), BLI_edgehash_insert(), BLI_edgehash_new(), BLI_edgehashIterator_free(), BLI_edgehashIterator_getKey(), BLI_edgehashIterator_getValue(), BLI_edgehashIterator_isDone(), BLI_edgehashIterator_new(), BLI_edgehashIterator_setValue(), BLI_edgehashIterator_step(), CD_MFACE, CD_MTFACE, CDDM_from_template(), CDDM_get_face(), CDDM_get_vert(), MVert::co, CustomData_number_of_layers(), DM_copy_vert_data(), DerivedMesh::faceData, ExplodeModifierData::facepa, get_dface(), GET_INT_FROM_POINTER, DerivedMesh::getFaceArray, DerivedMesh::getFaceData, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVert, i, ME_FACE_SEL, MEM_callocN(), MEM_freeN(), mul_v3_fl(), NULL, remap_faces_15(), remap_faces_19_21_22(), remap_faces_23(), remap_faces_3_6_9_12(), remap_faces_5_10(), remap_faces_7_11_13_14(), remap_uvs_15(), remap_uvs_19_21_22(), remap_uvs_23(), remap_uvs_3_6_9_12(), remap_uvs_5_10(), remap_uvs_7_11_13_14(), SET_INT_IN_POINTER, SET_VERTS, test_index_face(), MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by applyModifier().
static int dependsOnTime | ( | ModifierData * | UNUSEDmd | ) | [static] |
Definition at line 82 of file MOD_explode.c.
static int edgecut_get | ( | EdgeHash * | edgehash, |
int | v1, | ||
int | v2 | ||
) | [static] |
Definition at line 186 of file MOD_explode.c.
References BLI_edgehash_lookup(), and GET_INT_FROM_POINTER.
Referenced by explodeMesh().
static DerivedMesh* explodeMesh | ( | ExplodeModifierData * | emd, |
ParticleSystemModifierData * | psmd, | ||
Scene * | scene, | ||
Object * | ob, | ||
DerivedMesh * | to_explode | ||
) | [static] |
Definition at line 775 of file MOD_explode.c.
References add_v3_v3(), ParticleData::alive, BKE_curframe(), BLI_edgehash_free(), BLI_edgehash_insert(), BLI_edgehash_new(), BLI_edgehashIterator_free(), BLI_edgehashIterator_getKey(), BLI_edgehashIterator_getValue(), BLI_edgehashIterator_isDone(), BLI_edgehashIterator_new(), BLI_edgehashIterator_setValue(), BLI_edgehashIterator_step(), CD_MTFACE, CDDM_calc_edges(), CDDM_calc_normals(), CDDM_from_template(), CDDM_get_face(), CDDM_get_vert(), CLAMP(), ParticleKey::co, MVert::co, CustomData_get_layer_named(), DM_copy_face_data(), DM_copy_vert_data(), edgecut_get(), eExplodeFlag_Alive, eExplodeFlag_Dead, eExplodeFlag_PaSize, eExplodeFlag_Unborn, end_latt_deform(), DerivedMesh::faceData, ExplodeModifierData::facepa, ExplodeModifierData::flag, GET_INT_FROM_POINTER, DerivedMesh::getFace, DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVert, i, invert_m4_m4(), ParticleSystem::lattice, ParticleData::lifetime, mul_m4_v3(), mul_qt_v3(), mul_v3_fl(), NULL, ParticleSimulationData::ob, Object::obmat, PARS_ALIVE, PARS_DEAD, PARS_UNBORN, ParticleSystem::particles, ParticleSimulationData::psmd, ParticleSimulationData::psys, ParticleSystemModifierData::psys, psys_get_birth_coordinates(), psys_get_lattice(), psys_get_particle_state(), ParticleKey::rot, rot, ParticleSimulationData::scene, SET_INT_IN_POINTER, ParticleData::size, state, sub_qt_qtqt(), sub_v3_v3(), test_index_face(), ParticleData::time, ParticleKey::time, ParticleSystem::totpart, ExplodeModifierData::uvname, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by applyModifier().
static ParticleSystemModifierData* findPrecedingParticlesystem | ( | Object * | ob, |
ModifierData * | emd | ||
) | [static] |
Definition at line 959 of file MOD_explode.c.
References eModifierType_ParticleSystem, ListBase::first, Object::modifiers, ModifierData::next, NULL, and ModifierData::type.
Referenced by applyModifier().
static void freeData | ( | ModifierData * | md | ) | [static] |
Definition at line 66 of file MOD_explode.c.
References ExplodeModifierData::facepa, and MEM_freeN().
static MFace* get_dface | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | cur, | ||
int | i, | ||
MFace * | mf | ||
) | [static] |
Definition at line 199 of file MOD_explode.c.
References CDDM_get_face(), and DM_copy_face_data().
Referenced by cutEdges(), remap_faces_15(), remap_faces_19_21_22(), remap_faces_23(), remap_faces_3_6_9_12(), remap_faces_5_10(), and remap_faces_7_11_13_14().
static void initData | ( | ModifierData * | md | ) | [static] |
Definition at line 59 of file MOD_explode.c.
References eExplodeFlag_Alive, eExplodeFlag_Dead, eExplodeFlag_Unborn, ExplodeModifierData::facepa, ExplodeModifierData::flag, and NULL.
static void remap_faces_15 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3, | ||
int | v4 | ||
) | [static] |
Definition at line 317 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_faces_19_21_22 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3 | ||
) | [static] |
Definition at line 446 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_faces_23 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3 | ||
) | [static] |
Definition at line 489 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_faces_3_6_9_12 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3, | ||
int | v4 | ||
) | [static] |
Definition at line 216 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_faces_5_10 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3, | ||
int | v4 | ||
) | [static] |
Definition at line 272 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_faces_7_11_13_14 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
MFace * | mf, | ||
int * | facepa, | ||
int * | vertpa, | ||
int | i, | ||
EdgeHash * | eh, | ||
int | cur, | ||
int | v1, | ||
int | v2, | ||
int | v3, | ||
int | v4 | ||
) | [static] |
Definition at line 389 of file MOD_explode.c.
References MFace::flag, get_dface(), GET_ES, ME_FACE_SEL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by cutEdges().
static void remap_uvs_15 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2, | ||
int | c3 | ||
) | [static] |
Definition at line 353 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static void remap_uvs_19_21_22 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2 | ||
) | [static] |
Definition at line 466 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static void remap_uvs_23 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2 | ||
) | [static] |
Definition at line 517 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static void remap_uvs_3_6_9_12 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2, | ||
int | c3 | ||
) | [static] |
Definition at line 244 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static void remap_uvs_5_10 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2, | ||
int | c3 | ||
) | [static] |
Definition at line 292 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static void remap_uvs_7_11_13_14 | ( | DerivedMesh * | dm, |
DerivedMesh * | split, | ||
int | numlayer, | ||
int | i, | ||
int | cur, | ||
int | c0, | ||
int | c1, | ||
int | c2, | ||
int | c3 | ||
) | [static] |
Definition at line 417 of file MOD_explode.c.
References CD_MTFACE, copy_v2_v2(), CustomData_get_layer_n(), DerivedMesh::faceData, i, INT_UV, and MTFace::uv.
Referenced by cutEdges().
static CustomDataMask requiredDataMask | ( | Object * | UNUSEDob, |
ModifierData * | md | ||
) | [static] |
Definition at line 86 of file MOD_explode.c.
References CD_MASK_MDEFORMVERT, and ExplodeModifierData::vgroup.
const short add_faces[24] [static] |
{ 0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 1, 1, 2 }
Definition at line 192 of file MOD_explode.c.
{ "Explode", "ExplodeModifierData", sizeof(ExplodeModifierData), eModifierTypeType_Constructive, eModifierTypeFlag_AcceptsMesh, copyData, NULL, NULL, NULL, NULL, applyModifier, NULL, initData, requiredDataMask, freeData, NULL, NULL, dependsOnTime, NULL, NULL, NULL, NULL, }
Definition at line 1018 of file MOD_explode.c.