Skip to content

Commit

Permalink
Add render.setBlend to modify alpha blending for model draw calls (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnejm authored Jan 3, 2024
1 parent b129072 commit 26bbe6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/starfall/libs_cl/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ function instance:cleanupRender()
render.SetLightingMode(0)
render.ResetModelLighting(1, 1, 1)
render.DepthRange(0, 1)
render.SetBlend(1)
render.SuppressEngineLighting(false)
render.SetWriteDepthToDestAlpha(true)
render.SetViewPort(0, 0, renderdata.oldW, renderdata.oldH)
Expand Down Expand Up @@ -1774,6 +1775,13 @@ function render_library.overrideBlend(on, srcBlend, destBlend, blendFunc, srcBle
end
end

--- Changes alpha blending for the upcoming model drawing operations
-- @param alpha number Blending in the range 0 to 1
function render_library.setBlend(alpha)
if not renderdata.isRendering then SF.Throw("Not in a rendering hook.", 2) end
render.SetBlend(alpha)
end

--- Resets the depth buffer
function render_library.clearDepth()
if not renderdata.isRendering then SF.Throw("Not in a rendering hook.", 2) end
Expand Down

0 comments on commit 26bbe6d

Please sign in to comment.