mirror of
https://github.com/celisej567/Fake-CSM-Mapbase.git
synced 2026-01-04 18:10:08 +03:00
bebra
This commit is contained in:
@@ -28,7 +28,7 @@ ConVar csm_ortho_left("csm_ortho_left", "-1000");
|
|||||||
ConVar csm_ortho_top("csm_ortho_top", "-1000");
|
ConVar csm_ortho_top("csm_ortho_top", "-1000");
|
||||||
ConVar csm_ortho_bottom("csm_ortho_bottom", "1000");
|
ConVar csm_ortho_bottom("csm_ortho_bottom", "1000");
|
||||||
ConVar csm_ortho_right("csm_ortho_right", "1000");
|
ConVar csm_ortho_right("csm_ortho_right", "1000");
|
||||||
ConVar csm_test_color_interpolation("csm_test_color_interpolation","0");
|
//ConVar csm_test_color_interpolation("csm_test_color_interpolation","0"); //<2F> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: main point for change angle of the light
|
// Purpose: main point for change angle of the light
|
||||||
@@ -259,8 +259,20 @@ void C_EnvCascadeLight::UpdateLight( bool bForceUpdate )
|
|||||||
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
|
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
|
||||||
|
|
||||||
state.m_nShadowQuality = m_nShadowQuality; // Allow entity to affect shadow quality
|
state.m_nShadowQuality = m_nShadowQuality; // Allow entity to affect shadow quality
|
||||||
|
#ifdef MAPBASE
|
||||||
|
|
||||||
|
state.m_bOrtho = csm_ortho.GetBool();
|
||||||
|
if (state.m_bOrtho)
|
||||||
|
{
|
||||||
|
state.m_fOrthoLeft = csm_ortho_left.GetInt();
|
||||||
|
state.m_fOrthoTop = csm_ortho_top.GetInt();
|
||||||
|
state.m_fOrthoRight = csm_ortho_right.GetInt();
|
||||||
|
state.m_fOrthoBottom = csm_ortho_bottom.GetInt();
|
||||||
|
|
||||||
|
state.m_fLinearAtten = ConVarRef("csm_current_distance").GetInt() * 2;
|
||||||
|
state.m_FarZAtten = ConVarRef("csm_current_distance").GetInt() * 2;
|
||||||
|
}
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
if (m_LightHandle == CLIENTSHADOW_INVALID_HANDLE)
|
if (m_LightHandle == CLIENTSHADOW_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
@@ -289,7 +301,7 @@ void C_EnvCascadeLight::UpdateLight( bool bForceUpdate )
|
|||||||
g_pClientShadowMgr->UpdateProjectedTexture(m_LightHandle, true);
|
g_pClientShadowMgr->UpdateProjectedTexture(m_LightHandle, true);
|
||||||
|
|
||||||
//mat_slopescaledepthbias_shadowmap.SetValue("4");
|
//mat_slopescaledepthbias_shadowmap.SetValue("4");
|
||||||
//mat_depthbias_shadowmap.SetValue("0.000001");
|
//mat_depthbias_shadowmap.SetValue("0.00001");
|
||||||
scissor.SetValue("0");
|
scissor.SetValue("0");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -474,7 +486,23 @@ void C_EnvCascadeLightSecond::UpdateLight(bool bForceUpdate)
|
|||||||
|
|
||||||
state.m_nShadowQuality = m_nShadowQuality; // Allow entity to affect shadow quality
|
state.m_nShadowQuality = m_nShadowQuality; // Allow entity to affect shadow quality
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
|
||||||
|
state.m_bOrtho = csm_ortho.GetBool();
|
||||||
|
if(state.m_bOrtho)
|
||||||
|
{
|
||||||
|
float flOrthoSize = 1000.0f;
|
||||||
|
|
||||||
|
state.m_fOrthoLeft = -flOrthoSize;
|
||||||
|
state.m_fOrthoTop = -flOrthoSize;
|
||||||
|
state.m_fOrthoRight = flOrthoSize;
|
||||||
|
state.m_fOrthoBottom = flOrthoSize;
|
||||||
|
|
||||||
|
state.m_fLinearAtten = ConVarRef("csm_current_distance").GetInt() * 2;
|
||||||
|
state.m_FarZAtten = ConVarRef("csm_current_distance").GetInt() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_LightHandle == CLIENTSHADOW_INVALID_HANDLE)
|
if (m_LightHandle == CLIENTSHADOW_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
@@ -499,7 +527,7 @@ void C_EnvCascadeLightSecond::UpdateLight(bool bForceUpdate)
|
|||||||
|
|
||||||
g_pClientShadowMgr->SetFlashlightLightWorld(m_LightHandle, m_bLightWorld);
|
g_pClientShadowMgr->SetFlashlightLightWorld(m_LightHandle, m_bLightWorld);
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
if (state.m_bOrtho)
|
if (state.m_bOrtho)
|
||||||
{
|
{
|
||||||
bool bSupressWorldLights = false;
|
bool bSupressWorldLights = false;
|
||||||
@@ -508,13 +536,14 @@ void C_EnvCascadeLightSecond::UpdateLight(bool bForceUpdate)
|
|||||||
|
|
||||||
g_pClientShadowMgr->SetShadowFromWorldLightsEnabled(!bSupressWorldLights);
|
g_pClientShadowMgr->SetShadowFromWorldLightsEnabled(!bSupressWorldLights);
|
||||||
}
|
}
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
g_pClientShadowMgr->UpdateProjectedTexture(m_LightHandle, true);
|
g_pClientShadowMgr->UpdateProjectedTexture(m_LightHandle, true);
|
||||||
|
|
||||||
m_flLightFOV = ConVarRef("csm_second_fov").GetFloat();
|
m_flLightFOV = ConVarRef("csm_second_fov").GetFloat();
|
||||||
|
|
||||||
//mat_slopescaledepthbias_shadowmap.SetValue("4");
|
//mat_slopescaledepthbias_shadowmap.SetValue("4");
|
||||||
|
//mat_depthbias_shadowmap.SetValue("0.00001");
|
||||||
scissor.SetValue("0");
|
scissor.SetValue("0");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
CLightOrigin();
|
CLightOrigin();
|
||||||
|
|
||||||
bool angFEnv = true;
|
bool angFEnv = false;
|
||||||
|
|
||||||
void InitialThink(void);
|
void InitialThink(void);
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ void CLightOrigin::Spawn()
|
|||||||
QAngle bb = pEnv->GetAbsAngles();
|
QAngle bb = pEnv->GetAbsAngles();
|
||||||
bb.x = bb.x;
|
bb.x = bb.x;
|
||||||
SetAbsAngles(bb);
|
SetAbsAngles(bb);
|
||||||
//Msg("light_environment Founded!\n");
|
|
||||||
ConColorMsg(Color(0,230,0), "light_environment Founded!\n");
|
ConColorMsg(Color(0,230,0), "light_environment Founded!\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -340,7 +340,7 @@ CEnvCascadeLight::CEnvCascadeLight(void)
|
|||||||
m_bLightOnlyTarget = false;
|
m_bLightOnlyTarget = false;
|
||||||
m_bLightWorld = true;
|
m_bLightWorld = true;
|
||||||
m_bCameraSpace = false;
|
m_bCameraSpace = false;
|
||||||
EnableAngleFromEnv = false;
|
EnableAngleFromEnv = true;
|
||||||
|
|
||||||
Q_strcpy(m_SpotlightTextureName.GetForModify(), "tools\\fakecsm\\mask_center");
|
Q_strcpy(m_SpotlightTextureName.GetForModify(), "tools\\fakecsm\\mask_center");
|
||||||
m_nSpotlightTextureFrame = 0;
|
m_nSpotlightTextureFrame = 0;
|
||||||
@@ -363,7 +363,10 @@ void CEnvCascadeLight::Preparation()
|
|||||||
//if origin is exist
|
//if origin is exist
|
||||||
if (CSMOrigin)
|
if (CSMOrigin)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CLightOrigin* pEnv = dynamic_cast<CLightOrigin*>(CSMOrigin);
|
||||||
|
|
||||||
|
|
||||||
CSMSecond = gEntList.FindEntityByClassname(CSMSecond, "second_csm");
|
CSMSecond = gEntList.FindEntityByClassname(CSMSecond, "second_csm");
|
||||||
//if second csm is exist
|
//if second csm is exist
|
||||||
if (CSMSecond)
|
if (CSMSecond)
|
||||||
@@ -373,21 +376,27 @@ void CEnvCascadeLight::Preparation()
|
|||||||
SecondCSM->SetAbsOrigin(GetAbsOrigin());
|
SecondCSM->SetAbsOrigin(GetAbsOrigin());
|
||||||
SecondCSM->SetParent(GetBaseEntity());
|
SecondCSM->SetParent(GetBaseEntity());
|
||||||
SecondCSM->m_LinearFloatLightColor = m_LinearFloatLightColor;
|
SecondCSM->m_LinearFloatLightColor = m_LinearFloatLightColor;
|
||||||
|
|
||||||
DispatchSpawn(SecondCSM);
|
DispatchSpawn(SecondCSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLightOrigin* pEnv = dynamic_cast<CLightOrigin*>(CSMOrigin);
|
SetParent(pEnv, 1);
|
||||||
|
SetAbsOrigin(Vector(pEnv->GetAbsOrigin().x, pEnv->GetAbsOrigin().y, pEnv->GetAbsOrigin().z + curdist.GetInt()));
|
||||||
|
|
||||||
if (EnableAngleFromEnv)
|
if (EnableAngleFromEnv)
|
||||||
{
|
{
|
||||||
pEnv->angFEnv = true;
|
pEnv->angFEnv = true;
|
||||||
|
SetLocalAngles(QAngle(90, 0, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pEnv->SetAbsAngles(GetAbsAngles());
|
pEnv->SetAbsAngles(QAngle(-GetLocalAngles().x, GetLocalAngles().y,-GetLocalAngles().z));
|
||||||
|
|
||||||
|
Msg("pEnv local angle = %f %f %f \n", pEnv->GetLocalAngles().x, pEnv->GetLocalAngles().y, pEnv->GetLocalAngles().z);
|
||||||
|
|
||||||
|
SetLocalAngles(QAngle(90, 0, 0));
|
||||||
|
DevMsg("CSM using light_environment \n");
|
||||||
}
|
}
|
||||||
SetParent(pEnv, 1);
|
|
||||||
SetAbsOrigin(Vector(pEnv->GetAbsOrigin().x, pEnv->GetAbsOrigin().y, pEnv->GetAbsOrigin().z + curdist.GetInt()));
|
|
||||||
|
|
||||||
float bibigon = defdist.GetFloat() / curdist.GetFloat();
|
float bibigon = defdist.GetFloat() / curdist.GetFloat();
|
||||||
curFOV.SetValue(defFOV.GetFloat() * bibigon);
|
curFOV.SetValue(defFOV.GetFloat() * bibigon);
|
||||||
|
|||||||
Reference in New Issue
Block a user