Merge remote-tracking branch 'origin/master'

# Conflicts:
#	sp/FeaturesAdded.txt
#	sp/game/sdk2013CE/sdk2013ce.fgd
This commit is contained in:
DankParrot 2016-09-06 19:56:00 -07:00
commit 7ea6f5f86f
16 changed files with 224 additions and 72 deletions

View file

@ -18,7 +18,7 @@
#include "tier0/memdbgon.h"
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.0005", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
//-----------------------------------------------------------------------------
// Purpose:
@ -172,7 +172,19 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
}
else
{
AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp );
// VXP: Fixing targeting
Vector vecToTarget;
QAngle vecAngles;
if ( m_hTargetEntity == NULL )
{
vecAngles = GetAbsAngles();
}
else
{
vecToTarget = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
VectorAngles( vecToTarget, vecAngles );
}
AngleVectors( vecAngles, &vForward, &vRight, &vUp );
}
state.m_fHorizontalFOVDegrees = m_flLightFOV;
@ -220,16 +232,12 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
}
g_pClientShadowMgr->SetFlashlightLightWorld( m_LightHandle, m_bLightWorld );
if ( bForceUpdate == false )
{
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
}
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
}
void C_EnvProjectedTexture::Simulate( void )
{
UpdateLight( false );
UpdateLight( GetMoveParent() != NULL );
BaseClass::Simulate();
}

View file

@ -1290,8 +1290,8 @@ bool CClientShadowMgr::Init()
SetShadowBlobbyCutoffArea( 0.005 );
bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;
m_nMaxDepthTextureShadows = bTools ? 4 : 1; // Just one shadow depth texture in games, more in tools
// bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;
m_nMaxDepthTextureShadows = 10;
bool bLowEnd = ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 );
@ -1336,6 +1336,13 @@ void CClientShadowMgr::InitDepthTextureShadows()
{
VPROF_BUDGET( "CClientShadowMgr::InitDepthTextureShadows", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// SAUL: start benchmark timer
CFastTimer timer;
timer.Start();
// SAUL: set m_nDepthTextureResolution to the depth resolution we want
m_nDepthTextureResolution = r_flashlightdepthres.GetInt();
if( !m_bDepthTextureActive )
{
m_bDepthTextureActive = true;
@ -1352,7 +1359,8 @@ void CClientShadowMgr::InitDepthTextureShadows()
m_DummyColorTexture.InitRenderTargetTexture( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, "_rt_ShadowDummy" );
m_DummyColorTexture.InitRenderTargetSurface( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), IMAGE_FORMAT_BGR565, true );
#else
m_DummyColorTexture.InitRenderTarget( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
// SAUL: we want to create a render target of specific size, so use RT_SIZE_NO_CHANGE
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#endif
// Create some number of depth-stencil textures
@ -1372,9 +1380,13 @@ void CClientShadowMgr::InitDepthTextureShadows()
depthTex.InitRenderTargetTexture( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, dstFormat, MATERIAL_RT_DEPTH_NONE, false, strRTName );
depthTex.InitRenderTargetSurface( 1, 1, dstFormat, false );
#else
depthTex.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, dstFormat, MATERIAL_RT_DEPTH_NONE, false, strRTName );
// SAUL: we want to create a *DEPTH TEXTURE* of specific size, so use RT_SIZE_NO_CHANGE and MATERIAL_RT_DEPTH_ONLY
depthTex.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, dstFormat, MATERIAL_RT_DEPTH_ONLY, false, strRTName );
#endif
// SAUL: ensure the depth texture size wasn't changed
Assert(depthTex->GetActualWidth() == m_nDepthTextureResolution);
if ( i == 0 )
{
// Shadow may be resized during allocation (due to resolution constraints etc)
@ -1388,6 +1400,9 @@ void CClientShadowMgr::InitDepthTextureShadows()
materials->EndRenderTargetAllocation();
}
timer.End();
DevMsg("InitDepthTextureShadows took %.2f msec\n", timer.GetDuration().GetMillisecondsF());
}
void CClientShadowMgr::ShutdownDepthTextureShadows()
@ -2626,6 +2641,13 @@ void CClientShadowMgr::BuildFlashlight( ClientShadowHandle_t handle )
VPROF_BUDGET( "CClientShadowMgr::BuildFlashlight", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// Don't project the flashlight if the frustum AABB is not in our view
Vector mins, maxs;
CalculateAABBFromProjectionMatrix(shadow.m_WorldToShadow, &mins, &maxs);
if(engine->CullBox(mins, maxs))
return;
bool bLightModels = r_flashlightmodels.GetBool();
bool bLightSpecificEntity = shadow.m_hTargetEntity.Get() != NULL;
bool bLightWorld = ( shadow.m_Flags & SHADOW_FLAGS_LIGHT_WORLD ) != 0;
@ -3852,7 +3874,7 @@ int CClientShadowMgr::BuildActiveShadowDepthList( const CViewSetup &viewSetup, i
continue;
// Calculate an AABB around the shadow frustum
Vector vecAbsMins, vecAbsMaxs;
/* Vector vecAbsMins, vecAbsMaxs;
CalculateAABBFromProjectionMatrix( shadow.m_WorldToShadow, &vecAbsMins, &vecAbsMaxs );
Frustum_t viewFrustum;
@ -3864,7 +3886,7 @@ int CClientShadowMgr::BuildActiveShadowDepthList( const CViewSetup &viewSetup, i
{
shadowmgr->SetFlashlightDepthTexture( shadow.m_ShadowHandle, NULL, 0 );
continue;
}
}*/
if ( nActiveDepthShadowCount >= nMaxDepthShadows )
{

View file

@ -66,6 +66,9 @@ C_BaseHLPlayer::C_BaseHLPlayer()
m_flZoomRate = 0.0f;
m_flZoomStartTime = 0.0f;
m_flSpeedMod = cl_forwardspeed.GetFloat();
ConVarRef scissor( "r_flashlightscissor" );
scissor.SetValue( "0" );
}
//-----------------------------------------------------------------------------

View file

@ -4983,6 +4983,10 @@ void CShadowDepthView::Draw()
render->Push3DView( (*this), VIEW_CLEAR_DEPTH, m_pRenderTarget, GetFrustum() );
}
pRenderContext.GetFrom(materials);
pRenderContext->PushRenderTargetAndViewport(m_pRenderTarget, m_pDepthTexture, 0, 0, m_pDepthTexture->GetMappingWidth(), m_pDepthTexture->GetMappingWidth());
pRenderContext.SafeRelease();
SetupCurrentView( origin, angles, VIEW_SHADOW_DEPTH_TEXTURE );
MDLCACHE_CRITICAL_SECTION();
@ -5027,6 +5031,7 @@ void CShadowDepthView::Draw()
pRenderContext->CopyRenderTargetToTextureEx( m_pDepthTexture, -1, NULL, NULL );
}
pRenderContext->PopRenderTargetAndViewport();
render->PopView( GetFrustum() );
#if defined( _X360 )

View file

@ -73,7 +73,7 @@ BEGIN_DATADESC( CEnvProjectedTexture )
DEFINE_KEYFIELD( m_bLightWorld, FIELD_BOOLEAN, "lightworld" ),
DEFINE_KEYFIELD( m_bCameraSpace, FIELD_BOOLEAN, "cameraspace" ),
DEFINE_KEYFIELD( m_flAmbient, FIELD_FLOAT, "ambient" ),
DEFINE_AUTO_ARRAY_KEYFIELD( m_SpotlightTextureName, FIELD_CHARACTER, "texturename" ),
DEFINE_AUTO_ARRAY( m_SpotlightTextureName, FIELD_CHARACTER ),
DEFINE_KEYFIELD( m_nSpotlightTextureFrame, FIELD_INTEGER, "textureframe" ),
DEFINE_KEYFIELD( m_flNearZ, FIELD_FLOAT, "nearz" ),
DEFINE_KEYFIELD( m_flFarZ, FIELD_FLOAT, "farz" ),
@ -161,6 +161,10 @@ bool CEnvProjectedTexture::KeyValue( const char *szKeyName, const char *szValue
UTIL_ColorStringToLinearFloatColor( tmp, szValue );
m_LinearFloatLightColor = tmp;
}
else if ( FStrEq(szKeyName, "texturename" ) )
{
Q_strcpy( m_SpotlightTextureName.GetForModify(), szValue );
}
else
{
return BaseClass::KeyValue( szKeyName, szValue );
@ -239,7 +243,17 @@ void CEnvProjectedTexture::Activate( void )
void CEnvProjectedTexture::InitialThink( void )
{
m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
if ( m_hTargetEntity == NULL && m_target != NULL_STRING )
m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
if ( m_hTargetEntity == NULL )
return;
Vector vecToTarget = (m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin());
QAngle vecAngles;
VectorAngles( vecToTarget, vecAngles );
SetAbsAngles( vecAngles );
SetNextThink( gpGlobals->curtime + 0.1 );
}
int CEnvProjectedTexture::UpdateTransmitState()

View file

@ -145,7 +145,7 @@ public:
// Should this object receive shadows?
virtual bool ShouldReceiveProjectedTextures( int flags )
{
return false;
return true;
}
// Add entity to visible view models list?

View file

@ -16,6 +16,7 @@ Files touched: viewrender.cpp
Files added: ShaderEditorSystem.cpp, ShaderEditorSystem.h, SEdit_ModelRender.cpp, SEdit_ModelRender.h, SEdit_ModelRender.h, ISEdit_ModelRender.h, more files that i can't remember
Notes: Run with the launch parameter "-shaderedit" to open SSE
<<<<<<< HEAD
**********
Prop Scaling
**********
@ -24,3 +25,10 @@ Files modified:
utils/vbsp/StaticProp.cpp
(and other related files)
game\sdk2013CE\sdk2013ce.fgd
=======
/*********
Author(s): Marnamai
Files touched: c_detailobjectsystem.cpp
Notes: Enabled shape support / Fixed aspect ratio for detail.vbsp / Allowed vertex lit models
/*********
>>>>>>> origin/master

View file

@ -1,8 +1,8 @@
"GameInfo"
{
game "SDK 2013 overhaul" //This is what is shown on Steam
title "SDK 2013 overhaul" //This is the main menu title
title2 "" //This goes under title1 as a subtitle, e.g. Episode 2
game "SDK 2013 CE" //This is what is shown on Steam
title "SDK 2013" //This is the main menu title
title2 "Community Edition" //This goes under title1 as a subtitle, e.g. Episode 2
type singleplayer_only

View file

@ -28,6 +28,7 @@
output OnIgnite(void) : "Fired when this object catches fire."
]
<<<<<<< HEAD
@BaseClass base(Angles, DXLevelChoice) = prop_static_base
[
model(studio) : "World Model"
@ -40,10 +41,28 @@
6: "Use VPhysics"
]
disableshadows(choices) : "Disable Shadows" : 0 =
=======
// lightprop("models/editor/spot.mdl") <---- use this once the orientation is unfucked
@PointClass base(Targetname, Parentname, Angles) size(-2 -2 -2, 2 2 2) frustum(lightfov,nearz,farz,lightcolor,-1) = env_projectedtexture :
"Projected texture entity."
[
spawnflags(flags) =
[
1 : "Enabled" : 1
]
target(target_destination) : "target" : : "target"
lightfov(float) : "FOV" : "90.0" : "FOV"
nearz(float) : "NearZ" : "4.0" : "Near Z for projected texture"
farz(float) : "FarZ" : "750.0" : "Far Z for projected texture"
enableshadows(Choices) : "Enable Shadows" : 0 : "Enables/disables shadows from this projected texture." =
>>>>>>> origin/master
[
0 : "No"
1 : "Yes"
]
<<<<<<< HEAD
screenspacefade(choices) : "Screen Space Fade" : 0 : "The method by which the fading distance should be determined. If 'No', the fade distances is the distance from the player's view to the object, in inches. If 'Yes', the fade distance is the size of the object onscreen, in pixels." =
[
0 : "No"
@ -56,18 +75,42 @@
" Numbers smaller than 1 cause the prop to fade out at further distances, and greater than 1 cause it to fade out at closer distances."
lightingorigin(target_destination) : "Lighting Origin" : "" : "Select an info_lighting to specify a location to sample lighting from, instead of using this entity's origin."
disablevertexlighting(choices) : "Disable Vertex lighting" : 0 =
=======
shadowquality(Choices) : "Shadow Quality" : 1 : "Quality of shadows." =
[
0 : "Low"
1 : "High"
]
lightonlytarget(Choices) : "Light Only Target" : 0 : "Limit flashlight effect to only effect target entity." =
>>>>>>> origin/master
[
0 : "No"
1 : "Yes"
]
<<<<<<< HEAD
disableselfshadowing(choices) : "Disable Self-Shadowing with vertex lighting" : 0 =
=======
lightworld(Choices) : "Light World" : 1 : "Control whether flashlight effects static world geometry." =
>>>>>>> origin/master
[
0 : "No"
1 : "Yes"
]
<<<<<<< HEAD
ignorenormals(choices) : "Ignore surface normal for computing vertex lighting" : 0 =
[
0 : "No"
1 : "Yes"
]
]
]
=======
lightcolor(color255) : "Light Color" : "255 255 255 200" : "Light Color RGB-Intensity"
cameraspace(integer) : "Camera Space" : 0 : "Angles are interpreted as being relative to camera."
texturename(material) : "Texture" : : "path/texture to be projected. Relative to main/materials/"
// Inputs
input TurnOn(void) : "Turn on the texture"
input TurnOff(void) : "Turn off the texture"
input SetFOV(float) : "Set FOV"
]
>>>>>>> origin/master

View file

@ -18,7 +18,7 @@
#include "tier0/memdbgon.h"
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.0005", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
//-----------------------------------------------------------------------------
// Purpose:
@ -172,7 +172,19 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
}
else
{
AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp );
// VXP: Fixing targeting
Vector vecToTarget;
QAngle vecAngles;
if ( m_hTargetEntity == NULL )
{
vecAngles = GetAbsAngles();
}
else
{
vecToTarget = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
VectorAngles( vecToTarget, vecAngles );
}
AngleVectors( vecAngles, &vForward, &vRight, &vUp );
}
state.m_fHorizontalFOVDegrees = m_flLightFOV;
@ -220,16 +232,12 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
}
g_pClientShadowMgr->SetFlashlightLightWorld( m_LightHandle, m_bLightWorld );
if ( bForceUpdate == false )
{
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
}
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
}
void C_EnvProjectedTexture::Simulate( void )
{
UpdateLight( false );
UpdateLight( GetMoveParent() != NULL );
BaseClass::Simulate();
}

View file

@ -1290,8 +1290,8 @@ bool CClientShadowMgr::Init()
SetShadowBlobbyCutoffArea( 0.005 );
bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;
m_nMaxDepthTextureShadows = bTools ? 4 : 1; // Just one shadow depth texture in games, more in tools
// bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;
m_nMaxDepthTextureShadows = 10;
bool bLowEnd = ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 );
@ -1336,6 +1336,13 @@ void CClientShadowMgr::InitDepthTextureShadows()
{
VPROF_BUDGET( "CClientShadowMgr::InitDepthTextureShadows", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// SAUL: start benchmark timer
CFastTimer timer;
timer.Start();
// SAUL: set m_nDepthTextureResolution to the depth resolution we want
m_nDepthTextureResolution = r_flashlightdepthres.GetInt();
if( !m_bDepthTextureActive )
{
m_bDepthTextureActive = true;
@ -1352,7 +1359,8 @@ void CClientShadowMgr::InitDepthTextureShadows()
m_DummyColorTexture.InitRenderTargetTexture( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, "_rt_ShadowDummy" );
m_DummyColorTexture.InitRenderTargetSurface( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), IMAGE_FORMAT_BGR565, true );
#else
m_DummyColorTexture.InitRenderTarget( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
// SAUL: we want to create a render target of specific size, so use RT_SIZE_NO_CHANGE
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#endif
// Create some number of depth-stencil textures
@ -1372,9 +1380,13 @@ void CClientShadowMgr::InitDepthTextureShadows()
depthTex.InitRenderTargetTexture( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, dstFormat, MATERIAL_RT_DEPTH_NONE, false, strRTName );
depthTex.InitRenderTargetSurface( 1, 1, dstFormat, false );
#else
depthTex.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, dstFormat, MATERIAL_RT_DEPTH_NONE, false, strRTName );
// SAUL: we want to create a *DEPTH TEXTURE* of specific size, so use RT_SIZE_NO_CHANGE and MATERIAL_RT_DEPTH_ONLY
depthTex.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, dstFormat, MATERIAL_RT_DEPTH_ONLY, false, strRTName );
#endif
// SAUL: ensure the depth texture size wasn't changed
Assert(depthTex->GetActualWidth() == m_nDepthTextureResolution);
if ( i == 0 )
{
// Shadow may be resized during allocation (due to resolution constraints etc)
@ -1388,6 +1400,9 @@ void CClientShadowMgr::InitDepthTextureShadows()
materials->EndRenderTargetAllocation();
}
timer.End();
DevMsg("InitDepthTextureShadows took %.2f msec\n", timer.GetDuration().GetMillisecondsF());
}
void CClientShadowMgr::ShutdownDepthTextureShadows()
@ -2623,6 +2638,13 @@ void CClientShadowMgr::BuildFlashlight( ClientShadowHandle_t handle )
VPROF_BUDGET( "CClientShadowMgr::BuildFlashlight", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// Don't project the flashlight if the frustum AABB is not in our view
Vector mins, maxs;
CalculateAABBFromProjectionMatrix(shadow.m_WorldToShadow, &mins, &maxs);
if(engine->CullBox(mins, maxs))
return;
bool bLightModels = r_flashlightmodels.GetBool();
bool bLightSpecificEntity = shadow.m_hTargetEntity.Get() != NULL;
bool bLightWorld = ( shadow.m_Flags & SHADOW_FLAGS_LIGHT_WORLD ) != 0;
@ -3849,7 +3871,7 @@ int CClientShadowMgr::BuildActiveShadowDepthList( const CViewSetup &viewSetup, i
continue;
// Calculate an AABB around the shadow frustum
Vector vecAbsMins, vecAbsMaxs;
/* Vector vecAbsMins, vecAbsMaxs;
CalculateAABBFromProjectionMatrix( shadow.m_WorldToShadow, &vecAbsMins, &vecAbsMaxs );
Frustum_t viewFrustum;
@ -3861,7 +3883,7 @@ int CClientShadowMgr::BuildActiveShadowDepthList( const CViewSetup &viewSetup, i
{
shadowmgr->SetFlashlightDepthTexture( shadow.m_ShadowHandle, NULL, 0 );
continue;
}
}*/
if ( nActiveDepthShadowCount >= nMaxDepthShadows )
{

View file

@ -1,3 +1,11 @@
//----------------------------------
// CHANGES
//
// Enabled shape support
// Fixed aspect ratio for detail.vbsp
// Allowed vertex lit models
//----------------------------------
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Draws grasses and other small objects
@ -26,14 +34,10 @@
#include <algorithm>
#include "tier0/valve_minmax_on.h"
#if defined(DOD_DLL) || defined(CSTRIKE_DLL)
#define USE_DETAIL_SHAPES
#endif
#ifdef USE_DETAIL_SHAPES
#include "engine/ivdebugoverlay.h"
#include "playerenumerator.h"
#endif
#include "materialsystem/imaterialsystemhardwareconfig.h"
@ -1471,24 +1475,7 @@ void CDetailObjectSystem::LevelInitPreEntity()
}
}
if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() )
{
// There are detail objects in the level, so precache the material
PrecacheMaterial( DETAIL_SPRITE_MATERIAL );
IMaterial *pMat = m_DetailSpriteMaterial;
// adjust for non-square textures (cropped)
float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight();
if ( flRatio > 1.0 )
{
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
{
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
}
}
}
int detailPropLightingLump;
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
@ -1512,13 +1499,30 @@ void CDetailObjectSystem::LevelInitPreEntity()
void CDetailObjectSystem::LevelInitPostEntity()
{
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
C_World *pWorld = GetClientWorldEntity();
if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) )
if (m_DetailObjects.Count() || m_DetailSpriteDict.Count())
{
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
C_World *pWorld = GetClientWorldEntity();
if (pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()))
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
m_DetailSpriteMaterial.Init(pDetailSpriteMaterial, TEXTURE_GROUP_OTHER);
PrecacheMaterial(pDetailSpriteMaterial);
IMaterial *pMat = m_DetailSpriteMaterial;
// adjust for non-square textures (cropped)
float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight();
if (flRatio > 1.0)
{
for (int i = 0; i<m_DetailSpriteDict.Count(); i++)
{
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
}
}
}
m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
if ( GetDetailController() )
{
@ -1595,13 +1599,6 @@ void CDetailObjectSystem::UnserializeModelDict( CUtlBuffer& buf )
DetailModelDict_t dict;
dict.m_pModel = (model_t *)engine->LoadModel( lump.m_Name, true );
// Don't allow vertex-lit models
if (modelinfo->IsModelVertexLit(dict.m_pModel))
{
Warning("Detail prop model %s is using vertex-lit materials!\nIt must use unlit materials!\n", lump.m_Name );
dict.m_pModel = (model_t *)engine->LoadModel( "models/error.mdl" );
}
m_DetailObjectDict.AddToTail( dict );
}
}

View file

@ -66,6 +66,9 @@ C_BaseHLPlayer::C_BaseHLPlayer()
m_flZoomRate = 0.0f;
m_flZoomStartTime = 0.0f;
m_flSpeedMod = cl_forwardspeed.GetFloat();
ConVarRef scissor( "r_flashlightscissor" );
scissor.SetValue( "0" );
}
//-----------------------------------------------------------------------------

View file

@ -4997,6 +4997,10 @@ void CShadowDepthView::Draw()
render->Push3DView( (*this), VIEW_CLEAR_DEPTH, m_pRenderTarget, GetFrustum() );
}
pRenderContext.GetFrom(materials);
pRenderContext->PushRenderTargetAndViewport(m_pRenderTarget, m_pDepthTexture, 0, 0, m_pDepthTexture->GetMappingWidth(), m_pDepthTexture->GetMappingWidth());
pRenderContext.SafeRelease();
SetupCurrentView( origin, angles, VIEW_SHADOW_DEPTH_TEXTURE );
MDLCACHE_CRITICAL_SECTION();
@ -5041,6 +5045,7 @@ void CShadowDepthView::Draw()
pRenderContext->CopyRenderTargetToTextureEx( m_pDepthTexture, -1, NULL, NULL );
}
pRenderContext->PopRenderTargetAndViewport();
render->PopView( GetFrustum() );
#if defined( _X360 )

View file

@ -73,7 +73,7 @@ BEGIN_DATADESC( CEnvProjectedTexture )
DEFINE_KEYFIELD( m_bLightWorld, FIELD_BOOLEAN, "lightworld" ),
DEFINE_KEYFIELD( m_bCameraSpace, FIELD_BOOLEAN, "cameraspace" ),
DEFINE_KEYFIELD( m_flAmbient, FIELD_FLOAT, "ambient" ),
DEFINE_AUTO_ARRAY_KEYFIELD( m_SpotlightTextureName, FIELD_CHARACTER, "texturename" ),
DEFINE_AUTO_ARRAY( m_SpotlightTextureName, FIELD_CHARACTER ),
DEFINE_KEYFIELD( m_nSpotlightTextureFrame, FIELD_INTEGER, "textureframe" ),
DEFINE_KEYFIELD( m_flNearZ, FIELD_FLOAT, "nearz" ),
DEFINE_KEYFIELD( m_flFarZ, FIELD_FLOAT, "farz" ),
@ -161,6 +161,10 @@ bool CEnvProjectedTexture::KeyValue( const char *szKeyName, const char *szValue
UTIL_ColorStringToLinearFloatColor( tmp, szValue );
m_LinearFloatLightColor = tmp;
}
else if ( FStrEq(szKeyName, "texturename" ) )
{
Q_strcpy( m_SpotlightTextureName.GetForModify(), szValue );
}
else
{
return BaseClass::KeyValue( szKeyName, szValue );
@ -239,7 +243,17 @@ void CEnvProjectedTexture::Activate( void )
void CEnvProjectedTexture::InitialThink( void )
{
m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
if ( m_hTargetEntity == NULL && m_target != NULL_STRING )
m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
if ( m_hTargetEntity == NULL )
return;
Vector vecToTarget = (m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin());
QAngle vecAngles;
VectorAngles( vecToTarget, vecAngles );
SetAbsAngles( vecAngles );
SetNextThink( gpGlobals->curtime + 0.1 );
}
int CEnvProjectedTexture::UpdateTransmitState()

View file

@ -145,7 +145,7 @@ public:
// Should this object receive shadows?
virtual bool ShouldReceiveProjectedTextures( int flags )
{
return false;
return true;
}
// Add entity to visible view models list?