Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add render.getViewSetup #1854

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lua/starfall/libs_cl/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,24 @@ function render_library.getScreenInfo(e)
return instance.Sanitize(screen.ScreenInfo)
end

--- Returns information about the current view setup.
-- This does a table copy, so avoid using this in a draw hook for performance sake
-- @param boolean? noPlayer If true, returns the view->GetViewSetup, if false - returns view->GetPlayerViewSetup. False by default.
thegrb93 marked this conversation as resolved.
Show resolved Hide resolved
-- @return table A table describing the current view setup. See https://wiki.facepunch.com/gmod/Structures/ViewSetup for more information.
function render_library.getViewSetup(noPlayer)
return instance.Sanitize(render.GetViewSetup(noPlayer))
marchc1 marked this conversation as resolved.
Show resolved Hide resolved
end

--- Returns only the origin and angles from getViewSetup.
-- @param boolean? noPlayer If true, returns the view->GetViewSetup, if false - returns view->GetPlayerViewSetup. False by default.
-- @return Vector setup.origin
-- @return Angle setup.angles
function render_library.getViewPosAndAngles(noPlayer)
local setup = render.GetViewSetup(noPlayer)

return vwrap(setup.origin), awrap(setup.angles)
end

marchc1 marked this conversation as resolved.
Show resolved Hide resolved
--- Returns the entity currently being rendered to
-- @return Entity Entity of the screen or hud being rendered
function render_library.getScreenEntity()
Expand Down
Loading