Skip to content
Snippets Groups Projects
Commit ced9a3bf authored by Richard Gustavsen's avatar Richard Gustavsen
Browse files

QDemonView3D::viewToWorld(): rename argument

parent 685cce6e
No related branches found
No related tags found
No related merge requests found
Pipeline #3689 passed
......@@ -446,21 +446,21 @@ QVector3D QDemonView3D::worldToView(const QVector3D &worldPos) const
}
/*!
* Transforms \a viewportPos from view space into world space. \a The x-, and y
* values of \l viewportPos should be within the width and height of the view.
* Transforms \a viewPos from view space into world space. \a The x-, and y
* values of \l viewPos should be within the width and height of the view.
* The z value should be the distance from the camera into the world in world units. If
* \a viewportPos cannot be mapped to a position, a position of [-1, -1, -1] is returned.
* \a viewPos cannot be mapped to a position, a position of [-1, -1, -1] is returned.
*
* \sa QDemonCamera::viewportToWorld QDemonView3D::worldToView
*/
QVector3D QDemonView3D::viewToWorld(const QVector3D &viewportPos) const
QVector3D QDemonView3D::viewToWorld(const QVector3D &viewPos) const
{
if (!m_camera) {
qmlWarning(this) << "Cannot resolve world position without a camera assigned!";
return QVector3D(-1, -1, -1);
}
const QVector3D normalizedPos = viewportPos / QVector3D(float(width()), float(height()), 1);
const QVector3D normalizedPos = viewPos / QVector3D(float(width()), float(height()), 1);
return m_camera->viewportToWorld(normalizedPos);
}
......
......@@ -58,7 +58,7 @@ public:
static QSurfaceFormat idealSurfaceFormat();
Q_INVOKABLE QVector3D worldToView(const QVector3D &worldPos) const;
Q_INVOKABLE QVector3D viewToWorld(const QVector3D &viewportPos) const;
Q_INVOKABLE QVector3D viewToWorld(const QVector3D &viewPos) const;
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment