summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mikos <metastability@opencompositing.org>2008-01-13 17:20:59 +1030
committerDavid Mikos <metastability@opencompositing.org>2008-01-13 17:20:59 +1030
commite4da8a8fa10725442832827bdef607f02de4cbee (patch)
treeb619f9e309b242a666de54400efb7ca14a136ef2
parent7f76db62c9b4529d19b17ddf3ddaa646e85197fa (diff)
downloadsnowglobe-e4da8a8fa10725442832827bdef607f02de4cbee.tar.gz
snowglobe-e4da8a8fa10725442832827bdef607f02de4cbee.tar.bz2
Turn off snowflake interaction when set to false.
-rw-r--r--movement.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/movement.c b/movement.c
index a2e94f1..d5787f7 100644
--- a/movement.c
+++ b/movement.c
@@ -52,25 +52,34 @@ SnowflakeDrift (CompScreen *s, int index)
float sideways = 2*(randf(2*speed)-speed);
float vertical = -speed;
+
+ if (snowglobeGetShakeCube(s))
+ {
+ x+= sideways*cosf(as->xRotate*toRadians)*cosf(as->vRotate*toRadians)
+ -vertical*cosf(as->xRotate*toRadians)*sinf(as->vRotate*toRadians);
+
+ y+= sideways*sinf(as->xRotate*toRadians)*cosf(as->vRotate*toRadians)
+ +vertical*sinf(as->xRotate*toRadians)*sinf(as->vRotate*toRadians);
+
+ z+= sideways*sinf(as->vRotate*toRadians)+vertical*cosf(as->vRotate*toRadians);
+ }
+ else
+ {
+ x+=sideways;
+ y+=sideways;
+ z+=vertical;
+ }
- z+=sideways*sinf(as->vRotate*toRadians)+vertical*cosf(as->vRotate*toRadians);
- x+=sideways*cosf(as->xRotate*toRadians)*cosf(as->vRotate*toRadians)-vertical*cosf(as->xRotate*toRadians)*sinf(as->vRotate*toRadians);
- y+=sideways*sinf(as->xRotate*toRadians)*cosf(as->vRotate*toRadians)+vertical*sinf(as->xRotate*toRadians)*sinf(as->vRotate*toRadians);
float bottom = (renderGround ? getHeight(as->ground, x, y) : -0.5)+0.01*snow->size/2;
if (z<bottom)
{
- //if (snowglobeGetShakeCube(s))
- //{
- // z = bottom;
- //}
- //else {
- z = 0.5;
- newSnowflakePosition(as, index);
- //}
- x = snow->x;
- y = snow->y;
+ z = 0.5;
+ newSnowflakePosition(as, index);
+
+ x = snow->x;
+ y = snow->y;
}
float top = 0.5-0.01*snow->size/2;