Skip to content

Commit

Permalink
summary (required)
Browse files Browse the repository at this point in the history
  • Loading branch information
devonium committed Jul 4, 2023
1 parent b8702a6 commit 5d509ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions include_files/depthpass.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ local function PreDrawEffectsHK()
if bDepthPass then return end
bDepthPass = true
halo.Render = dummyFn


MaterialOverride( depthWriteMat )
BrushMaterialOverride( depthWriteMat )
Expand Down Expand Up @@ -82,9 +81,12 @@ end

local rClearDepth = render.ClearDepth



function shaderlib.__INIT()
halo = halo
hRender = halo.Render
hook.Add("PreDrawViewModel", "EGSM_ImTooLazy", rClearDepth)
hook.Add( "PreDrawEffects", "EGSM_ImTooLazy", PreDrawEffectsHK)

hook.Add("PreDrawViewModel", "!!!EGSM_ImTooLazy", function() if bDepthPass then rClearDepth() end end)
hook.Add( "RenderScene", "!!!EGSM_ImTooLazy", PreDrawEffectsHK)
end
2 changes: 1 addition & 1 deletion source/depthpass.lua.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const char depthpass_lua[] = "\n""local depthWriteMat = CreateMaterial( \"egsm/depthmat\", \"DepthWrite\", {\n""\n"" [\"$no_fullbright\"] = \"1\",\n""\n"" [\"$color_depth\"] = \"1\",\n""\n"" [\"$alpha_test\"] = \"0\",\n""\n""} )\n""\n""\n""local bDepthPass = false\n""\n""local halo = {}\n""\n""local render = render\n""\n""\n""MaterialOverride = MaterialOverride or render.MaterialOverride\n""\n""BrushMaterialOverride = BrushMaterialOverride or render.BrushMaterialOverride \n""\n""WorldMaterialOverride = WorldMaterialOverride or render.WorldMaterialOverride \n""\n""ModelMaterialOverride = ModelMaterialOverride or render.ModelMaterialOverride \n""\n""\n""local MaterialOverride = MaterialOverride\n""\n""local BrushMaterialOverride = BrushMaterialOverride\n""\n""local WorldMaterialOverride = WorldMaterialOverride\n""\n""local ModelMaterialOverride = ModelMaterialOverride\n""\n""\n""function render.MaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" MaterialOverride(m)\n""\n""end\n""\n""\n""function render.BrushMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" BrushMaterialOverride(m)\n""\n""end\n""\n""\n""function render.WorldMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" WorldMaterialOverride(m)\n""\n""end\n""\n""function render.ModelMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" ModelMaterialOverride(m)\n""\n""end\n""\n""\n""local function dummyFn() end\n""\n""\n""local PushRenderTarget = render.PushRenderTarget\n""\n""local PopRenderTarget = render.PopRenderTarget\n""\n""local rClear = render.Clear\n""\n""local depthRT = render.GetResolvedFullFrameDepth()\n""\n""local hRender = dummyFn\n""\n""local BeginDepthPass = shaderlib.BeginDepthPass\n""\n""local EndDepthPass = shaderlib.EndDepthPass\n""\n""\n""local function PreDrawEffectsHK() \n""\n"" if bDepthPass then return end\n""\n"" bDepthPass = true\n""\n"" halo.Render = dummyFn\n""\n""\n"" \n""\n"" MaterialOverride( depthWriteMat )\n""\n"" BrushMaterialOverride( depthWriteMat )\n""\n"" WorldMaterialOverride( depthWriteMat )\n""\n"" ModelMaterialOverride( depthWriteMat )\n""\n"" \n""\n"" BeginDepthPass()\n""\n"" rClear(0,0,0,0) \n""\n"" PopRenderTarget()\n""\n"" \n""\n"" rClear(0,0,0,0)\n""\n"" PopRenderTarget()\n""\n"" \n""\n"" rClear(0,0,0,0) \n""\n"" render.RenderView()\n""\n"" EndDepthPass()\n""\n""\n""\n"" MaterialOverride()\n""\n"" BrushMaterialOverride()\n""\n"" WorldMaterialOverride()\n""\n"" ModelMaterialOverride()\n""\n"" \n""\n"" halo.Render = hRender\n""\n"" bDepthPass = false\n""\n""end\n""\n""\n""local rClearDepth = render.ClearDepth\n""\n""\n""function shaderlib.__INIT()\n""\n"" halo = halo\n""\n"" hRender = halo.Render\n""\n"" hook.Add(\"PreDrawViewModel\", \"EGSM_ImTooLazy\", rClearDepth)\n""\n"" hook.Add( \"PreDrawEffects\", \"EGSM_ImTooLazy\", PreDrawEffectsHK)\n""\n""end\n""\n""\n";
const char depthpass_lua[] = "\n""local depthWriteMat = CreateMaterial( \"egsm/depthmat\", \"DepthWrite\", {\n""\n"" [\"$no_fullbright\"] = \"1\",\n""\n"" [\"$color_depth\"] = \"1\",\n""\n"" [\"$alpha_test\"] = \"0\",\n""\n""} )\n""\n""\n""local bDepthPass = false\n""\n""local halo = {}\n""\n""local render = render\n""\n""\n""MaterialOverride = MaterialOverride or render.MaterialOverride\n""\n""BrushMaterialOverride = BrushMaterialOverride or render.BrushMaterialOverride \n""\n""WorldMaterialOverride = WorldMaterialOverride or render.WorldMaterialOverride \n""\n""ModelMaterialOverride = ModelMaterialOverride or render.ModelMaterialOverride \n""\n""\n""local MaterialOverride = MaterialOverride\n""\n""local BrushMaterialOverride = BrushMaterialOverride\n""\n""local WorldMaterialOverride = WorldMaterialOverride\n""\n""local ModelMaterialOverride = ModelMaterialOverride\n""\n""\n""function render.MaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" MaterialOverride(m)\n""\n""end\n""\n""\n""function render.BrushMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" BrushMaterialOverride(m)\n""\n""end\n""\n""\n""function render.WorldMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" WorldMaterialOverride(m)\n""\n""end\n""\n""function render.ModelMaterialOverride(m)\n""\n"" if bDepthPass then return end\n""\n"" ModelMaterialOverride(m)\n""\n""end\n""\n""\n""local function dummyFn() end\n""\n""\n""local PushRenderTarget = render.PushRenderTarget\n""\n""local PopRenderTarget = render.PopRenderTarget\n""\n""local rClear = render.Clear\n""\n""local depthRT = render.GetResolvedFullFrameDepth()\n""\n""local hRender = dummyFn\n""\n""local BeginDepthPass = shaderlib.BeginDepthPass\n""\n""local EndDepthPass = shaderlib.EndDepthPass\n""\n""\n""local function PreDrawEffectsHK() \n""\n"" if bDepthPass then return end\n""\n"" bDepthPass = true\n""\n"" halo.Render = dummyFn\n""\n"" \n""\n"" MaterialOverride( depthWriteMat )\n""\n"" BrushMaterialOverride( depthWriteMat )\n""\n"" WorldMaterialOverride( depthWriteMat )\n""\n"" ModelMaterialOverride( depthWriteMat )\n""\n"" \n""\n"" BeginDepthPass()\n""\n"" rClear(0,0,0,0) \n""\n"" PopRenderTarget()\n""\n"" \n""\n"" rClear(0,0,0,0)\n""\n"" PopRenderTarget()\n""\n"" \n""\n"" rClear(0,0,0,0) \n""\n"" render.RenderView()\n""\n"" EndDepthPass()\n""\n""\n""\n"" MaterialOverride()\n""\n"" BrushMaterialOverride()\n""\n"" WorldMaterialOverride()\n""\n"" ModelMaterialOverride()\n""\n"" \n""\n"" halo.Render = hRender\n""\n"" bDepthPass = false\n""\n""end\n""\n""\n""local rClearDepth = render.ClearDepth\n""\n""\n""\n""\n""function shaderlib.__INIT()\n""\n"" halo = halo\n""\n"" hRender = halo.Render\n""\n""\n"" hook.Add(\"PreDrawViewModel\", \"!!!EGSM_ImTooLazy\", function() if bDepthPass then rClearDepth() end end)\n""\n"" hook.Add( \"RenderScene\", \"!!!EGSM_ImTooLazy\", PreDrawEffectsHK)\n""\n""end\n""\n""\n";
6 changes: 5 additions & 1 deletion source/shaderlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <defs.h>
#include <utlhash.h>

extern IMaterialSystemHardwareConfig* g_pHardwareConfig;

namespace ShaderLib
{
static CShaderManager* g_pShaderManager = NULL;
Expand Down Expand Up @@ -253,7 +255,9 @@ namespace ShaderLib
}
else if (bind->Type == bind->Cubemap)
{
LoadCubeMap(bind->ParamIndex, TEXTUREFLAGS_ALL_MIPS);
int envMapFlags = g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE ? TEXTUREFLAGS_SRGB : 0;
envMapFlags |= TEXTUREFLAGS_ALL_MIPS;
LoadCubeMap(bind->ParamIndex, envMapFlags);
}
else
{
Expand Down

0 comments on commit 5d509ce

Please sign in to comment.