//========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $Header: $ // $NoKeywords: $ //=============================================================================// #include "BaseVSShader.h" #include "vertexlitgeneric_dx9_helper.h" BEGIN_VS_SHADER( VertexLitGeneric_DX9, "Help for VertexLitGeneric_DX9" ) BEGIN_SHADER_PARAMS SHADER_PARAM( ALBEDO, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "albedo (Base texture with no baked lighting)" ) SHADER_PARAM( SELFILLUMTINT, SHADER_PARAM_TYPE_COLOR, "[1 1 1]", "Self-illumination tint" ) 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, "0", "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( BUMPMAP, SHADER_PARAM_TYPE_TEXTURE, "models/shadertest/shader1_normal", "bump map" ) SHADER_PARAM( BUMPFRAME, SHADER_PARAM_TYPE_INTEGER, "0", "frame number for $bumpmap" ) SHADER_PARAM( BUMPTRANSFORM, SHADER_PARAM_TYPE_MATRIX, "center .5 .5 scale 1 1 rotate 0 translate 0 0", "$bumpmap texcoord transform" ) 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( SELFILLUM_ENVMAPMASK_ALPHA, SHADER_PARAM_TYPE_FLOAT,"0.0","defines that self illum value comes from env map mask alpha" ) // Debugging term for visualizing ambient data on its own SHADER_PARAM( AMBIENTONLY, SHADER_PARAM_TYPE_INTEGER, "0", "Control drawing of non-ambient light ()" ) SHADER_PARAM( PHONGEXPONENT, SHADER_PARAM_TYPE_FLOAT, "5.0", "Phong exponent for local specular lights" ) SHADER_PARAM( LIGHTWARPTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "1D ramp texture for tinting scalar diffuse term" ) 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" ) 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 = SELFILLUMTINT; info.m_nDetail = DETAIL; info.m_nDetailFrame = DETAILFRAME; info.m_nDetailScale = DETAILSCALE; 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 = BUMPMAP; info.m_nBumpFrame = BUMPFRAME; info.m_nBumpTransform = BUMPTRANSFORM; info.m_nEnvmapContrast = ENVMAPCONTRAST; info.m_nEnvmapSaturation = ENVMAPSATURATION; info.m_nAlphaTestReference = -1; info.m_nFlashlightTexture = FLASHLIGHTTEXTURE; info.m_nFlashlightTextureFrame = FLASHLIGHTTEXTUREFRAME; info.m_nSelfIllumEnvMapMask_Alpha = SELFILLUM_ENVMAPMASK_ALPHA; info.m_nAmbientOnly = AMBIENTONLY; info.m_nPhongExponent = PHONGEXPONENT; info.m_nPhongExponentTexture = PHONGEXPONENTTEXTURE; info.m_nLightWarpTexture = LIGHTWARPTEXTURE; info.m_nPhongBoost = PHONGBOOST; info.m_nPhongFresnelRanges = PHONGFRESNELRANGES; info.m_nPhong = PHONG; } SHADER_INIT_PARAMS() { VertexLitGeneric_DX9_Vars_t vars; SetupVars( vars ); InitParamsVertexLitGeneric_DX9( this, params, pMaterialName, true, vars ); } SHADER_FALLBACK { if (g_pHardwareConfig->GetDXSupportLevel() < 70) return "VertexLitGeneric_DX6"; if (g_pHardwareConfig->GetDXSupportLevel() < 80) return "VertexLitGeneric_DX7"; if (g_pHardwareConfig->GetDXSupportLevel() < 90) return "VertexLitGeneric_DX8"; return 0; } SHADER_INIT { VertexLitGeneric_DX9_Vars_t vars; SetupVars( vars ); InitVertexLitGeneric_DX9( this, params, true, vars ); } SHADER_DRAW { VertexLitGeneric_DX9_Vars_t vars; SetupVars( vars ); DrawVertexLitGeneric_DX9( this, params, pShaderAPI, pShaderShadow, true, vars ); Draw(); } END_SHADER
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5821 | Knut Wikstrom |
Added Valve Source code. This is NOT to be commited to other than new code from Valve. |