Files
wnsrc/lua/weapons/arccw_base/cl_blur.lua
lifestorm c6d9b6f580 Upload
2024-08-05 18:40:29 +03:00

52 lines
1.6 KiB
Lua

--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local dofmat = Material("pp/dof")
function SWEP:BlurWeapon()
if !ArcCW.ConVars["blur"]:GetBool() then return end
local delta = self:GetSightDelta()
if delta >= 1 then return end
local vm = self:GetOwner():GetViewModel()
render.UpdateScreenEffectTexture()
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilCompareFunction(STENCIL_ALWAYS)
render.SetStencilPassOperation(STENCIL_REPLACE)
render.SetStencilFailOperation(STENCIL_KEEP)
render.SetStencilZFailOperation(STENCIL_REPLACE)
render.SetStencilWriteMask(0xFF)
render.SetStencilTestMask(0xFF)
render.SetBlend(1)
render.SetStencilReferenceValue(55)
ArcCW.Overdraw = true
vm:DrawModel()
ArcCW.Overdraw = false
render.SetBlend(0)
render.SetStencilPassOperation(STENCIL_REPLACE)
render.SetStencilCompareFunction(STENCIL_EQUAL)
-- render.SetColorMaterial()
dofmat:SetFloat("bluramount", 0.1 * (1 - delta))
render.SetMaterial(dofmat)
render.DrawScreenQuad()
render.SetStencilEnable(false)
end
function SWEP:BlurNotWeapon()
if !ArcCW.ConVars["blur"]:GetBool() then return end
render.UpdateRefractTexture()
DrawToyTown(3, ScrH())
end
function SWEP:DoToyTown()
if !ArcCW.ConVars["blur_toytown"]:GetBool() then return end
render.UpdateRefractTexture()
DrawToyTown(3, ScrH() * 0.4 * (1 - self:GetSightDelta()))
end