-
Notifications
You must be signed in to change notification settings - Fork 11
/
blur_sex.lua
60 lines (47 loc) · 1.32 KB
/
blur_sex.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- https://github.com/Be1zebub/Small-GLua-Things/blob/master/blur_sex.lua
local boxSize = 24
local blur_box = {}
local function CreateBlurBox(x, y, w, h)
render.CapturePixels()
blur_box = {}
for _x = 1, w, boxSize do
for _y = 1, h, boxSize do
local color = {r = 0, g = 0, b = 0}
local len = 0
for x2 = 0, boxSize, 2 do
for y2 = 0, boxSize, 2 do
local r, g, b = render.ReadPixel(x + _x + x2, y + _y + y2)
color.r = color.r + r
color.g = color.g + g
color.b = color.b + b
len = len + 1
end
end
color.r = color.r / len
color.g = color.g / len
color.b = color.b / len
blur_box[#blur_box + 1] = {
x = x + _x,
y = y + _y,
col = color
}
end
end
end
local everyFrames = 5
local nextRerender = 0
local function MakeIt()
if nextRerender > FrameNumber() then return end
nextRerender = FrameNumber() + everyFrames
local ply = LocalPlayer()
local peXXis = ply:LookupBone("ValveBiped.Bip01_Pelvis")
local peXXis_pos = ply:GetBonePosition(peXXis):ToScreen()
CreateBlurBox(peXXis_pos.x - boxSize * 4, peXXis_pos.y - boxSize * 4, boxSize * 8, boxSize * 8)
end
hook.Add("HUDPaint", "BlurSex", function()
MakeIt()
for i, box in ipairs(blur_box) do
surface.SetDrawColor(box.col.r, box.col.g, box.col.b)
surface.DrawRect(box.x, box.y, boxSize, boxSize)
end
end)