Upgrades to the UVProject modifier:

- New perspective projection capability. If a camera is used as the
   projection object, the modifier detects whether to do perspective or
   orthographic projection based on the camera type. If any other object
   type is used as the projection object, orthographic projection is used.
 - Orthographic projection actually works properly now.
 - The projected UVs are scaled and offset so that the image is centred in
   the projecting camera's view.
 - AspX and AspY inputs have been added to control the aspect ratio of the
   projected UVs.

Also:
 - I have added the Mat4MulVec3Project() function to BLI_arithb.h; this
   function converts a 3-dimensional vector to homogeneous coordinates
   (4-dimensional, with the 4th dimension set to 1), multiplies it with the
   given matrix, then projects it back to 3 dimensions by dividing through
   with the 4th dimension. This is useful when using projection matrices.
This commit is contained in:
2006-11-22 15:09:41 +00:00
parent 03f4a36d73
commit bb7ad80269
5 changed files with 107 additions and 32 deletions

View File

@@ -1355,7 +1355,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
height = 124;
if(dmd->texmapping == MOD_DISP_MAP_OBJECT) height += 19;
} else if (md->type==eModifierType_UVProject) {
height = 67 + ((UVProjectModifierData *)md)->num_projectors * 19;
height = 86 + ((UVProjectModifierData *)md)->num_projectors * 19;
} else if (md->type==eModifierType_Decimate) {
height = 48;
} else if (md->type==eModifierType_Wave) {
@@ -1509,6 +1509,15 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
lx, (cy-=19), buttonWidth, 19,
&umd->flags, 0, 0, 0, 0,
"Add UV coordinates if missing");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspX:",
lx, (cy -= 19), buttonWidth / 2, 19, &umd->aspectx,
1, 1000, 100, 2,
"Horizontal Aspect Ratio");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspY:",
lx + (buttonWidth / 2) + 1, cy, buttonWidth / 2, 19,
&umd->aspecty,
1, 1000, 100, 2,
"Vertical Aspect Ratio");
uiDefButI(block, NUM, B_MODIFIER_RECALC, "Projectors:",
lx, (cy -= 19), buttonWidth, 19, &umd->num_projectors,
1, MOD_UVPROJECT_MAXPROJECTORS, 0, 0,