#ifndef JOY_CAM_HPP #define JOY_CAM_HPP #include #include #include namespace sft { //////////////////////////////////////////////////////////// /// \ingroup sfmltools /// \brief Camera controlled by a joystick controller //////////////////////////////////////////////////////////// class JoyCam : public Camera { public: //////////////////////////////////////////////////// /// \brief Usual constructor /// \param i id of the sfml controller that we will /// be listening to //////////////////////////////////////////////////// JoyCam(int i); /////////////////////////////////////////////////// /// \brief calls gluLookAt with the good parameters /////////////////////////////////////////////////// void look() const; /////////////////////////////////////////////////// /// \brief computes the next step of the camera /// \param width width of the window /// \param height height of the window /////////////////////////////////////////////////// void nextStep(int width, int height); private: float speed; ///< speed of the camera float sensitivity; ///< sensitivity of the mouse sf::Vector3f position; ///< position of the center of the camera sf::Vector3f target; ///< a point that the camera is staring at sf::Vector3f forward; ///< a vector from the center to the target sf::Vector3f left; ///< a vector orthogonal to forward double theta; ///< theta angle from spheric coordinates double phi; ///< phi angle from spheric coordinates int joy; ///< id of the joystick //////////////////////////////////////////////////// /// \brief computes the vector from angles /// /// Computes the value of position, target, forward and left /// using only theta and phi //////////////////////////////////////////////////// void vectorsFromAngles(); }; } // namespace sft #endif // JOY_CAM_HPP