summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mikos <metastability@opencompositing.org>2008-01-19 12:35:29 +1030
committerDavid Mikos <metastability@opencompositing.org>2008-01-19 12:35:29 +1030
commit5d7953fd9aa3dc84e06975492daf1bc351216ebf (patch)
tree8db26c5baa5de0189af4654917b06ac180707244
parente4da8a8fa10725442832827bdef607f02de4cbee (diff)
downloadsnowglobe-5d7953fd9aa3dc84e06975492daf1bc351216ebf.tar.gz
snowglobe-5d7953fd9aa3dc84e06975492daf1bc351216ebf.tar.bz2
Adjust vertical angle in interaction for current viewport.
-rw-r--r--movement.c19
-rw-r--r--snowglobe.xml.in2
2 files changed, 13 insertions, 8 deletions
diff --git a/movement.c b/movement.c
index d5787f7..3711fd3 100644
--- a/movement.c
+++ b/movement.c
@@ -42,6 +42,9 @@ SnowflakeDrift (CompScreen *s, int index)
(*cs->getRotation) (s, &(as->xRotate), &(as->vRotate));
+ as->xRotate = fmodf( as->xRotate-cs->invert * (360.0f / s->hsize) *
+ ((s->x* cs->nOutput)), 360 );
+
snowflakeRec * snow = &(as->snow[index]);
float speed = snow->speed*speedFactor;
@@ -61,7 +64,8 @@ SnowflakeDrift (CompScreen *s, int index)
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);
+ z+= sideways*sinf(as->vRotate*toRadians)
+ +vertical*cosf(as->vRotate*toRadians);
}
else
{
@@ -82,7 +86,7 @@ SnowflakeDrift (CompScreen *s, int index)
y = snow->y;
}
- float top = 0.5-0.01*snow->size/2;
+ float top = 0.5-0.01*snow->size/2;
if (z>top)
{
z = top;
@@ -98,12 +102,13 @@ SnowflakeDrift (CompScreen *s, int index)
if (cosAng<=0)
continue;
- float d = (distance-0.01*snow->size/2)/cosAng;
- float r = hypot(x, y);
- if (r>d)
+ float r = hypotf(x, y);
+ float d = r*cosAng-(distance-0.01*snow->size/2);
+
+ if (d>0)
{
- x = d*cosf(ang);
- y = d*sinf(ang);
+ x -= d*cosf(ang)*fabsf(cosf(2*i*PI/q));
+ y -= d*sinf(ang)*fabsf(sinf(2*i*PI/q));
}
}
diff --git a/snowglobe.xml.in b/snowglobe.xml.in
index 767af31..b4dbe69 100644
--- a/snowglobe.xml.in
+++ b/snowglobe.xml.in
@@ -8,7 +8,7 @@
<relation type="after">
<plugin>cube</plugin>
<plugin>rotate</plugin>
- <plugin>mswitch</plugin>
+ <plugin>vpswitch</plugin>
</relation>
<requirement>
<plugin>cube</plugin>