Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_wave.c
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | static void waveModifier_do( | ||||
| if ((wmd->flag & MOD_WAVE_NORM) && (mesh != NULL)) { | if ((wmd->flag & MOD_WAVE_NORM) && (mesh != NULL)) { | ||||
| mvert = mesh->mvert; | mvert = mesh->mvert; | ||||
| } | } | ||||
| if (wmd->objectcenter != NULL) { | if (wmd->objectcenter != NULL) { | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| /* get the control object's location in local coordinates */ | /* get the control object's location in local coordinates */ | ||||
| invert_m4_m4(ob->imat, ob->obmat); | invert_m4_m4(ob->imat, ob->obmat); | ||||
| mul_m4_m4m4(mat, ob->imat, DEG_get_evaluated_object(ctx->depsgraph, wmd->objectcenter)->obmat); | mul_m4_m4m4(mat, ob->imat, wmd->objectcenter->obmat); | ||||
| wmd->startx = mat[3][0]; | wmd->startx = mat[3][0]; | ||||
| wmd->starty = mat[3][1]; | wmd->starty = mat[3][1]; | ||||
| } | } | ||||
| /* get the index of the deform group */ | /* get the index of the deform group */ | ||||
| MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index); | MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index); | ||||
| if (wmd->damp == 0.0f) { | if (wmd->damp == 0.0f) { | ||||
| wmd->damp = 10.0f; | wmd->damp = 10.0f; | ||||
| } | } | ||||
| if (wmd->lifetime != 0.0f) { | if (wmd->lifetime != 0.0f) { | ||||
| float x = ctime - wmd->timeoffs; | float x = ctime - wmd->timeoffs; | ||||
| if (x > wmd->lifetime) { | if (x > wmd->lifetime) { | ||||
| lifefac = x - wmd->lifetime; | lifefac = x - wmd->lifetime; | ||||
| if (lifefac > wmd->damp) lifefac = 0.0; | if (lifefac > wmd->damp) lifefac = 0.0; | ||||
| else lifefac = (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp))); | else lifefac = (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp))); | ||||
| } | } | ||||
| } | } | ||||
| Tex *tex_target = (Tex *)DEG_get_evaluated_id(ctx->depsgraph, &wmd->texture->id); | Tex *tex_target = wmd->texture; | ||||
| if (mesh != NULL && tex_target != NULL) { | if (mesh != NULL && tex_target != NULL) { | ||||
| tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "waveModifier_do tex_co"); | tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "waveModifier_do tex_co"); | ||||
| MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co); | MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co); | ||||
| MOD_init_texture((MappingInfoModifierData *)wmd, ctx); | MOD_init_texture((MappingInfoModifierData *)wmd, ctx); | ||||
| } | } | ||||
| if (lifefac != 0.0f) { | if (lifefac != 0.0f) { | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||