Code |
local pos = Vector(0, 0, 0)
local ang = Angle(0, 270, 90)
local width = 1024
local height = 768
local scale = 0.125
local url = "http://google.com"
if g_3DHTML and g_3DHTML:IsValid() then g_3DHTML:Remove() end
local browser = vgui.Create("HTML")
g_3DHTML = browser
browser:SetPaintedManually(true)
browser:SetSize(width, height)
browser:SetMouseInputEnabled(false)
browser:OpenURL(url)
local function DrawSign()
-- Draw a background
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawRect(0, 0, width, height)
-- Draw the screen
render.SetMaterial(browser:GetHTMLMaterial())
render.DrawQuad(Vector(0, 0, 0),
Vector(width, 0, 0),
Vector(width, height, 0),
Vector(0, height, 0))
end
hook.Add("RenderScreenspaceEffects", "3DHTMLSign", function()
cam.Start3D(EyePos(), EyeAngles())
cam.Start3D2D(pos, ang, scale)
local status, err = pcall(DrawSign)
cam.End3D2D()
if not status then Error(err) end
end)
|