Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Review and travis fixes
  • Loading branch information
wonder-sk committed Jul 8, 2018
1 parent d1e4c5e commit 98c4456
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
22 changes: 22 additions & 0 deletions src/3d/qgscameracontroller.h
Expand Up @@ -72,10 +72,32 @@ class _3D_EXPORT QgsCameraController : public Qt3DCore::QEntity
//! Sets the point toward which the camera is looking - this is used when world origin changes (e.g. after terrain generator changes)
void setLookingAtPoint( const QgsVector3D &point, float distance = -1 );

/**
* Sets the complete camera configuration: the point towards it is looking (in 3D world coordinates), the distance
* of the camera from the point, pitch angle in degrees (0 = looking from the top, 90 = looking from the side) and
* yaw angle in degrees.
* \since QGIS 3.4
*/
void setLookingAtPoint( const QgsVector3D &point, float distance, float pitch, float yaw );

/**
* Returns distance of the camera from the point it is looking at.
* \since QGIS 3.4
*/
float distance() const { return mCameraData.dist; }

/**
* Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side).
* The angle should range from 0 to 180.
* \since QGIS 3.4
*/
float pitch() const { return mCameraData.pitch; }

/**
* Returns yaw angle in degrees. Yaw value of zero means the camera is pointing towards north.
* The angle should range from 0 to 360.
* \since QGIS 3.4
*/
float yaw() const { return mCameraData.yaw; }

//! Writes camera configuration to the given DOM element
Expand Down
13 changes: 7 additions & 6 deletions src/app/3d/qgs3danimationsettings.h
Expand Up @@ -36,17 +36,18 @@ class Qgs3DAnimationSettings
//! keyframe definition
struct Keyframe
{
float time; //!< Relative time of the keyframe in seconds

QgsVector3D point; //!< Point towards which the camera is looking in 3D world coords
float dist; //!< Distance of the camera from the focal point
float pitch; //!< Tilt of the camera in degrees (0 = looking from the top, 90 = looking from the side, 180 = looking from the bottom)
float yaw; //!< Horizontal rotation around the focal point in degrees
float time = 0; //!< Relative time of the keyframe in seconds
QgsVector3D point; //!< Point towards which the camera is looking in 3D world coords
float dist = 0; //!< Distance of the camera from the focal point
float pitch = 0; //!< Tilt of the camera in degrees (0 = looking from the top, 90 = looking from the side, 180 = looking from the bottom)
float yaw = 0; //!< Horizontal rotation around the focal point in degrees
};

typedef QVector<Keyframe> Keyframes;

//! Configures keyframes of the animation. It is expected that the keyframes are ordered according to their time.
void setKeyframes( const Keyframes &keyframes ) { mKeyframes = keyframes; }
//! Returns keyframes of the animation
Keyframes keyFrames() const { return mKeyframes; }

//! Returns duration of the whole animation in seconds
Expand Down

0 comments on commit 98c4456

Please sign in to comment.