Mapbase v3.0

- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
This commit is contained in:
Blixibon
2020-02-05 19:08:49 +00:00
parent b8611071c5
commit c5f3fa0778
63 changed files with 1909 additions and 335 deletions

View File

@@ -54,6 +54,10 @@ static ConVar mat_fullbright( "mat_fullbright","0", FCVAR_CHEAT );
// NOTE: This is externed in BaseVSShader.h so it needs to be here
ConVar r_flashlightbrightness( "r_flashlightbrightness", "0.25", FCVAR_CHEAT );
#ifdef MAPBASE
ConVar mat_specular_disable_on_missing( "mat_specular_disable_on_missing", "1", FCVAR_ARCHIVE, "Disables specular reflections on a material when the envmap cannot be found." );
#endif
// These functions are to be called from the shaders.
//-----------------------------------------------------------------------------

View File

@@ -25,6 +25,11 @@
#define SUPPORT_DX8 1
#define SUPPORT_DX7 1
#endif
#ifdef MAPBASE
extern ConVar mat_specular_disable_on_missing;
#endif
//-----------------------------------------------------------------------------
// Helper macro for vertex shaders
//-----------------------------------------------------------------------------

View File

@@ -185,7 +185,12 @@ float4 main( PS_INPUT i ) : COLOR
float3 worldSpaceNormal, tangentSpaceNormal;
float fSpecMask = 1.0f;
#if !DETAILTEXTURE
// Blixibon - $bumpmap transform support
float4 normalTexel = tex2D( NormalMapSampler, i.baseTexCoordDetailTexCoord.zw );
#else
float4 normalTexel = tex2D( NormalMapSampler, i.baseTexCoordDetailTexCoord.xy );
#endif
#if WRINKLEMAP
float4 wrinkleNormal = tex2D( NormalWrinkleSampler, i.baseTexCoordDetailTexCoord.xy );

View File

@@ -203,7 +203,12 @@ float4 main( PS_INPUT i ) : COLOR
#endif
float specularFactor = 1.0f;
#if !DETAILTEXTURE
// Blixibon - $bumpmap transform support
float4 normalTexel = tex2D( BumpmapSampler, i.detailTexCoord_atten3.xy );
#else
float4 normalTexel = tex2D( BumpmapSampler, i.baseTexCoord2_tangentSpaceVertToEyeVectorXY.xy );
#endif
float3 tangentSpaceNormal = normalTexel * 2.0f - 1.0f;
if ( bNormalMapAlphaEnvmapMask )

View File

@@ -200,7 +200,12 @@ float4 main( PS_INPUT i ) : COLOR
#endif
float specularFactor = 1.0f;
#if !DETAILTEXTURE
// Blixibon - $bumpmap transform support
float4 normalTexel = tex2D( BumpmapSampler, i.detailTexCoord_atten3.xy );
#else
float4 normalTexel = tex2D( BumpmapSampler, i.baseTexCoord2_tangentSpaceVertToEyeVectorXY.xy );
#endif
float3 tangentSpaceNormal = normalTexel * 2.0f - 1.0f;
if ( bNormalMapAlphaEnvmapMask )

View File

@@ -328,7 +328,12 @@ float4 main( PS_INPUT i ) : COLOR
float4 envmapMaskTexel;
if( bEnvmapMask )
{
#if !DETAILTEXTURE
// Blixibon - $envmapmask transform support
envmapMaskTexel = tex2D( EnvmapMaskSampler, i.detailTexCoord.xy );
#else
envmapMaskTexel = tex2D( EnvmapMaskSampler, i.baseTexCoord.xy );
#endif
specularFactor *= envmapMaskTexel.xyz;
}

View File

@@ -4,6 +4,15 @@
// Project Script for Mapbase shader changes
//-----------------------------------------------------------------------------
$Configuration
{
$Compiler
{
// https://developer.valvesoftware.com/wiki/Parallax_Corrected_Cubemaps
$PreprocessorDefinitions "$BASE;PARALLAX_CORRECTED_CUBEMAPS"
}
}
$Project
{
$Folder "Source Files"

View File

@@ -241,6 +241,21 @@ void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** pa
}
}
#ifdef MAPBASE
// Created for the missing cubemap solution below
void LoadLightmappedGenericEnvmap( CBaseVSShader *pShader, IMaterialVar** params, LightmappedGeneric_DX9_Vars_t &info )
{
if ( !IS_FLAG_SET(MATERIAL_VAR_ENVMAPSPHERE) )
{
pShader->LoadCubeMap( info.m_nEnvmap, g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE ? TEXTUREFLAGS_SRGB : 0 );
}
else
{
pShader->LoadTexture( info.m_nEnvmap );
}
}
#endif
void InitLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, LightmappedGeneric_DX9_Vars_t &info )
{
if ( g_pConfig->UseBumpmapping() && params[info.m_nBumpmap]->IsDefined() )
@@ -303,6 +318,20 @@ void InitLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params,
if (params[info.m_nEnvmap]->IsDefined())
{
#ifdef MAPBASE
LoadLightmappedGenericEnvmap( pShader, params, info );
if (mat_specular_disable_on_missing.GetBool())
{
// Revert to defaultcubemap when the envmap texture is missing
// (should be equivalent to toolsblack in Mapbase)
if (params[info.m_nEnvmap]->GetTextureValue()->IsError())
{
params[info.m_nEnvmap]->SetStringValue( "engine/defaultcubemap" );
LoadLightmappedGenericEnvmap( pShader, params, info );
}
}
#else
if ( !IS_FLAG_SET(MATERIAL_VAR_ENVMAPSPHERE) )
{
pShader->LoadCubeMap( info.m_nEnvmap, g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE ? TEXTUREFLAGS_SRGB : 0 );
@@ -311,6 +340,7 @@ void InitLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params,
{
pShader->LoadTexture( info.m_nEnvmap );
}
#endif
if ( !g_pHardwareConfig->SupportsCubeMaps() )
{

View File

@@ -11,11 +11,6 @@
#include <string.h>
#include "BaseVSShader.h"
#ifdef MAPBASE
// This requires custom compilers, but anyone ahead of us on that should be able to use this anyway
#define PARALLAX_CORRECTED_CUBEMAPS 1
#endif
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------

View File

@@ -734,10 +734,21 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
pShader->SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, info.m_nBaseTextureTransform );
#ifdef MAPBASE
// The original code makes it seem like we have the opportunity to support both $bumptransform and $detail at the same time,
// and that may or may not have been Valve's intention, but we'd need to add another texcoord for this and it's already
// a limitation with the non-skin shader anyway.
if ( bHasBump )
{
pShader->SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, info.m_nBumpTransform );
}
else
#else
if( bHasBump )
{
pShader->SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, info.m_nBumpTransform );
}
#endif
if ( hasDetailTexture )
{

View File

@@ -969,6 +969,18 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
pContextData->m_SemiStaticCmdsOut.SetPixelShaderConstant4( 10, 1, 1, 1, 1 );
}
}
#ifdef MAPBASE
else if ( bHasEnvmapMask && info.m_nEnvmapMaskTransform != -1 )
{
// Use $envmapmasktransform when there is no detail texture taking up this space
pContextData->m_SemiStaticCmdsOut.SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, info.m_nEnvmapMaskTransform );
}
else if ( bHasBump && info.m_nBumpTransform != -1 )
{
// Use $bumptransform when there is no detail texture taking up this space
pContextData->m_SemiStaticCmdsOut.SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, info.m_nBumpTransform );
}
#endif
if ( bDistanceAlpha )
{
float flSoftStart = GetFloatParam( info.m_nEdgeSoftnessStart, params );