Advertisement
szymski

Untitled

Apr 15th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. --[[
  2. SLib - Szymekk's Library
  3.  
  4. A library that does everything for me (Don't repeat yourself).
  5.  
  6. blur.luaa
  7. 17.01.2016 21:39:04
  8. Compiled using LuaAdvanced
  9. This file should not be modified.
  10.  
  11. Copyright © 2016 Szymon (Szymekk) Jankowski
  12. All Rights Reserved
  13. Steam: https://steamcommunity.com/id/szymski
  14. ]]
  15.  
  16. local blurMaterial = Material("pp/blurscreen")
  17. function SLib.Gui.DrawBlurFullscreen(layers, density, alpha)
  18. surface.SetDrawColor(255, 255, 255, alpha)
  19. surface.SetMaterial(blurMaterial)
  20.  
  21. local i = 1
  22. while i <= layers do
  23. blurMaterial:SetFloat("$blur", (i / layers) * density)
  24. blurMaterial:Recompute()
  25. render.UpdateScreenEffectTexture()
  26. surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
  27.  
  28.  
  29. i = i + 1
  30. end
  31.  
  32.  
  33. end
  34. function SLib.Gui.DrawBlurRect(x, y, w, h, layers, density, alpha)
  35. cam.Start2D()
  36. render.SetScissorRect(x, y, x + w, y + h, true)
  37. SLib.Gui.DrawBlurFullscreen(layers, density, alpha)
  38. render.SetScissorRect(0, 0, 0, 0, false)
  39. cam.End2D()
  40.  
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement