Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.WebSize = 0.195
- hook.Add("PostDrawOpaqueRenderables", this,
- function(self)
- if not self.WebId then return end
- if not IsValid(CHROME) then return end
- local web = CHROME.Web[self.WebId]
- local scale = self.WebSize or 0.1
- local pos = self:GetPos() + self:GetUp() * 2.0
- local angle = self:GetAngles()
- angle:RotateAroundAxis(self:GetUp(), 90)
- cam.Start3D2D(pos, angle, scale)
- local mat = web:GetHTMLMaterial()
- local sw, sh = ScrW(), ScrH()
- local swc, shc = scr.MatSize(mat)
- scr.DrawTexRect(-sw/2, -sh/2, swc, shc, mat)
- cam.End3D2D()
- end)
- this.WebVol = { 1500, 0.8 }
- hook.Add("Think", this,
- function(self)
- if not self.WebId then return end
- if not IsValid(CHROME) then return end
- local web = CHROME.Web[self.WebId]
- local volume = 0
- if self.WebVol then
- local falloff, maximum = unpack(self.WebVol)
- local dist = self:GetPos():Distance(LocalPlayer():GetPos())
- volume = maximum * (1 - math.Clamp(dist / falloff, 0, 1)^2)
- end
- web:CallFunc("Volume", volume)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement