From 2f8ae72431f3f2a6ba1006da7aac646c444c4bcc Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sat, 10 Apr 2021 09:53:52 +0200 Subject: [PATCH] Fixed Linux build issues. Tested with Clang --- neo/idlib/math/SphericalHarmonics.h | 14 +++++++------- neo/renderer/Material.h | 4 ++-- neo/renderer/RenderBackend.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/neo/idlib/math/SphericalHarmonics.h b/neo/idlib/math/SphericalHarmonics.h index be383017..a8937261 100644 --- a/neo/idlib/math/SphericalHarmonics.h +++ b/neo/idlib/math/SphericalHarmonics.h @@ -320,12 +320,12 @@ float shFindWindowingLambda( const SphericalHarmonicsT& sh, float maxL for( int l = 1; l <= ( int )L; ++l ) { - tableL[l] = float( sqr( l ) * sqr( l + 1 ) ); + tableL[l] = float( Square( l ) * Square( l + 1 ) ); float B = 0.0f; for( int m = -1; m <= l; ++m ) { - B += sqr( sh.at( l, m ) ); + B += Square( sh.at( l, m ) ); } tableB[l] = B; } @@ -345,16 +345,16 @@ float shFindWindowingLambda( const SphericalHarmonicsT& sh, float maxL float lambda = 0.0f; - const u32 iterationLimit = 10000000; - for( u32 i = 0; i < iterationLimit; ++i ) + const uint32_t iterationLimit = 10000000; + for( uint32_t i = 0; i < iterationLimit; ++i ) { float f = 0.0f; float fd = 0.0f; for( int l = 1; l <= ( int )L; ++l ) { - f += tableL[l] * tableB[l] / sqr( 1.0f + lambda * tableL[l] ); - fd += ( 2.0f * sqr( tableL[l] ) * tableB[l] ) / cube( 1.0f + lambda * tableL[l] ); + f += tableL[l] * tableB[l] / Square( 1.0f + lambda * tableL[l] ); + fd += ( 2.0f * Square( tableL[l] ) * tableB[l] ) / Cube( 1.0f + lambda * tableL[l] ); } f = targetSquaredLaplacian - f; @@ -362,7 +362,7 @@ float shFindWindowingLambda( const SphericalHarmonicsT& sh, float maxL float delta = -f / fd; lambda += delta; - if( abs( delta ) < 1e-6f ) + if( idMath::Fabs( delta ) < 1e-6f ) { break; } diff --git a/neo/renderer/Material.h b/neo/renderer/Material.h index c4c0566b..7750a55e 100644 --- a/neo/renderer/Material.h +++ b/neo/renderer/Material.h @@ -368,7 +368,7 @@ typedef enum class idSoundEmitter; // RB: predefined Quake 1 light styles -static char* predef_lightstyles[] = +static const char* predef_lightstyles[] = { "m", "mmnmmommommnonmmonqnmmo", @@ -384,7 +384,7 @@ static char* predef_lightstyles[] = "abcdefghijklmnopqrrqponmlkjihgfedcba" }; -static char* predef_lightstylesinfo[] = +static const char* predef_lightstylesinfo[] = { "Normal", "Flicker A", diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index 26d3ce04..4cf2f983 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -1337,7 +1337,7 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas probeMaxs[2] = viewDef->globalProbeBounds[1][2]; probeMaxs[3] = 0.0f; - idVec3& center = viewDef->globalProbeBounds.GetCenter(); + idVec3 center = viewDef->globalProbeBounds.GetCenter(); probeCenter.Set( center.x, center.y, center.z, 1.0f ); SetVertexParm( RENDERPARM_WOBBLESKY_X, probeMins.ToFloatPtr() );