Blender V2.61 - r43446
Defines | Functions | Variables

MOD_explode.c File Reference

#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 MFaceget_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 DerivedMeshcutEdges (ExplodeModifierData *emd, DerivedMesh *dm)
static DerivedMeshexplodeMesh (ExplodeModifierData *emd, ParticleSystemModifierData *psmd, Scene *scene, Object *ob, DerivedMesh *to_explode)
static ParticleSystemModifierDatafindPrecedingParticlesystem (Object *ob, ModifierData *emd)
static DerivedMeshapplyModifier (ModifierData *md, Object *ob, DerivedMesh *derivedData, int UNUSED(useRenderParams), int UNUSED(isFinalCalc))

Variables

static const short add_faces [24]
ModifierTypeInfo modifierType_Explode

Detailed Description

Definition in file MOD_explode.c.


Define Documentation

#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);
#define SET_VERTS (   a,
  b,
  c,
 
)
Value:
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().


Function Documentation

static DerivedMesh* applyModifier ( ModifierData md,
Object ob,
DerivedMesh derivedData,
int   UNUSEDuseRenderParams,
int   UNUSEDisFinalCalc 
) [static]
static void copyData ( ModifierData md,
ModifierData target 
) [static]
static void createFacepa ( ExplodeModifierData emd,
ParticleSystemModifierData psmd,
DerivedMesh dm 
) [static]
static DerivedMesh* cutEdges ( ExplodeModifierData emd,
DerivedMesh dm 
) [static]
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]
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]
static void initData ( ModifierData md) [static]
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.


Variable Documentation

const short add_faces[24] [static]
Initial value:
 {
    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.