source-engine/materialsystem/stdshaders/viewalpha.cpp

49 lines
1.3 KiB
C++
Raw Permalink Normal View History

2020-04-22 16:56:21 +00:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Header: $
// $NoKeywords: $
//===========================================================================//
#include "shaderlib/cshader.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
BEGIN_SHADER_FLAGS( ViewAlpha, "Help for ViewAlpha", SHADER_NOT_EDITABLE )
BEGIN_SHADER_PARAMS
END_SHADER_PARAMS
SHADER_INIT
{
LoadTexture( BASETEXTURE );
}
SHADER_DRAW
{
SHADOW_STATE
{
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
pShaderShadow->EnableCustomPixelPipe( true );
pShaderShadow->CustomTextureStages( 1 );
pShaderShadow->CustomTextureOperation( SHADER_TEXTURE_STAGE0,
SHADER_TEXCHANNEL_COLOR, SHADER_TEXOP_SELECTARG1,
SHADER_TEXARG_TEXTUREALPHA, SHADER_TEXARG_CONSTANTCOLOR );
pShaderShadow->CustomTextureOperation( SHADER_TEXTURE_STAGE0,
SHADER_TEXCHANNEL_ALPHA, SHADER_TEXOP_SELECTARG1,
SHADER_TEXARG_TEXTURE, SHADER_TEXARG_VERTEXCOLOR );
pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_TEXCOORD0 );
}
DYNAMIC_STATE
{
BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME );
SetFixedFunctionTextureTransform( MATERIAL_TEXTURE0, BASETEXTURETRANSFORM );
}
Draw( );
}
END_SHADER