Mercurial > hg > soniczoomios
diff grid.h @ 46:1e266647840d
beta 2.
interpolation movement , smoothing (crap) and timbre only.
| author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
|---|---|
| date | Wed, 24 Apr 2013 17:58:08 +0100 |
| parents | a1e75b94c505 |
| children | 0d3a993405e4 |
line wrap: on
line diff
--- a/grid.h Tue Apr 23 18:29:55 2013 +0100 +++ b/grid.h Wed Apr 24 17:58:08 2013 +0100 @@ -16,6 +16,7 @@ #include "presetManager.h" #include "hilbert.h" +#define PRESET_INTERP_TIME 90 // frames using namespace std; class Preset; @@ -23,7 +24,7 @@ public: bool snapped; - bool automatedMovement; + bool automatedMovementInProgress; bool presetWasTapped; Hilbert hilbert; @@ -33,6 +34,8 @@ void move(TwoVector moveP); // shift view by pixels void zoom(float factor); + void animateTo(TwoVector point); + void tap(TwoVector pixel); // user has tapped a point typedef enum{NO_INTERPOLATION, INTERPOLATE_GRID, INTERPOLATE_PRESET} interpolateModeType; @@ -41,7 +44,7 @@ void shiftCentreToSnapped(); void draw(); - void update(); // change according to zoom + void update(); // only called if animating double interpLevel; int smallestGridSpacing; // number of pixels when small grid dissappears from view vector<int> getParams(); @@ -51,6 +54,10 @@ void setMaxZoom(); void setInterpolation(interpolateModeType mode); + void startInterpolatedAnimation(TwoVector endCoordinate); + + + Preset * getClosestPresetOf(vector<Preset *> closePresets); void interpolateTo(TwoVector coord); // HILBERT now does each coord for this @@ -68,6 +75,12 @@ // experimental void changeNumberOfParamsPerDim(); private: + int framesRemaining; + + vector<int> startInterpParams; + vector<int> endInterpParams; + TwoVector endInterpCoord; + void drawGridLines(); double scale; // surface units per pixel GUI @@ -108,7 +121,7 @@ void setCoord(TwoVector coord); void drawCrossHairs(); - + void continueInterpolatedAnimation(); double calculateInterpolateLevel(); vector<int> interpVector(vector<int> upper, vector<int> lower, float frac);
