L4D Glow Effect.h: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with 'Copy and paste this code into a file called ge_screeneffects.h into ''SourceSDKCode_Dir''\game\client\ <script lang=cpp> ///////////// Copyright © 2009, Goldeneye: Source. All …')
 
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Copy and paste this code into a file called ge_screeneffects.h into ''SourceSDKCode_Dir''\game\client\
Copy and paste this code into a file called ge_screeneffects.h into ''< your game folder >''\game\client\


<script lang=cpp>
See also: [[L4D Glow Effect.cpp]]
<source lang=cpp>
///////////// Copyright © 2009, Goldeneye: Source. All rights reserved. /////////////
///////////// Copyright © 2009, Goldeneye: Source. All rights reserved. /////////////
//  
//  
Line 28: Line 29:
virtual void Shutdown( void );
virtual void Shutdown( void );
virtual void SetParameters( KeyValues *params ) {};
virtual void SetParameters( KeyValues *params ) {};
virtual void Enable( bool bEnable ) {};
virtual void Enable( bool bEnable ) { m_bEnabled = bEnable; }
virtual bool IsEnabled( void ) { return true; }
virtual bool IsEnabled( ) { return m_bEnabled; }


virtual void RegisterEnt( EHANDLE hEnt, Color glowColor = Color(255,255,255,64), float fGlowScale = 1.0f );
virtual void RegisterEnt( EHANDLE hEnt, Color glowColor = Color(255,255,255,64), float fGlowScale = 1.0f );
Line 45: Line 46:


private:
private:
bool m_bEnabled;
struct sGlowEnt
struct sGlowEnt
{
{
Line 65: Line 68:


#endif
#endif
</script>
</source>
 
[[Category:Programming]]
[[Category:Left 4 Dead]]

Latest revision as of 07:54, 25 November 2017

Copy and paste this code into a file called ge_screeneffects.h into < your game folder >\game\client\

See also: L4D Glow Effect.cpp

///////////// Copyright © 2009, Goldeneye: Source. All rights reserved. /////////////
// 
// File: ge_screeneffects.h
// Description:
//      Post process effects for GoldenEye: Source
//
// Created On: 25 Nov 09
// Created By: Jonathan White <killermonkey> 
/////////////////////////////////////////////////////////////////////////////

#ifndef GE_SCREENSPACEEFFECTS_H
#define GE_SCREENSPACEEFFECTS_H
#ifdef _WIN32
#pragma once
#endif

#include "ScreenSpaceEffects.h"

class CEntGlowEffect : public IScreenSpaceEffect
{
public:
	CEntGlowEffect( void ) { };

	virtual void Init( void );
	virtual void Shutdown( void );
	virtual void SetParameters( KeyValues *params ) {};
	virtual void Enable( bool bEnable ) { m_bEnabled = bEnable; }
	virtual bool IsEnabled( ) { return m_bEnabled; }

	virtual void RegisterEnt( EHANDLE hEnt, Color glowColor = Color(255,255,255,64), float fGlowScale = 1.0f );
	virtual void DeregisterEnt( EHANDLE hEnt );

	virtual void SetEntColor( EHANDLE hEnt, Color glowColor );
	virtual void SetEntGlowScale( EHANDLE hEnt, float fGlowScale );

	virtual void Render( int x, int y, int w, int h );

protected:
	int FindGlowEnt( EHANDLE hEnt );
	void RenderToStencil( int idx, IMatRenderContext *pRenderContext );
	void RenderToGlowTexture( int idx, IMatRenderContext *pRenderContext );

private:
	bool			m_bEnabled;

	struct sGlowEnt
	{
		EHANDLE	m_hEnt;
		float	m_fColor[4];
		float	m_fGlowScale;
	};

	CUtlVector<sGlowEnt*>	m_vGlowEnts;

	CTextureReference	m_GlowBuff1;
	CTextureReference	m_GlowBuff2;

	CMaterialReference	m_WhiteMaterial;
	CMaterialReference	m_EffectMaterial;

	CMaterialReference	m_BlurX;
	CMaterialReference	m_BlurY;
};

#endif