diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/fx_water.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/fx_water.h')
| -rw-r--r-- | game/client/fx_water.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/game/client/fx_water.h b/game/client/fx_water.h new file mode 100644 index 0000000..a1e623a --- /dev/null +++ b/game/client/fx_water.h @@ -0,0 +1,103 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef FX_WATER_H +#define FX_WATER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "particles_simple.h" +#include "fx.h" + +#include "tier0/memdbgon.h" + +class CSplashParticle : public CSimpleEmitter +{ +public: + + CSplashParticle( const char *pDebugName ) : CSimpleEmitter( pDebugName ), m_bUseClipHeight( false ) {} + + // Create + static CSplashParticle *Create( const char *pDebugName ) + { + return new CSplashParticle( pDebugName ); + } + + // Roll + virtual float UpdateRoll( SimpleParticle *pParticle, float timeDelta ); + + // Velocity + virtual void UpdateVelocity( SimpleParticle *pParticle, float timeDelta ); + + // Alpha + virtual float UpdateAlpha( const SimpleParticle *pParticle ); + + void SetClipHeight( float flClipHeight ); + + // Simulation + void SimulateParticles( CParticleSimulateIterator *pIterator ); + +private: + CSplashParticle( const CSplashParticle & ); + + float m_flClipHeight; + bool m_bUseClipHeight; +}; + +class WaterDebrisEffect : public CSimpleEmitter +{ +public: + WaterDebrisEffect( const char *pDebugName ) : CSimpleEmitter( pDebugName ) {} + + static WaterDebrisEffect* Create( const char *pDebugName ); + + virtual float UpdateAlpha( const SimpleParticle *pParticle ); + +private: + WaterDebrisEffect( const WaterDebrisEffect & ); +}; + +extern void FX_WaterRipple( const Vector &origin, float scale, Vector *pColor, float flLifetime=1.5, float flAlpha=1 ); +extern void FX_GunshotSplash( const Vector &origin, const Vector &normal, float scale ); +extern void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float scale ); + +//----------------------------------------------------------------------------- +// Purpose: Retrieve and alter lighting for splashes +// Input : position - point to check +// *color - tint of the lighting at this point +// *luminosity - adjusted luminosity at this point +//----------------------------------------------------------------------------- +inline void FX_GetSplashLighting( Vector position, Vector *color, float *luminosity ) +{ + // Compute our lighting at our position + Vector totalColor = engine->GetLightForPoint( position, true ); + + // Get our lighting information + UTIL_GetNormalizedColorTintAndLuminosity( totalColor, color, luminosity ); + + // Fake a specular highlight (too dim otherwise) + if ( luminosity != NULL ) + { + *luminosity = MIN( 1.0f, (*luminosity) * 4.0f ); + + // Clamp so that we never go completely translucent + if ( *luminosity < 0.25f ) + { + *luminosity = 0.25f; + } + } + + // Only take a quarter of the tint, mostly we want to be white + if ( color != NULL ) + { + (*color) = ( (*color) * 0.25f ) + Vector( 0.75f, 0.75f, 0.75f ); + } +} + +#include "tier0/memdbgoff.h" + +#endif // FX_WATER_H |