summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2012-12-06 23:02:00 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-07 08:45:29 +0100
commit425367f89255764234313889b403bf53b0993e0a (patch)
tree568561883c939380af38cfd205a2987284c4b331 /src/gui
parentcd03f2a7728dd2551f2f8924b1520f6328d5f710 (diff)
Make the documentation more explicit an talkative
Change-Id: Ifa4b7c3c5f8ec384addbb80a9436d55b32d8bc51 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp16
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index d8c2116b0d..e0f401bc10 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1458,27 +1458,29 @@ void QMatrix4x4::frustum(float left, float right, float bottom, float top, float
/*!
Multiplies this matrix by another that applies a perspective
- projection. The field of view will be \a angle degrees within
- a window with a given \a aspect ratio. The projection will
- have the specified \a nearPlane and \a farPlane clipping planes.
+ projection. The vertical field of view will be \a verticalAngle degrees
+ within a window with a given \a aspectRatio that determines the horizontal
+ field of view.
+ The projection will have the specified \a nearPlane and \a farPlane clipping
+ planes which are the distances from the viewer to the corresponding planes.
\sa ortho(), frustum()
*/
-void QMatrix4x4::perspective(float angle, float aspect, float nearPlane, float farPlane)
+void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane)
{
// Bail out if the projection volume is zero-sized.
- if (nearPlane == farPlane || aspect == 0.0f)
+ if (nearPlane == farPlane || aspectRatio == 0.0f)
return;
// Construct the projection.
QMatrix4x4 m(1);
- float radians = (angle / 2.0f) * M_PI / 180.0f;
+ float radians = (verticalAngle / 2.0f) * M_PI / 180.0f;
float sine = sinf(radians);
if (sine == 0.0f)
return;
float cotan = cosf(radians) / sine;
float clip = farPlane - nearPlane;
- m.m[0][0] = cotan / aspect;
+ m.m[0][0] = cotan / aspectRatio;
m.m[1][0] = 0.0f;
m.m[2][0] = 0.0f;
m.m[3][0] = 0.0f;
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index bbad04b8b1..df98f0291a 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -146,7 +146,7 @@ public:
void ortho(const QRectF& rect);
void ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane);
void frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane);
- void perspective(float angle, float aspect, float nearPlane, float farPlane);
+ void perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane);
#ifndef QT_NO_VECTOR3D
void lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up);
#endif