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/portal/c_func_liquidportal.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/portal/c_func_liquidportal.h')
| -rw-r--r-- | game/client/portal/c_func_liquidportal.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/game/client/portal/c_func_liquidportal.h b/game/client/portal/c_func_liquidportal.h new file mode 100644 index 0000000..6fef420 --- /dev/null +++ b/game/client/portal/c_func_liquidportal.h @@ -0,0 +1,131 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef C_FUNC_LIQUIDPORTAL_H +#define C_FUNC_LIQUIDPORTAL_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "c_baseentity.h" +#include "PortalRender.h" +#include "Portal_DynamicMeshRenderingUtils.h" +#include "ScreenSpaceEffects.h" + +class CPortalRenderable_Func_LiquidPortal : public CPortalRenderable +{ +public: + virtual void DrawPreStencilMask( void ); + virtual void DrawStencilMask( void ); + virtual void DrawPostStencilFixes( void ); + + virtual void RenderPortalViewToBackBuffer( CViewRender *pViewRender, const CViewSetup &cameraView ); + virtual void RenderPortalViewToTexture( CViewRender *pViewRender, const CViewSetup &cameraView ); + + void AddToVisAsExitPortal( ViewCustomVisibility_t *pCustomVisibility ); + virtual bool DoesExitViewIntersectWaterPlane( float waterZ, int leafWaterDataID ) const; + virtual SkyboxVisibility_t SkyBoxVisibleFromPortal( void ); + + bool CalcFrustumThroughPortal( const Vector &ptCurrentViewOrigin, Frustum OutputFrustum, const VPlane *pInputFrustum = NULL, int iInputFrustumPlaneCount = 0 ); + + virtual const Vector& GetFogOrigin( void ) const; + virtual void ShiftFogForExitPortalView() const; + + virtual bool ShouldUpdatePortalView_BasedOnView( const CViewSetup ¤tView, Frustum currentFrustum ); //portal is both visible, and will display at least some portion of a remote view + virtual CPortalRenderable* GetLinkedPortal() const; + virtual bool ShouldUpdateDepthDoublerTexture( const CViewSetup &viewSetup ); + virtual void DrawPortal( void ); //sort of like what you'd expect to happen in C_BaseAnimating::DrawModel() if portals were fully compatible with models + + virtual void GetToolRecordingState( bool bActive, KeyValues *msg ); + virtual void HandlePortalPlaybackMessage( KeyValues *pKeyValues ); + + void DrawOutwardBox( const IMaterial *pMaterial = NULL ); + void DrawInwardBox( const IMaterial *pMaterial = NULL ); + void DrawInnerLiquid( bool bClipToBounds = true, float fOpacity = 1.0f, const IMaterial *pMaterial = NULL ); //quads in front of camera clipped to box dimensions + + float GetFillInterpolationAmount( void ); + bool IsFillingNow( void ); + + void UpdateBoundingPlanes( void ); + + float m_fFillStartTime; + float m_fFillEndTime; + + Vector m_vAABBMins; + Vector m_vAABBMaxs; + + float m_fBoundingPlanes[5][4]; //top is highly variable and therefore not actually stored + + CPortalRenderable_Func_LiquidPortal *m_pLinkedPortal; +}; + +inline float CPortalRenderable_Func_LiquidPortal::GetFillInterpolationAmount( void ) +{ + if( m_fFillEndTime < gpGlobals->curtime ) + return 0.0f; + + return ((gpGlobals->curtime - m_fFillStartTime) / (m_fFillEndTime - m_fFillStartTime)); +} + +inline bool CPortalRenderable_Func_LiquidPortal::IsFillingNow( void ) +{ + return ((m_fFillEndTime >= gpGlobals->curtime) && (m_fFillStartTime <= gpGlobals->curtime)); +} + + + +class C_Func_LiquidPortal : public C_BaseEntity, public CPortalRenderable_Func_LiquidPortal +{ +public: + DECLARE_CLASS( C_Func_LiquidPortal, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + + C_Func_LiquidPortal( void ); + ~C_Func_LiquidPortal( void ); + + virtual bool IsTransparent( void ) { return true; }; + virtual bool UsesPowerOfTwoFrameBufferTexture() { return true; }; + virtual int DrawModel( int flags ); + + void ComputeLinkMatrix( void ); + + virtual void OnDataChanged( DataUpdateType_t updateType ); + + CHandle<C_Func_LiquidPortal> m_hLinkedPortal; +}; + + + + + +class CLiquidPortal_InnerLiquidEffect : public IScreenSpaceEffect +{ +public: + CLiquidPortal_InnerLiquidEffect( void ); + + void Init( void ) { }; + void Shutdown( void ) { }; + + void SetParameters( KeyValues *params ); + + void Render( int x, int y, int w, int h ); + + void Enable( bool bEnable ) { m_bEnable = bEnable; }; + bool IsEnabled( void ) { return m_bEnable; }; + +private: + bool m_bEnable; + +public: + C_Func_LiquidPortal* m_pImmersionPortal; //portal that did the filling + teleporting + bool m_bFadeBackToReality; + float m_fFadeBackTimeLeft; + static const float s_fFadeBackEffectTime; //how long the effect should take +}; + +#endif //#ifndef C_FUNC_LIQUIDPORTAL_H |