@@ -148,7 +148,12 @@ struct Orbital
148148 void incrementOrbitRadians (math::Vec<2 , float > aIncrements)
149149 { incrementOrbit (math::Radian<float >{aIncrements.x ()}, math::Radian<float >{aIncrements.y ()}); }
150150
151- void pan (math::Vec<2 , float > aPanning);
151+ void translate (math::Vec<3 , float > aTranslation);
152+
153+ inline void pan (math::Vec<2 , float > aPanning)
154+ {
155+ translate ({aPanning.x (), aPanning.y (), 0 .f });
156+ }
152157
153158 float & radius ();
154159 float radius () const ;
@@ -196,15 +201,14 @@ struct OrbitalControl
196201 void callbackMouseButton (int button, int action, int mods, double xpos, double ypos);
197202 void callbackCursorPosition (double xpos, double ypos);
198203 void callbackScroll (double xoffset, double yoffset);
199- void callbackKeyboard (int key, int scancode, int action, int mods)
200- {}
204+ void callbackKeyboard (int key, int scancode, int action, int mods);
201205
202206 // Note: Initially, this class was storing a copy of the VFOV,
203207 // and thus could do panning directly in the cursor position callback.
204208 // Yet this copy violated DRY, and was only behaving well with perspective projection.
205209 // Note: As an alternative to taking the window size, the class could store a pointer to the appinterface
206210 // and query when needed.
207- void update (float aViewHeightInWorld, int aWindowHeight);
211+ void update (float aDeltaTime, float aViewHeightInWorld, int aWindowHeight);
208212
209213 Orbital mOrbital ;
210214
@@ -218,10 +222,12 @@ struct OrbitalControl
218222
219223 static constexpr math::Vec<2 , float > gMouseControlFactor {1 /700 .f , 1 /700 .f };
220224 static constexpr float gScrollFactor = 0 .05f ;
225+ static constexpr float gTranslationSpeed = 4 .f; // worldunit/s
221226
222227 // The drag quantity in cursor unit (usually pixels)
223228 // This allow deferring the actual panning until update(), which can convert this quantity to world unit.
224229 math::Vec<2 , float > mDragVector_cursor ;
230+ math::Vec<3 , float > mMovementVector ;
225231 ControlMode mControlMode {ControlMode::None};
226232 math::Position<2 , float > mPreviousDragPosition {0 .f , 0 .f };
227233};
0 commit comments