luaPreRender
Definition
-- @/lua/ge/main.lua:507
-- this function is called right before the rendering, and after running the physics
function luaPreRender(dtReal, dtSim, dtRaw)
if geluaProfiler then geluaProfiler:start() end
map.updateGFX(dtReal, dtSim)
if geluaProfiler then geluaProfiler:add("luaPreRender map update") end
extensions.hook('onPreRender', dtReal, dtSim, dtRaw)
if geluaProfiler then geluaProfiler:add("luaPreRender extensions") end
extensions.hook('onDrawDebug', Lua.lastDebugFocusPos, dtReal, dtSim, dtRaw)
if geluaProfiler then geluaProfiler:add("luaPreRender drawdebug") end
-- detect if we need to switch the UI around
if worldReadyState == 1 then
-- log('I', 'gamestate', 'Checking if vehicle is done rendering material') -- this is far too verbose and seriously slows down the debugging
luaPreRenderMaterialCheckDuration = luaPreRenderMaterialCheckDuration + dtRaw
local playerVehicle = getPlayerVehicle(0) or nil
local allReady = (not playerVehicle) or (playerVehicle and playerVehicle:isRenderMaterialsReady())
if allReady or luaPreRenderMaterialCheckDuration > 5 then
log('D', 'gamestate', 'Checking material finished loading')
core_gamestate.requestExitLoadingScreen('worldReadyState')
-- switch the UI to play mode
--guihooks.trigger('ChangeState', 'menu', {'loading', 'backgroundImage.mainmenu'})
worldReadyState = 2
luaPreRenderMaterialCheckDuration = 0
extensions.hook('onWorldReadyState', worldReadyState)
-- render 100 frames before creating the report
if simpleProfilerStop and doStartupProfiling and Engine.Render.getFrameId() > 100 and not _levelLoadingReportGenerated then
extensions.utils_simpleProfiler_report.createReport('level_loading', 'Level loading', {durationFilterSec = 0.001})
simpleProfilerStop()
rawset(_G, '_levelLoadingReportGenerated', true)
end
end
end
if geluaProfiler then geluaProfiler:add("luaPreRender ending") end
end
Callers
@/lua/ge/main.lua
function requestGeluaProfile()
geluaProfiler = LuaProfiler("update() and luaPreRender() gelua function calls")
extensions.setProfiler(geluaProfiler)