mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-09 19:41:36 +00:00
commit
af9365d738
13 changed files with 183 additions and 35 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -26,4 +26,48 @@
|
|||
|
||||
// Outputs
|
||||
output OnIgnite(void) : "Fired when this object catches fire."
|
||||
]
|
||||
]
|
||||
|
||||
// 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." =
|
||||
[
|
||||
0 : "No"
|
||||
1 : "Yes"
|
||||
]
|
||||
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." =
|
||||
[
|
||||
0 : "No"
|
||||
1 : "Yes"
|
||||
]
|
||||
lightworld(Choices) : "Light World" : 1 : "Control whether flashlight effects static world geometry." =
|
||||
[
|
||||
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"
|
||||
]
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue