Browse Source

engine: client: use alternative ease-in ease-out function in sound fade

pull/2/head
Alibek Omarov 2 years ago
parent
commit
53987f47e2
  1. 2
      engine/client/s_main.c
  2. 18
      public/xash3d_mathlib.c
  3. 1
      public/xash3d_mathlib.h

2
engine/client/s_main.c

@ -159,7 +159,7 @@ void S_UpdateSoundFade( void ) @@ -159,7 +159,7 @@ void S_UpdateSoundFade( void )
}
// spline it.
f = SimpleSpline( f );
f = -( cos( M_PI * f ) - 1 ) / 2;
f = bound( 0.0f, f, 1.0f );
soundfade.percent = soundfade.initial_percent * f;

18
public/xash3d_mathlib.c

@ -53,24 +53,6 @@ float anglemod( float a ) @@ -53,24 +53,6 @@ float anglemod( float a )
return a;
}
/*
=================
SimpleSpline
NOTE: ripped from hl2 source
hermite basis function for smooth interpolation
Similar to Gain() above, but very cheap to call
value should be between 0 & 1 inclusive
=================
*/
float SimpleSpline( float value )
{
float valueSquared = value * value;
// nice little ease-in, ease-out spline-like curve
return (3.0f * valueSquared - 2.0f * valueSquared * value);
}
word FloatToHalf( float v )
{
unsigned int i = FloatAsUint( v );

1
public/xash3d_mathlib.h

@ -177,7 +177,6 @@ float rsqrt( float number ); @@ -177,7 +177,6 @@ float rsqrt( float number );
float anglemod( float a );
word FloatToHalf( float v );
float HalfToFloat( word h );
float SimpleSpline( float value );
void RoundUpHullSize( vec3_t size );
int SignbitsForPlane( const vec3_t normal );
int PlaneTypeForNormal( const vec3_t normal );

Loading…
Cancel
Save