Browse Source

Use T() instead of static_cast<T>() for numeric types.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
c14715962d
  1. 8
      src/Camera.cpp
  2. 2
      src/Math/Test/MathTest.cpp

8
src/Camera.cpp

@ -85,15 +85,15 @@ void Camera::fixAspectRatio() {
/* Extend on larger side = scale larger side down */
if(_aspectRatioPolicy == Extend) {
_projectionMatrix = ((_viewport.x() > _viewport.y()) ?
Matrix4::scaling({static_cast<GLfloat>(_viewport.y())/_viewport.x(), 1, 1}) :
Matrix4::scaling({1, static_cast<GLfloat>(_viewport.x())/_viewport.y(), 1})
Matrix4::scaling({GLfloat(_viewport.y())/_viewport.x(), 1, 1}) :
Matrix4::scaling({1, GLfloat(_viewport.x())/_viewport.y(), 1})
)*rawProjectionMatrix;
/* Clip on smaller side = scale smaller side up */
} else if(_aspectRatioPolicy == Clip) {
_projectionMatrix = ((_viewport.x() > _viewport.y()) ?
Matrix4::scaling({1, static_cast<GLfloat>(_viewport.x())/_viewport.y(), 1}) :
Matrix4::scaling({static_cast<GLfloat>(_viewport.y())/_viewport.x(), 1, 1})
Matrix4::scaling({1, GLfloat(_viewport.x())/_viewport.y(), 1}) :
Matrix4::scaling({GLfloat(_viewport.y())/_viewport.x(), 1, 1})
)*rawProjectionMatrix;
/* Don't preserve anything */

2
src/Math/Test/MathTest.cpp

@ -25,7 +25,7 @@ namespace Magnum { namespace Math { namespace Test {
void MathTest::degrad() {
QCOMPARE(deg(90.0), PI/2);
QCOMPARE(deg(90.0f), static_cast<float>(PI/2));
QCOMPARE(deg(90.0f), float(PI/2));
QCOMPARE(rad(PI/2), PI/2);
QEXPECT_FAIL(0, "Integral parameter is not converted to floating point", Continue);

Loading…
Cancel
Save