Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_uvproject.c
| Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | typedef struct Projector { | ||||
| Object *ob; /* object this projector is derived from */ | Object *ob; /* object this projector is derived from */ | ||||
| float projmat[4][4]; /* projection matrix */ | float projmat[4][4]; /* projection matrix */ | ||||
| float normal[3]; /* projector normal in world space */ | float normal[3]; /* projector normal in world space */ | ||||
| void *uci; /* optional uv-project info (panorama projection) */ | void *uci; /* optional uv-project info (panorama projection) */ | ||||
| } Projector; | } Projector; | ||||
| static Mesh *uvprojectModifier_do( | static Mesh *uvprojectModifier_do( | ||||
| UVProjectModifierData *umd, | UVProjectModifierData *umd, | ||||
| const ModifierEvalContext *ctx, | const ModifierEvalContext *UNUSED(ctx), | ||||
| Object *ob, Mesh *mesh) | Object *ob, Mesh *mesh) | ||||
| { | { | ||||
| float (*coords)[3], (*co)[3]; | float (*coords)[3], (*co)[3]; | ||||
| MLoopUV *mloop_uv; | MLoopUV *mloop_uv; | ||||
| int i, numVerts, numPolys, numLoops; | int i, numVerts, numPolys, numLoops; | ||||
| MPoly *mpoly, *mp; | MPoly *mpoly, *mp; | ||||
| MLoop *mloop; | MLoop *mloop; | ||||
| Projector projectors[MOD_UVPROJECT_MAXPROJECTORS]; | Projector projectors[MOD_UVPROJECT_MAXPROJECTORS]; | ||||
| int num_projectors = 0; | int num_projectors = 0; | ||||
| char uvname[MAX_CUSTOMDATA_LAYER_NAME]; | char uvname[MAX_CUSTOMDATA_LAYER_NAME]; | ||||
| float aspx = umd->aspectx ? umd->aspectx : 1.0f; | float aspx = umd->aspectx ? umd->aspectx : 1.0f; | ||||
| float aspy = umd->aspecty ? umd->aspecty : 1.0f; | float aspy = umd->aspecty ? umd->aspecty : 1.0f; | ||||
| float scax = umd->scalex ? umd->scalex : 1.0f; | float scax = umd->scalex ? umd->scalex : 1.0f; | ||||
| float scay = umd->scaley ? umd->scaley : 1.0f; | float scay = umd->scaley ? umd->scaley : 1.0f; | ||||
| int free_uci = 0; | int free_uci = 0; | ||||
| for (i = 0; i < umd->num_projectors; ++i) { | for (i = 0; i < umd->num_projectors; ++i) { | ||||
| if (umd->projectors[i] != NULL) { | if (umd->projectors[i] != NULL) { | ||||
| projectors[num_projectors++].ob = DEG_get_evaluated_object(ctx->depsgraph, umd->projectors[i]); | projectors[num_projectors++].ob = umd->projectors[i]; | ||||
| } | } | ||||
| } | } | ||||
| if (num_projectors == 0) | if (num_projectors == 0) | ||||
| return mesh; | return mesh; | ||||
| /* make sure there are UV Maps available */ | /* make sure there are UV Maps available */ | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||