diff options
| author | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
|---|---|---|
| committer | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
| commit | 0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch) | |
| tree | c831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/mathlib/mathlib_base.cpp | |
| parent | Updated the SDK with the latest code from the TF and HL2 branches. (diff) | |
| download | source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.tar.xz source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.zip | |
Diffstat (limited to 'mp/src/mathlib/mathlib_base.cpp')
| -rw-r--r-- | mp/src/mathlib/mathlib_base.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mp/src/mathlib/mathlib_base.cpp b/mp/src/mathlib/mathlib_base.cpp index dee2f28e..64069a7b 100644 --- a/mp/src/mathlib/mathlib_base.cpp +++ b/mp/src/mathlib/mathlib_base.cpp @@ -1461,7 +1461,9 @@ float Bias( float x, float biasAmt ) { lastExponent = log( biasAmt ) * -1.4427f; // (-1.4427 = 1 / log(0.5)) } - return pow( x, lastExponent ); + float fRet = pow( x, lastExponent ); + Assert ( !IS_NAN( fRet ) ); + return fRet; } @@ -1477,7 +1479,9 @@ float Gain( float x, float biasAmt ) float SmoothCurve( float x ) { - return (1 - cos( x * M_PI )) * 0.5f; + // Actual smooth curve. Visualization: + // http://www.wolframalpha.com/input/?i=plot%5B+0.5+*+%281+-+cos%5B2+*+pi+*+x%5D%29+for+x+%3D+%280%2C+1%29+%5D + return 0.5f * (1 - cos( 2.0f * M_PI * x ) ); } @@ -1856,7 +1860,10 @@ void QuaternionMult( const Quaternion &p, const Quaternion &q, Quaternion &qt ) void QuaternionMatrix( const Quaternion &q, const Vector &pos, matrix3x4_t& matrix ) { - Assert( pos.IsValid() ); + if ( !HushAsserts() ) + { + Assert( pos.IsValid() ); + } QuaternionMatrix( q, matrix ); @@ -1868,7 +1875,10 @@ void QuaternionMatrix( const Quaternion &q, const Vector &pos, matrix3x4_t& matr void QuaternionMatrix( const Quaternion &q, matrix3x4_t& matrix ) { Assert( s_bMathlibInitialized ); - Assert( q.IsValid() ); + if ( !HushAsserts() ) + { + Assert( q.IsValid() ); + } #ifdef _VPROF_MATHLIB VPROF_BUDGET( "QuaternionMatrix", "Mathlib" ); |