diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
commit | 816377cc02fe5dd4be945c0f3d415861114b4980 (patch) | |
tree | 306e9d1363aa66bc919e43b80b3380fab9f60ea9 /source/blender/blenkernel/intern/modifier.c | |
parent | c8af263e5d8d9d41a757e8438cdcf3b64d57e0c0 (diff) | |
parent | ee768ada680ce0a8aa184c882005c0ef1c0140fb (diff) |
Undo revision 23130 which was a merge with 2.5, a messy one because I did something wrong (`svn status` output: http://www.pasteall.org/7887).soc-2009-kazanbas
The command: svn merge -r 23130:23129 https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-kazanbas
Diffstat (limited to 'source/blender/blenkernel/intern/modifier.c')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 98 |
1 files changed, 52 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index f06173264ee..53d1baa5c9c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -73,12 +73,11 @@ #include "BLI_editVert.h" - - +#include "MTC_matrixops.h" +#include "MTC_vectorops.h" #include "BKE_main.h" #include "BKE_anim.h" -#include "BKE_action.h" #include "BKE_bmesh.h" // XXX #include "BKE_booleanops.h" #include "BKE_cloth.h" @@ -1190,7 +1189,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, if(amd->end_cap && amd->end_cap != ob) end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH); - Mat4One(offset); + MTC_Mat4One(offset); indexMap = MEM_callocN(sizeof(*indexMap) * dm->getNumVerts(dm), "indexmap"); @@ -1212,14 +1211,14 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, float result_mat[4][4]; if(ob) - Mat4Invert(obinv, ob->obmat); + MTC_Mat4Invert(obinv, ob->obmat); else - Mat4One(obinv); + MTC_Mat4One(obinv); - Mat4MulSerie(result_mat, offset, + MTC_Mat4MulSerie(result_mat, offset, obinv, amd->offset_ob->obmat, NULL, NULL, NULL, NULL, NULL); - Mat4CpyMat4(offset, result_mat); + MTC_Mat4CpyMat4(offset, result_mat); } if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) { @@ -1244,7 +1243,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, prescribed length */ if(amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) { - float dist = sqrt(Inpf(offset[3], offset[3])); + float dist = sqrt(MTC_dot3Float(offset[3], offset[3])); if(dist > 1e-6f) /* this gives length = first copy start to last copy end @@ -1277,11 +1276,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, result = CDDM_from_template(dm, finalVerts, finalEdges, finalFaces); /* calculate the offset matrix of the final copy (for merging) */ - Mat4One(final_offset); + MTC_Mat4One(final_offset); for(j=0; j < count - 1; j++) { - Mat4MulMat4(tmp_mat, final_offset, offset); - Mat4CpyMat4(final_offset, tmp_mat); + MTC_Mat4MulMat4(tmp_mat, final_offset, offset); + MTC_Mat4CpyMat4(final_offset, tmp_mat); } numVerts = numEdges = numFaces = 0; @@ -1317,7 +1316,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, if((count > 1) && (amd->flags & MOD_ARR_MERGE)) { float tmp_co[3]; VECCOPY(tmp_co, mv->co); - Mat4MulVecfl(offset, tmp_co); + MTC_Mat4MulVecfl(offset, tmp_co); for(j = 0; j < maxVerts; j++) { /* if vertex already merged, don't use it */ @@ -1332,7 +1331,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, if(amd->flags & MOD_ARR_MERGEFINAL) { VECCOPY(tmp_co, inMV->co); inMV = &src_mvert[i]; - Mat4MulVecfl(final_offset, tmp_co); + MTC_Mat4MulVecfl(final_offset, tmp_co); if(VecLenCompare(tmp_co, inMV->co, amd->merge_dist)) indexMap[i].merge_final = 1; } @@ -1350,7 +1349,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, *mv2 = *mv; numVerts++; - Mat4MulVecfl(offset, co); + MTC_Mat4MulVecfl(offset, co); VECCOPY(mv2->co, co); } } else if(indexMap[i].merge != i && indexMap[i].merge_final) { @@ -3182,7 +3181,7 @@ static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle, /* we know the edge has 2 faces, so check the angle */ SmoothFace *face1 = edge->faces->link; SmoothFace *face2 = edge->faces->next->link; - float edge_angle_cos = Inpf(face1->normal, + float edge_angle_cos = MTC_dot3Float(face1->normal, face2->normal); if(edge_angle_cos < threshold) { @@ -4051,11 +4050,11 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, /* find the projector which the face points at most directly * (projector normal with largest dot product is best) */ - best_dot = Inpf(projectors[0].normal, face_no); + best_dot = MTC_dot3Float(projectors[0].normal, face_no); best_projector = &projectors[0]; for(j = 1; j < num_projectors; ++j) { - float tmp_dot = Inpf(projectors[j].normal, + float tmp_dot = MTC_dot3Float(projectors[j].normal, face_no); if(tmp_dot > best_dot) { best_dot = tmp_dot; @@ -5599,7 +5598,6 @@ static void hookModifier_copyData(ModifierData *md, ModifierData *target) thmd->indexar = MEM_dupallocN(hmd->indexar); memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv)); strncpy(thmd->name, hmd->name, 32); - strncpy(thmd->subtarget, hmd->subtarget, 32); } CustomDataMask hookModifier_requiredDataMask(Object *ob, ModifierData *md) @@ -5644,11 +5642,9 @@ static void hookModifier_updateDepgraph(ModifierData *md, DagForest *forest, Sce if (hmd->object) { DagNode *curNode = dag_get_node(forest, hmd->object); - - if (hmd->subtarget[0]) - dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, "Hook Modifier"); - else - dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, "Hook Modifier"); + + dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, + "Hook Modifier"); } } @@ -5657,22 +5653,12 @@ static void hookModifier_deformVerts( float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) { HookModifierData *hmd = (HookModifierData*) md; - bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); - float vec[3], mat[4][4], dmat[4][4]; + float vec[3], mat[4][4]; int i; DerivedMesh *dm = derivedData; - - /* get world-space matrix of target, corrected for the space the verts are in */ - if (hmd->subtarget[0] && pchan) { - /* bone target if there's a matching pose-channel */ - Mat4MulMat4(dmat, pchan->pose_mat, hmd->object->obmat); - } - else { - /* just object target */ - Mat4CpyMat4(dmat, hmd->object->obmat); - } + Mat4Invert(ob->imat, ob->obmat); - Mat4MulSerie(mat, ob->imat, dmat, hmd->parentinv, + Mat4MulSerie(mat, ob->imat, hmd->object->obmat, hmd->parentinv, NULL, NULL, NULL, NULL, NULL); /* vertex indices? */ @@ -5729,8 +5715,7 @@ static void hookModifier_deformVerts( } } } - } - else if(hmd->name[0]) { /* vertex group hook */ + } else { /* vertex group hook */ bDeformGroup *curdef; Mesh *me = ob->data; int index = 0; @@ -5816,6 +5801,26 @@ static void smokeModifier_initData(ModifierData *md) smd->coll = NULL; smd->type = 0; smd->time = -1; + + /* + smd->fluid = NULL; + smd->maxres = 48; + smd->amplify = 4; + smd->omega = 0.5; + smd->time = 0; + smd->flags = 0; + smd->noise = MOD_SMOKE_NOISEWAVE; + smd->visibility = 1; + + // init 3dview buffer + smd->tvox = NULL; + smd->tray = NULL; + smd->tvoxbig = NULL; + smd->traybig = NULL; + smd->viewsettings = 0; + smd->bind = NULL; + smd->max_textures = 0; + */ } static void smokeModifier_freeData(ModifierData *md) @@ -6696,8 +6701,10 @@ static DerivedMesh * particleInstanceModifier_applyModifier( if((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path){ float ran = 0.0f; if(pimd->random_position != 0.0f) { - BLI_srandom(psys->seed + (i/totvert)%totpart); - ran = pimd->random_position * BLI_frand(); + /* just use some static collection of random numbers */ + /* TODO: use something else that's unique to each instanced object */ + pa = psys->particles + (i/totvert)%totpart; + ran = pimd->random_position * 0.5 * (1.0f + pa->r_ave[0]); } if(pimd->flag & eParticleInstanceFlag_KeepShape) { @@ -8071,13 +8078,14 @@ static DerivedMesh *multiresModifier_applyModifier(ModifierData *md, Object *ob, int useRenderParams, int isFinalCalc) { MultiresModifierData *mmd = (MultiresModifierData*)md; + Mesh *me = get_mesh(ob); DerivedMesh *final; /* TODO: for now just skip a level1 mesh */ if(mmd->lvl == 1) return dm; - final = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams, isFinalCalc); + final = multires_dm_create_from_derived(mmd, dm, me, useRenderParams, isFinalCalc); if(mmd->undo_signal && mmd->undo_verts && mmd->undo_verts_tot == final->getNumVerts(final)) { int i; MVert *dst = CDDM_get_verts(final); @@ -8572,9 +8580,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti->type = eModifierTypeType_OnlyDeform; mti->initData = smokeModifier_initData; mti->freeData = smokeModifier_freeData; - mti->flags = eModifierTypeFlag_AcceptsMesh - | eModifierTypeFlag_UsesPointCache - | eModifierTypeFlag_Single; + mti->flags = eModifierTypeFlag_AcceptsMesh; mti->deformVerts = smokeModifier_deformVerts; mti->dependsOnTime = smokeModifier_dependsOnTime; mti->updateDepgraph = smokeModifier_updateDepgraph; @@ -8605,7 +8611,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(Surface); mti->type = eModifierTypeType_OnlyDeform; mti->initData = surfaceModifier_initData; - mti->flags = eModifierTypeFlag_AcceptsMesh|eModifierTypeFlag_NoUserAdd; + mti->flags = eModifierTypeFlag_AcceptsMesh; mti->dependsOnTime = surfaceModifier_dependsOnTime; mti->freeData = surfaceModifier_freeData; mti->deformVerts = surfaceModifier_deformVerts; |