mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-17 20:10:21 +03:00
- Added custom map compile tools (vbsp, vvis, vrad) - Changed blink fix (shouldn't change anything in-game) - Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands - Added ent_create_aimed, an ent_create equivalent of npc_create_aimed - Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack - Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks) - Made interaction code capable of being dispatched on any entity, not just combat characters - Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares - Fixed certain NPCs getting out of the way for the player when they hate them - Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs - Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods - Selectable color for ragdoll boogie/point_ragdollboogie - Fixed PickupWeaponInstant not firing weapon pickup outputs - Introduced inputs and keyvalues for "lerping" to math_counter_advanced - Fixed ClearConsole on logic_console - logic_convar should now detect client convars correctly - New NormalizeAngles input on math_vector - logic_modelinfo LookupActivity input - math_generate fixed and expanded to be more like math_counter - Added a WIP game logging system for playtesting maps - Introduced logic_playerinfo, an entity that can read a player's name or ID - Fixed some new filters not working with filter_multi - Added radius pickup spawnflag to func_physbox - Added "Preserve name" spawnflag to weapons - Added cc_achievement_debug message for when an achievement doesn't exist - Made npc_combine_s not speak while in logic_choreographed_scenes - Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll - Expanded and cleaned up npc_zombie_custom - Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game - Allowed player squad commands to go through +USE-held objects - Added a bunch of I/O/KV to trigger_waterydeath for better configuration - Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it - Adjusted game_convar_mod for MP planning - Removed the func_precipitation custom particle/splash code for now, as it was causing problems - Fixed env_global_light not accepting lightcolor - Added "Additional Buttons" to player_speedmod - Added save comment to RPC - Added env_projectedtexture attenuation - Added scripted_sequence OnPreIdleSequence - Added OnCrab to zombies - Added skill_changed game event (may need further testing) - Added a fix for viewmodels flipping under extreme FOV values - Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly - Fixed a very, very, very major shader performance issue - New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles - Code improvements for I/O involving angles - logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls - Alternate collision/player avoidance spawnflag obsoletion enforcement disabled - Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue - Miscellaneous shader formatting adjustments and fixes - Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
203 lines
10 KiB
C++
203 lines
10 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $Header: $
|
|
// $NoKeywords: $
|
|
//===========================================================================//
|
|
|
|
#include "BaseVSShader.h"
|
|
#include "vertexlitgeneric_dx9_helper.h"
|
|
|
|
extern ConVar r_flashlight_version2;
|
|
|
|
BEGIN_VS_SHADER( SDK_UnlitGeneric, "Help for SDK_UnlitGeneric" )
|
|
|
|
BEGIN_SHADER_PARAMS
|
|
SHADER_PARAM( ALBEDO, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "albedo (Base texture with no baked lighting)" )
|
|
SHADER_PARAM( DETAIL, SHADER_PARAM_TYPE_TEXTURE, "shadertest/detail", "detail texture" )
|
|
SHADER_PARAM( DETAILFRAME, SHADER_PARAM_TYPE_INTEGER, "0", "frame number for $detail" )
|
|
SHADER_PARAM( DETAILSCALE, SHADER_PARAM_TYPE_FLOAT, "4", "scale of the detail texture" )
|
|
SHADER_PARAM( ENVMAP, SHADER_PARAM_TYPE_TEXTURE, "shadertest/shadertest_env", "envmap" )
|
|
SHADER_PARAM( ENVMAPFRAME, SHADER_PARAM_TYPE_INTEGER, "", "envmap frame number" )
|
|
SHADER_PARAM( ENVMAPMASK, SHADER_PARAM_TYPE_TEXTURE, "shadertest/shadertest_envmask", "envmap mask" )
|
|
SHADER_PARAM( ENVMAPMASKFRAME, SHADER_PARAM_TYPE_INTEGER, "0", "" )
|
|
SHADER_PARAM( ENVMAPMASKTRANSFORM, SHADER_PARAM_TYPE_MATRIX, "center .5 .5 scale 1 1 rotate 0 translate 0 0", "$envmapmask texcoord transform" )
|
|
SHADER_PARAM( ENVMAPTINT, SHADER_PARAM_TYPE_COLOR, "[1 1 1]", "envmap tint" )
|
|
SHADER_PARAM( ENVMAPCONTRAST, SHADER_PARAM_TYPE_FLOAT, "0.0", "contrast 0 == normal 1 == color*color" )
|
|
SHADER_PARAM( ENVMAPSATURATION, SHADER_PARAM_TYPE_FLOAT, "1.0", "saturation 0 == greyscale 1 == normal" )
|
|
SHADER_PARAM( ALPHATESTREFERENCE, SHADER_PARAM_TYPE_FLOAT, "0.7", "" )
|
|
SHADER_PARAM( VERTEXALPHATEST, SHADER_PARAM_TYPE_INTEGER, "0", "" )
|
|
SHADER_PARAM( HDRCOLORSCALE, SHADER_PARAM_TYPE_FLOAT, "1.0", "hdr color scale" )
|
|
SHADER_PARAM( PHONGEXPONENT, SHADER_PARAM_TYPE_FLOAT, "5.0", "Phong exponent for local specular lights" )
|
|
SHADER_PARAM( PHONGTINT, SHADER_PARAM_TYPE_VEC3, "5.0", "Phong tint for local specular lights" )
|
|
SHADER_PARAM( PHONGALBEDOTINT, SHADER_PARAM_TYPE_BOOL, "1.0", "Apply tint by albedo (controlled by spec exponent texture" )
|
|
SHADER_PARAM( LIGHTWARPTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "1D ramp texture for tinting scalar diffuse term" )
|
|
SHADER_PARAM( PHONGWARPTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "2D map for warping specular" )
|
|
SHADER_PARAM( PHONGFRESNELRANGES, SHADER_PARAM_TYPE_VEC3, "[0 0.5 1]", "Parameters for remapping fresnel output" )
|
|
SHADER_PARAM( PHONGBOOST, SHADER_PARAM_TYPE_FLOAT, "1.0", "Phong overbrightening factor (specular mask channel should be authored to account for this)" )
|
|
SHADER_PARAM( PHONGEXPONENTTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Phong Exponent map" )
|
|
SHADER_PARAM( PHONG, SHADER_PARAM_TYPE_BOOL, "0", "enables phong lighting" )
|
|
SHADER_PARAM( DETAILBLENDMODE, SHADER_PARAM_TYPE_INTEGER, "0", "mode for combining detail texture with base. 0=normal, 1= additive, 2=alpha blend detail over base, 3=crossfade" )
|
|
SHADER_PARAM( DETAILBLENDFACTOR, SHADER_PARAM_TYPE_FLOAT, "1", "blend amount for detail texture." )
|
|
SHADER_PARAM( DETAILTEXTURETRANSFORM, SHADER_PARAM_TYPE_MATRIX, "center .5 .5 scale 1 1 rotate 0 translate 0 0", "$detail texcoord transform" )
|
|
|
|
SHADER_PARAM( SELFILLUMMASK, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "If we bind a texture here, it overrides base alpha (if any) for self illum" )
|
|
|
|
SHADER_PARAM( DISTANCEALPHA, SHADER_PARAM_TYPE_BOOL, "0", "Use distance-coded alpha generated from hi-res texture by vtex.")
|
|
SHADER_PARAM( DISTANCEALPHAFROMDETAIL, SHADER_PARAM_TYPE_BOOL, "0", "Take the distance-coded alpha mask from the detail texture.")
|
|
|
|
SHADER_PARAM( SOFTEDGES, SHADER_PARAM_TYPE_BOOL, "0", "Enable soft edges to distance coded textures.")
|
|
SHADER_PARAM( SCALEEDGESOFTNESSBASEDONSCREENRES, SHADER_PARAM_TYPE_BOOL, "0", "Scale the size of the soft edges based upon resolution. 1024x768 = nominal.")
|
|
SHADER_PARAM( EDGESOFTNESSSTART, SHADER_PARAM_TYPE_FLOAT, "0.6", "Start value for soft edges for distancealpha.");
|
|
SHADER_PARAM( EDGESOFTNESSEND, SHADER_PARAM_TYPE_FLOAT, "0.5", "End value for soft edges for distancealpha.");
|
|
|
|
SHADER_PARAM( GLOW, SHADER_PARAM_TYPE_BOOL, "0", "Enable glow/shadow for distance coded textures.")
|
|
SHADER_PARAM( GLOWCOLOR, SHADER_PARAM_TYPE_COLOR, "[1 1 1]", "color of outter glow for distance coded line art." )
|
|
SHADER_PARAM( GLOWALPHA, SHADER_PARAM_TYPE_FLOAT, "1", "Base glow alpha amount for glows/shadows with distance alpha." )
|
|
SHADER_PARAM( GLOWSTART, SHADER_PARAM_TYPE_FLOAT, "0.7", "start value for glow/shadow")
|
|
SHADER_PARAM( GLOWEND, SHADER_PARAM_TYPE_FLOAT, "0.5", "end value for glow/shadow")
|
|
SHADER_PARAM( GLOWX, SHADER_PARAM_TYPE_FLOAT, "0", "texture offset x for glow mask.")
|
|
SHADER_PARAM( GLOWY, SHADER_PARAM_TYPE_FLOAT, "0", "texture offset y for glow mask.")
|
|
|
|
SHADER_PARAM( OUTLINE, SHADER_PARAM_TYPE_BOOL, "0", "Enable outline for distance coded textures.")
|
|
SHADER_PARAM( OUTLINECOLOR, SHADER_PARAM_TYPE_COLOR, "[1 1 1]", "color of outline for distance coded images." )
|
|
SHADER_PARAM( OUTLINEALPHA, SHADER_PARAM_TYPE_FLOAT, "0.0", "alpha value for outline")
|
|
SHADER_PARAM( OUTLINESTART0, SHADER_PARAM_TYPE_FLOAT, "0.0", "outer start value for outline")
|
|
SHADER_PARAM( OUTLINESTART1, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner start value for outline")
|
|
SHADER_PARAM( OUTLINEEND0, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner end value for outline")
|
|
SHADER_PARAM( OUTLINEEND1, SHADER_PARAM_TYPE_FLOAT, "0.0", "outer end value for outline")
|
|
SHADER_PARAM( SCALEOUTLINESOFTNESSBASEDONSCREENRES, SHADER_PARAM_TYPE_BOOL, "0", "Scale the size of the soft part of the outline based upon resolution. 1024x768 = nominal.")
|
|
|
|
SHADER_PARAM( SEPARATEDETAILUVS, SHADER_PARAM_TYPE_BOOL, "0", "Use texcoord1 for detail texture" )
|
|
|
|
SHADER_PARAM( GAMMACOLORREAD, SHADER_PARAM_TYPE_INTEGER, "0", "Disables SRGB conversion of color texture read." )
|
|
SHADER_PARAM( LINEARWRITE, SHADER_PARAM_TYPE_INTEGER, "0", "Disables SRGB conversion of shader results." )
|
|
|
|
SHADER_PARAM( DEPTHBLEND, SHADER_PARAM_TYPE_INTEGER, "0", "fade at intersection boundaries" )
|
|
SHADER_PARAM( DEPTHBLENDSCALE, SHADER_PARAM_TYPE_FLOAT, "50.0", "Amplify or reduce DEPTHBLEND fading. Lower values make harder edges." )
|
|
SHADER_PARAM( RECEIVEFLASHLIGHT, SHADER_PARAM_TYPE_INTEGER, "0", "Forces this material to receive flashlights." )
|
|
|
|
END_SHADER_PARAMS
|
|
|
|
void SetupVars( VertexLitGeneric_DX9_Vars_t& info )
|
|
{
|
|
info.m_nBaseTexture = BASETEXTURE;
|
|
info.m_nBaseTextureFrame = FRAME;
|
|
info.m_nBaseTextureTransform = BASETEXTURETRANSFORM;
|
|
info.m_nAlbedo = ALBEDO;
|
|
info.m_nSelfIllumTint = -1;
|
|
info.m_nDetail = DETAIL;
|
|
info.m_nDetailFrame = DETAILFRAME;
|
|
info.m_nDetailScale = DETAILSCALE;
|
|
info.m_nDetailTextureCombineMode = DETAILBLENDMODE;
|
|
info.m_nDetailTextureBlendFactor = DETAILBLENDFACTOR;
|
|
info.m_nDetailTextureTransform = DETAILTEXTURETRANSFORM;
|
|
|
|
info.m_nEnvmap = ENVMAP;
|
|
info.m_nEnvmapFrame = ENVMAPFRAME;
|
|
info.m_nEnvmapMask = ENVMAPMASK;
|
|
info.m_nEnvmapMaskFrame = ENVMAPMASKFRAME;
|
|
info.m_nEnvmapMaskTransform = ENVMAPMASKTRANSFORM;
|
|
info.m_nEnvmapTint = ENVMAPTINT;
|
|
info.m_nBumpmap = -1;
|
|
info.m_nBumpFrame = -1;
|
|
info.m_nBumpTransform = -1;
|
|
info.m_nEnvmapContrast = ENVMAPCONTRAST;
|
|
info.m_nEnvmapSaturation = ENVMAPSATURATION;
|
|
info.m_nAlphaTestReference = ALPHATESTREFERENCE;
|
|
info.m_nVertexAlphaTest = VERTEXALPHATEST;
|
|
info.m_nFlashlightTexture = FLASHLIGHTTEXTURE;
|
|
info.m_nFlashlightTextureFrame = FLASHLIGHTTEXTUREFRAME;
|
|
info.m_nHDRColorScale = HDRCOLORSCALE;
|
|
info.m_nPhongExponent = -1;
|
|
info.m_nPhongExponentTexture = -1;
|
|
info.m_nDiffuseWarpTexture = -1;
|
|
info.m_nPhongWarpTexture = -1;
|
|
info.m_nPhongBoost = -1;
|
|
info.m_nPhongFresnelRanges = -1;
|
|
info.m_nPhong = -1;
|
|
info.m_nPhongTint = -1;
|
|
info.m_nPhongAlbedoTint = -1;
|
|
info.m_nSelfIllumEnvMapMask_Alpha = -1;
|
|
info.m_nAmbientOnly = -1;
|
|
info.m_nBaseMapAlphaPhongMask = -1;
|
|
info.m_nEnvmapFresnel = -1;
|
|
info.m_nSelfIllumMask = -1;
|
|
|
|
info.m_nDistanceAlpha = DISTANCEALPHA;
|
|
info.m_nDistanceAlphaFromDetail = DISTANCEALPHAFROMDETAIL;
|
|
info.m_nSoftEdges = SOFTEDGES;
|
|
info.m_nEdgeSoftnessStart = EDGESOFTNESSSTART;
|
|
info.m_nEdgeSoftnessEnd = EDGESOFTNESSEND;
|
|
info.m_nScaleEdgeSoftnessBasedOnScreenRes = SCALEEDGESOFTNESSBASEDONSCREENRES;
|
|
|
|
info.m_nGlow = GLOW;
|
|
info.m_nGlowColor = GLOWCOLOR;
|
|
info.m_nGlowAlpha = GLOWALPHA;
|
|
info.m_nGlowStart = GLOWSTART;
|
|
info.m_nGlowEnd = GLOWEND;
|
|
info.m_nGlowX = GLOWX;
|
|
info.m_nGlowY = GLOWY;
|
|
|
|
info.m_nOutline = OUTLINE;
|
|
info.m_nOutlineColor = OUTLINECOLOR;
|
|
info.m_nOutlineAlpha = OUTLINEALPHA;
|
|
info.m_nOutlineStart0 = OUTLINESTART0;
|
|
info.m_nOutlineStart1 = OUTLINESTART1;
|
|
info.m_nOutlineEnd0 = OUTLINEEND0;
|
|
info.m_nOutlineEnd1 = OUTLINEEND1;
|
|
info.m_nScaleOutlineSoftnessBasedOnScreenRes = SCALEOUTLINESOFTNESSBASEDONSCREENRES;
|
|
|
|
info.m_nSeparateDetailUVs = SEPARATEDETAILUVS;
|
|
|
|
info.m_nLinearWrite = LINEARWRITE;
|
|
info.m_nGammaColorRead = GAMMACOLORREAD;
|
|
|
|
info.m_nDepthBlend = DEPTHBLEND;
|
|
info.m_nDepthBlendScale = DEPTHBLENDSCALE;
|
|
info.m_nReceiveFlashlight = RECEIVEFLASHLIGHT;
|
|
}
|
|
|
|
SHADER_INIT_PARAMS()
|
|
{
|
|
VertexLitGeneric_DX9_Vars_t vars;
|
|
SetupVars( vars );
|
|
InitParamsVertexLitGeneric_DX9( this, params, pMaterialName, false, vars );
|
|
}
|
|
|
|
SHADER_FALLBACK
|
|
{
|
|
if( g_pHardwareConfig->GetDXSupportLevel() < 90 )
|
|
{
|
|
return "UnlitGeneric_DX8";
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
SHADER_INIT
|
|
{
|
|
VertexLitGeneric_DX9_Vars_t vars;
|
|
SetupVars( vars );
|
|
InitVertexLitGeneric_DX9( this, params, false, vars );
|
|
}
|
|
|
|
SHADER_DRAW
|
|
{
|
|
VertexLitGeneric_DX9_Vars_t vars;
|
|
SetupVars( vars );
|
|
|
|
//ConVarRef r_flashlight_version2 = ConVarRef( "r_flashlight_version2" );
|
|
|
|
//bool bNewFlashlightPath = IsX360() || ( r_flashlight_version2.GetInt() != 0 );
|
|
if ( ( pShaderShadow == NULL ) && ( pShaderAPI != NULL ) && /*!bNewFlashlightPath &&*/ pShaderAPI->InFlashlightMode() ) // Not snapshotting && flashlight pass
|
|
{
|
|
Draw( false );
|
|
}
|
|
else
|
|
{
|
|
DrawVertexLitGeneric_DX9( this, params, pShaderAPI, pShaderShadow, false, vars, vertexCompression, pContextDataPtr );
|
|
}
|
|
}
|
|
END_SHADER
|