Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Susano Pinto <andresusanopinto@gmail.com>2008-07-04 05:03:50 +0400
committerAndre Susano Pinto <andresusanopinto@gmail.com>2008-07-04 05:03:50 +0400
commitad310b5087ea1605ba235f9ed4cf8292fa4294f7 (patch)
tree647f26aa80c653aaaf936dbe9813f9371f4d61d0 /source/blender/blenkernel/intern/simple_deform.c
parenteca709e4811f7ddbad49633865481fca53a5d588 (diff)
Added modes Squash and Strech to SimpleDeform (need testing)
CHanged the add modifier menu to show a submenu for selecting the type of simpledeform.
Diffstat (limited to 'source/blender/blenkernel/intern/simple_deform.c')
-rw-r--r--source/blender/blenkernel/intern/simple_deform.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/simple_deform.c b/source/blender/blenkernel/intern/simple_deform.c
index bdd0b0e206b..548c53be8ba 100644
--- a/source/blender/blenkernel/intern/simple_deform.c
+++ b/source/blender/blenkernel/intern/simple_deform.c
@@ -66,6 +66,46 @@ static void simpleDeform_tapperXY(const float factor, const float *dcut, float *
}
}
+/* TODO strech and squash need review on function */
+static void simpleDeform_strech(const float factor, const float dcut[3], float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float scale;
+
+ scale = z*factor;
+ scale = scale*scale;
+
+ co[0] += x+x*scale;
+ co[1] += y+y*scale;
+
+ if(dcut)
+ {
+ co[0] += dcut[0]*scale;
+ co[1] += dcut[0]*scale;
+ co[2] += dcut[2];
+ }
+
+}
+
+static void simpleDeform_squash(const float factor, const float dcut[3], float *co)
+{
+ float x = co[0], y = co[1], z = co[2];
+ float scale;
+
+ scale = z*factor;
+ scale = -scale*scale;
+
+ co[0] += x+x*scale;
+ co[1] += y+y*scale;
+
+ if(dcut)
+ {
+ co[0] += dcut[0]*scale;
+ co[1] += dcut[0]*scale;
+ co[2] += dcut[2];
+ }
+}
+
static void simpleDeform_tapperX(const float factor, const float *dcut, float *co)
{
float x = co[0], y = co[1], z = co[2];
@@ -179,6 +219,16 @@ void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, f
axis_limit(2, smd->factor+1, *vertexCos, dcut);
simpleDeform_tapperXY(smd->factor[0], dcut, *vertexCos);
break;
+
+ case MOD_SIMPLEDEFORM_MODE_STRECH:
+ axis_limit(2, smd->factor+1, *vertexCos, dcut);
+ simpleDeform_strech(smd->factor[0], dcut, *vertexCos);
+ break;
+
+ case MOD_SIMPLEDEFORM_MODE_SQUASH:
+ axis_limit(2, smd->factor+1, *vertexCos, dcut);
+ simpleDeform_squash(smd->factor[0], dcut, *vertexCos);
+ break;
}
if(mod2ob)