Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local entblur = {}
- local render = render
- local cam = cam
- local matColor = Material("model_color")
- local mat_Copy = Material("pp/copy")
- local mat_Add = Material("pp/add")
- local mat_Sub = Material("pp/sub")
- local rt_Stencil = GetRenderTarget("ent_blur_stencil" .. os.clock(), ScrW(), ScrH(), true)
- local rt_Store = GetRenderTarget("ent_blur_store" .. os.clock(), ScrW(), ScrH(), true)
- local List = {}
- function entblur.Add(ents, color, blurx, blury, passes, add, ignorez, amount, spherical, shape)
- if add == nil then add = true end
- if ignorez == nil then ignorez = false end
- local t =
- {
- Ents = ents,
- Color = color or Color(255, 255, 255),
- Hidden = when_hidden,
- BlurX = blurx or 2,
- BlurY = blury or 2,
- DrawPasses = passes or 1,
- Additive = add,
- IgnoreZ = ignorez,
- Amount = amount or 1,
- SphericalSize = spherical or 1,
- Shape = shape or 1,
- }
- table.insert(List, t)
- end
- function entblur.Render(entry)
- -- get the current screen texture
- local rt = render.GetRenderTarget()
- -- copy the current screen texture to rt_Store
- render.CopyRenderTargetToTexture(rt_Store)
- -- clear the whole screen
- render.Clear(0, 0, 0, 255, false, true)
- -- draw the entities
- render.SetColorModulation(1,1,1)
- render.SetBlend(1)
- cam.Start3D(EyePos(), EyeAngles())
- entry.Ents:DrawModel()
- cam.End3D()
- -- draw the just the modified texture
- DrawBloom(0, 1, 1, 0, 10, -10, 1, 1, 1 )
- --DrawSobel(0.001)
- --DrawSunbeams(0, 1,1, 0,0)
- --[[local tbl = {}
- tbl[ "$pp_colour_addr" ] = 0
- tbl[ "$pp_colour_addg" ] = 0
- tbl[ "$pp_colour_addb" ] = 0
- tbl[ "$pp_colour_brightness" ] = 0
- tbl[ "$pp_colour_contrast" ] = 1
- tbl[ "$pp_colour_colour" ] = math.sin(SysTime()*5) * 10
- tbl[ "$pp_colour_mulr" ] = 0
- tbl[ "$pp_colour_mulg" ] = 0
- tbl[ "$pp_colour_mulb" ] = 0
- DrawColorModify(tbl)]]
- --[[cam.Start2D()
- mat_Add:SetTexture("$basetexture", rt_Stencil)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetMaterial(mat_Add)
- surface.DrawTexturedRect(0,0,ScrW(),ScrH())
- local len = entry.Ents:GetVelocity():Length() * 5
- surface.SetDrawColor(0, 0, 0, -len + 255)
- surface.DrawRect(0, 0, ScrW(), ScrH())
- surface.SetDrawColor(0, 0, 0, 15)
- surface.DrawRect(0, 0, ScrW(), ScrH())
- cam.End2D()]]
- -- copy what was drawn to rt_Stencil
- render.CopyRenderTargetToTexture(rt_Stencil)
- --render.BlurRenderTarget(rt_Stencil, 1, 1, 10)
- -- set the old render target back
- render.SetRenderTarget(rt)
- -- draw the original scene
- mat_Copy:SetTexture("$basetexture", rt_Store)
- render.SetMaterial(mat_Copy)
- render.DrawScreenQuad()
- -- draw the just the modified texture
- mat_Add:SetTexture("$basetexture", rt_Stencil)
- render.SetMaterial(mat_Add)
- render.DrawScreenQuad()
- end
- local ent = noi
- hook.Add("PostDrawEffects", "Renderentblurs", function()
- entblur.Add(ent)
- if (#List == 0) then return end
- for k, v in pairs(List) do
- entblur.Render(v)
- end
- List = {}
- end)
- pac.entblur = entblur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement