Add -Wdouble-promotion switch to clang/gcc compilers

It introduces a lot of ugly casts. Long term the floats should probably
be changed to doubles everywhere since we're only compiling for 64 bit
x86.
This commit is contained in:
Vasily
2019-02-21 18:48:53 +01:00
committed by username223
parent fe3bbc2959
commit ec014a1e74
10 changed files with 40 additions and 29 deletions
@@ -564,7 +564,7 @@ void ChaperoneTabController::eventLoopTick(
{
float mod = m_chaperoneVelocityModifier
* std::max( { leftSpeed, rightSpeed, hmdSpeed } );
if ( mod > 0.02 )
if ( mod > 0.02f )
{
m_chaperoneVelocityModifierCurrent += mod;
}
+6 -4
View File
@@ -135,15 +135,17 @@ void FixFloorTabController::eventLoopTick(
{
if ( std::abs( tempRoll ) <= M_PI_2 )
{
floorOffsetY = tempOffsetY - controllerUpOffsetCorrection;
floorOffsetY = static_cast<float>( tempOffsetY )
- controllerUpOffsetCorrection;
}
else
{
floorOffsetY = tempOffsetY - controllerDownOffsetCorrection;
floorOffsetY = static_cast<float>( tempOffsetY )
- controllerDownOffsetCorrection;
}
floorOffsetX = tempOffsetX;
floorOffsetZ = tempOffsetZ;
floorOffsetX = static_cast<float>( tempOffsetX );
floorOffsetZ = static_cast<float>( tempOffsetZ );
LOG( INFO )
<< "Fix Floor and adjust room center: Floor Offset = ["
+23 -15
View File
@@ -167,10 +167,12 @@ void MoveCenterTabController::setRotation( int value, bool notify )
= devicePosesForRot[0].mDeviceToAbsoluteTracking;
// Set up xyz coordinate values from pose matrix.
double oldHmdXyz[3]
= { oldHmdPos.m[0][3], oldHmdPos.m[1][3], oldHmdPos.m[2][3] };
double newHmdXyz[3]
= { oldHmdPos.m[0][3], oldHmdPos.m[1][3], oldHmdPos.m[2][3] };
double oldHmdXyz[3] = { static_cast<double>( oldHmdPos.m[0][3] ),
static_cast<double>( oldHmdPos.m[1][3] ),
static_cast<double>( oldHmdPos.m[2][3] ) };
double newHmdXyz[3] = { static_cast<double>( oldHmdPos.m[0][3] ),
static_cast<double>( oldHmdPos.m[1][3] ),
static_cast<double>( oldHmdPos.m[2][3] ) };
// Convert oldHmdXyz into un-rotated coordinates.
double oldAngle = -m_rotation * k_centidegreesToRadians;
@@ -261,9 +263,9 @@ void MoveCenterTabController::setAdjustChaperone( bool value, bool notify )
{
double angle = m_rotation * k_centidegreesToRadians;
double offsetdir = m_adjustChaperone ? -1.0 : 1.0;
double offset[3] = { offsetdir * m_offsetX,
offsetdir * m_offsetY,
offsetdir * m_offsetZ };
double offset[3] = { offsetdir * static_cast<double>( m_offsetX ),
offsetdir * static_cast<double>( m_offsetY ),
offsetdir * static_cast<double>( m_offsetZ ) };
rotateCoordinates( offset, angle );
// We're done with calculations so down-cast to float for
@@ -407,7 +409,7 @@ void MoveCenterTabController::modOffsetX( float value, bool notify )
if ( !m_lockXToggle )
{
double angle = m_rotation * k_centidegreesToRadians;
double offset[3] = { value, 0, 0 };
double offset[3] = { static_cast<double>( value ), 0, 0 };
rotateCoordinates( offset, angle );
float offsetFloat[3] = { static_cast<float>( offset[0] ),
static_cast<float>( offset[1] ),
@@ -446,7 +448,7 @@ void MoveCenterTabController::modOffsetZ( float value, bool notify )
if ( !m_lockZToggle )
{
double angle = m_rotation * k_centidegreesToRadians;
double offset[3] = { 0, 0, value };
double offset[3] = { 0, 0, static_cast<double>( value ) };
rotateCoordinates( offset, angle );
float offsetFloat[3] = { static_cast<float>( offset[0] ),
static_cast<float>( offset[1] ),
@@ -964,9 +966,12 @@ void MoveCenterTabController::eventLoopTick(
else
{
double relativeControllerPosition[]
= { movePose->mDeviceToAbsoluteTracking.m[0][3],
movePose->mDeviceToAbsoluteTracking.m[1][3],
movePose->mDeviceToAbsoluteTracking.m[2][3] };
= { static_cast<double>(
movePose->mDeviceToAbsoluteTracking.m[0][3] ),
static_cast<double>(
movePose->mDeviceToAbsoluteTracking.m[1][3] ),
static_cast<double>(
movePose->mDeviceToAbsoluteTracking.m[2][3] ) };
rotateCoordinates( relativeControllerPosition, -angle );
float absoluteControllerPosition[] = {
@@ -978,9 +983,12 @@ void MoveCenterTabController::eventLoopTick(
if ( m_lastMoveHand == m_activeDragHand )
{
double diff[3] = {
absoluteControllerPosition[0] - m_lastControllerPosition[0],
absoluteControllerPosition[1] - m_lastControllerPosition[1],
absoluteControllerPosition[2] - m_lastControllerPosition[2],
static_cast<double>( absoluteControllerPosition[0]
- m_lastControllerPosition[0] ),
static_cast<double>( absoluteControllerPosition[1]
- m_lastControllerPosition[1] ),
static_cast<double>( absoluteControllerPosition[2]
- m_lastControllerPosition[2] ),
};
// offset is un-rotated coordinates
+2 -2
View File
@@ -44,7 +44,7 @@ void ReviveTabController::initStage1( bool forceRevivePage )
}
else
{
if ( valuef == 0.0 )
if ( valuef == 0.0f )
{
m_pixelsPerDisplayPixelOverrideEnabled = false;
m_pixelsPerDisplayPixelOverride = 1.0;
@@ -321,7 +321,7 @@ void ReviveTabController::eventLoopTick()
&vrSettingsError );
if ( vrSettingsError == vr::VRSettingsError_None )
{
if ( valuef == 0.0 )
if ( valuef == 0.0f )
{
setPixelsPerDisplayPixelOverrideEnabled( false );
}
@@ -54,7 +54,7 @@ void StatisticsTabController::eventLoopTick(
+ std::pow( m[2][3] - lastHmdPos[2], 2 ) );
if ( delta >= 0.01f )
{
m_hmdDistanceMoved += delta;
m_hmdDistanceMoved += static_cast<double>( delta );
}
}
lastHmdPos[0] = m[0][3];
@@ -164,7 +164,7 @@ void StatisticsTabController::statsRotationResetClicked()
void StatisticsTabController::statsLeftControllerSpeedResetClicked()
{
if ( m_leftControllerMaxSpeed != 0.0 )
if ( m_leftControllerMaxSpeed != 0.0f )
{
m_leftControllerMaxSpeed = 0.0;
}
@@ -172,7 +172,7 @@ void StatisticsTabController::statsLeftControllerSpeedResetClicked()
void StatisticsTabController::statsRightControllerSpeedResetClicked()
{
if ( m_rightControllerMaxSpeed != 0.0 )
if ( m_rightControllerMaxSpeed != 0.0f )
{
m_rightControllerMaxSpeed = 0.0;
}
+1 -1
View File
@@ -56,7 +56,7 @@ void SteamVRTabController::eventLoopTick()
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
if ( m_superSampling != 1.0 )
if ( m_superSampling != 1.0f )
{
LOG( DEBUG )
<< "OpenVR returns an error and we have a custom "
@@ -583,7 +583,7 @@ void UtilitiesTabController::setSteamDesktopOverlayWidth( float width,
bool notify,
bool notifyOpenVr )
{
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01 )
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01f )
{
m_steamDesktopOverlayWidth = width;
if ( notifyOpenVr )