summaryrefslogtreecommitdiff
path: root/gui/src/chainImage.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2018-10-30 20:10:58 +0000
committerTim Redfern <tim@getdrop.com>2018-10-30 20:10:58 +0000
commitdf6bab24013e032f7d1b789fa5eceba970d8af71 (patch)
tree4de813650782cc9d27c4122faac6d5d3e1c88cea /gui/src/chainImage.cpp
parent6cb9f862c393ad2557021d0777122b2d49d0a972 (diff)
Diffstat (limited to 'gui/src/chainImage.cpp')
-rw-r--r--gui/src/chainImage.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/gui/src/chainImage.cpp b/gui/src/chainImage.cpp
index b3be16c..f84f23a 100644
--- a/gui/src/chainImage.cpp
+++ b/gui/src/chainImage.cpp
@@ -147,12 +147,22 @@ int chainImage::updateOutput(float decayRatio){
(link->getLinkPos().x*cos(getLinkRot()*(PI/180)))-(link->getLinkPos().y*sin(getLinkRot()*(PI/180))),
(link->getLinkPos().y*cos(getLinkRot()*(PI/180)))+(link->getLinkPos().x*sin(getLinkRot()*(PI/180)))
);
+
+ float aspectscale;
+ if (link->getWidth()>0.0f){
+ aspectscale=getWidth()/link->getWidth();
+ }
+ else {
+ aspectscale=1.0f;
+ }
- ofPoint destination=getLinkPos()+(rotated_destination*getLinkScale());
- ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*(1.0f-BEZIER_IN));
+ ofPoint destination=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale);
+ ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale*(1.0f-BEZIER_IN));
+ ofPoint first=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale*BEZIER_OUT);
path.bezierTo(
- getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale)) ,
+ getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale*aspectscale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale*aspectscale)),
+ //first.x,first.y,
previous.x,previous.y,
destination.x,destination.y);
@@ -464,8 +474,22 @@ void chainImage::drawChain(float fadeIn,bool additive,float intensity,float zoom
//this is worse why?
float zoomFactor=pow(zoomMultiplier,1.0f+transition);
- //allow for aspect change
- zoomFactor*=(getWidth()/link->getWidth());
+ //allow for aspect change -
+ float aspectfactor=(getWidth()/link->getWidth());
+ //works as long as both images are centred at 0,0
+ //there's a jump where a movement is introduced so there must be another term to be scaled
+
+ //1 - how does this work?
+ //the outgoing picture is scaled up if it is wider
+ //the incoming picture has a fixed relationship to the outgoing
+ //when transition hits 1.0, the incoming picture is exactly where it will be
+ //as the outgoing picture at 0.0
+
+ //2 - what happens when the incoming picture isn't positioned at 0.0?
+ //we follow a path
+ //it seems to work if we fix the path in updateOutput() but it only works for 2 images???
+
+ zoomFactor*=aspectfactor;
glScalef(zoomFactor,zoomFactor,zoomFactor);
@@ -475,6 +499,10 @@ void chainImage::drawChain(float fadeIn,bool additive,float intensity,float zoom
glPopMatrix();
+ if (aspectfactor==0.0f){
+ aspectfactor=1.0f;
+ }
+
glTranslatef(getLinkPos().x,getLinkPos().y,0);
glRotatef(getLinkRot(),0,0,1);