onPreRender
Definition
-- @/lua/ge/extensions/core/groundMarkerArrows.lua:244
local function onPreRender(dt)
-- Update all arrow objects based on their proxies
for id, proxy in pairs(arrowProxies) do
if proxy.state == "unused" then
goto continue
end
local arrow = scenetree.findObjectById(id)
if arrow then
actualPos:set(proxy.pos.x, proxy.pos.y, proxy.pos.z)
fwd:setRotate(proxy.rot, yVec)
local nudgeForwardValue = proxy.nudgeForwardSmoother:get(proxy.nudgeForwardSmootherTarget, dt) -- Fade in over 0.5 seconds
actualPos:setAdd(push3(fwd) * (nudgeForwardValue - 0.75))
local alphaValue = proxy.alphaSmoother:get(proxy.alphaSmootherTarget, dt)
if proxy.state == "visible" then
-- Update nudgeForwardSmoother to fade in
arrow.hidden = false
elseif proxy.state == "fadeout" then
if alphaValue <= 0 then
-- Transition complete, set to unused
proxy.state = "unused"
arrow.hidden = true
end
end
-- Update scale based on distance
local scaleVal = proxy.nearFarScaleSmoother:get(proxy.nearFarScaleSmootherTarget, dt) * alphaValue
scale:set(scaleVal, scaleVal, scaleVal)
arrow:setScale(scale)
arrow:setPosRot(actualPos.x, actualPos.y, actualPos.z, proxy.rot.x, proxy.rot.y, proxy.rot.z, proxy.rot.w)
arrow:updateInstanceRenderData()
--simpleDebugText3d(string.format("Arrow %s: state=%s", id, proxy.state), proxy.pos)
else
log('W', 'arrow', 'Arrow object not found for id: ' .. tostring(id))
end
::continue::
end
--[[
for wpId, wpLog in pairs(lastWpLog) do
simpleDebugText3d(string.format("Wp %s: nodeToNodeAngle=%0.3f, %s, %s, links: %d, %0.1f", wpId, wpLog.nodeToNodeAngle or -1, wpLog.routeHasSmallestAngle and "smallest Angle" or "", wpLog.wp, wpLog.linkCount or -1, wpLog.distToVehicle or -1), wpLog.pos)
end
local im = ui_imgui
-- Draw ImGui debug window
if im.Begin("Arrow Debug") then
im.Text("Arrow Pool Status")
im.Separator()
-- Show active arrows
im.Text("Active Arrows:")
if im.BeginTable("activeArrows", 6, tableFlags) then
im.TableNextColumn()
im.Text("ID")
im.TableNextColumn()
im.Text("State")
im.TableNextColumn()
im.Text("WP")
im.TableNextColumn()
im.Text("Position")
im.TableNextColumn()
im.Text("Scale")
im.TableNextColumn()
im.Text("Actions")
for id, proxy in pairs(arrowProxies) do
if proxy.state ~= "unused" then
im.TableNextColumn()
im.Text(tostring(id))
im.TableNextColumn()
im.Text(proxy.state)
im.TableNextColumn()
im.Text(tostring(proxy.wp or "none"))
im.TableNextColumn()
im.Text(string.format("%.1f, %.1f, %.1f", proxy.pos.x, proxy.pos.y, proxy.pos.z))
im.TableNextColumn()
local scale = proxy.nearFarScaleSmoother:get(proxy.nearFarScaleSmootherTarget, 0)
im.Text(string.format("%.2f", scale))
im.TableNextColumn()
if im.Button("Hide##"..id) then
proxy.state = "fadeout"
proxy.alphaSmootherTarget = -0.2
arrowToWp[id] = nil
wpToArrowId[proxy.wp] = nil
end
end
end
im.EndTable()
end
-- Show unused arrows
im.Separator()
im.Text("Unused Arrows:")
if im.BeginTable("unusedArrows", 2, tableFlags) then
im.TableNextColumn()
im.Text("ID")
im.TableNextColumn()
im.Text("Actions")
for id, proxy in pairs(arrowProxies) do
if proxy.state == "unused" then
im.TableNextColumn()
im.Text(tostring(id))
im.TableNextColumn()
if im.Button("Delete##"..id) then
local arrow = scenetree.findObjectById(id)
if arrow then arrow:delete() end
arrowProxies[id] = nil
end
end
end
im.EndTable()
end
-- Show waypoint mappings
im.Separator()
im.Text("Waypoint Mappings:")
if im.BeginTable("wpMappings", 3, tableFlags) then
im.TableNextColumn()
im.Text("Waypoint ID")
im.TableNextColumn()
im.Text("Arrow ID")
im.TableNextColumn()
im.Text("Status")
-- Show wpToArrowId mappings
for wp, arrowId in pairs(wpToArrowId) do
im.TableNextColumn()
im.Text(tostring(wp))
im.TableNextColumn()
im.Text(tostring(arrowId))
im.TableNextColumn()
local proxy = arrowProxies[arrowId]
if proxy then
im.Text(string.format("%s (Scale: %.2f)", proxy.state, proxy.nearFarScaleSmoother:get(proxy.nearFarScaleSmootherTarget, 0)))
else
im.TextColored(im.ImVec4(1,0,0,1), "Missing Proxy!")
end
end
im.EndTable()
end
-- Show path information
im.Separator()
im.Text("Path Information:")
if im.BeginTable("pathInfo", 4, tableFlags) then
im.TableNextColumn()
im.Text("Index")
im.TableNextColumn()
im.Text("WP")
im.TableNextColumn()
im.Text("Distance")
im.TableNextColumn()
im.Text("Angle")
for i, wpLog in ipairs(lastWpLog) do
im.TableNextColumn()
im.Text(tostring(i))
im.TableNextColumn()
im.Text(tostring(wpLog.wp or "none"))
im.TableNextColumn()
im.Text(string.format("%.1f", wpLog.distToVehicle or -1))
im.TableNextColumn()
im.Text(string.format("%.1f°", wpLog.nodeToNodeAngle or -1))
end
im.EndTable()
end
im.End()
end
]]
end
Callers
@/gameplay/missionTypes/collection/customNodes/collectionMarkersNode.lua
function C:onPreRender(dt)
local cameraPos = core_camera.getPosition()
@/lua/ge/extensions/gameplay/crawl/debug.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not enableDebugWindow then return end
@/lua/ge/extensions/core/vehicleMirrors.lua
local function onPreRender(dtReal, dtSim, dtRaw)
local veh = getPlayerVehicle(0)
@/lua/ge/extensions/scenario/demolitionDerby.lua
-- called before rendering a graphics frame
local function onPreRender(dt)
local scenario = scenario_scenarios.getScenario()
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not editor.beginWindow or not detailViewerActive then return end -- for some frames, the editor is not ready yet
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
local function onPreRender(dt, dtSim)
if markers then
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceMarkers.lua
function C:onPreRender(dt, dtSim)
if self.markers then
@/lua/ge/extensions/gameplay/statisticModules/watchRollover.lua
local function onPreRender()
if myvid == -1 then return end
@/gameplay/missionTypes/scatterPickup/customNodes/scatterAnimatorNode.lua
function C:onPreRender(dt, dtSim)
if not self.mgr.scatterPickup then return end
@/lua/ge/ge_utils.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if(fpsLimiter:update(dtReal)) then
@/lua/ge/extensions/gameplay/crawl/utils.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not crawlStates then
@/lua/ge/extensions/util/precompileShaders.lua
local function onPreRender(dt)
if finished then return end
@/lua/ge/extensions/util/trackBuilder/cameraTransition.lua
local perc = 0
local function onPreRender(dt)
if remainingTime <= 0 then return end
@/lua/common/extensions/networking/editorToolchain.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not server then return end
@/lua/ge/extensions/util/screenshotCreator.lua
local function onPreRender(dt)
if workerCoroutine ~= nil then
@/lua/ge/extensions/gameplay/traffic.lua
local function onPreRender(dt)
if not M.debugMode then return end
@/lua/ge/extensions/editor/terrainEditor.lua
end
terrainEditor:onPreRender()
local hit
@/lua/ge/extensions/editor/veMain.lua
-- Update data for other vehicle editors to use
local function onPreRender(dtReal, dtSim, dtRaw)
if not vEditor.vehicle then
@/lua/ge/extensions/core/camera.lua
local absTranslateTimer = nil
local function onPreRender(dtReal, dtSim, dtRaw)
if not levelLoaded then return end
@/lua/ge/extensions/flowgraph/nodes/mission/knockAwayCheck.lua
function C:onPreRender(dt, dtSim)
if self.markers then
@/lua/ge/extensions/core/weather.lua
local function onPreRender(dt)
if switch == true then
@/lua/ge/extensions/freeroam/dragRace.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not opponentVehicle then return end
@/lua/ge/extensions/flowgraph/nodes/vehicle/touchingStatic.lua
function C:onPreRender()
if self.active and self.pinIn.debugMode.value then
@/lua/ge/extensions/core/groundMarkers.lua
local playerVehPos = vec3()
local function onPreRender(dt)
if not M.endWP then return end
@/lua/ge/extensions/util/trackBuilder/splineTrack.lua
M.onCollectScreenshotMetadata = onCollectScreenshotMetadata
M.onPreRender = function(dt) transition.onPreRender(dt) end
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veStaticRenderView.lua
-- Do debugDrawer stuff here
local function onPreRender()
for wndID, wndData in ipairs(wndsData) do
@/lua/ge/extensions/campaign/exploration.lua
local function onPreRender(dt)
if not getExplorationActive() then
@/lua/ge/extensions/scenario/scenarios.lua
local function onPreRender(dt, dtSim)
if not scenario then return end
@/lua/ge/extensions/util/precompileVehicles.lua
local function onPreRender(dt)
if finished then return end
@/lua/common/utils/debugDraw.lua
-- GE do calls `onPreRender()`
-- VEH do calls on `onDebugDraw()`
@/lua/ge/extensions/gameplay/statisticModules/watchJturn.lua
local function onPreRender()
if myvid == -1 then return end
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua
local function onPreRender(dt)
if not p_showWindow then
@/lua/ge/extensions/editor/roadEditor.lua
local function onPreRender()
if not editor.editMode or (editor.editMode.displayName ~= editModeName) then
@/lua/ge/extensions/tech/multiscreen.lua
local rotation = QuatF(0, 0, 0, 1)
local function onPreRender()
if not getOrCreateCameraToWindow or not requestCameraToWindowRender then return end
@/lua/ge/extensions/flowgraph/nodes/util/customLua.lua
end
function C:onPreRender(dt, dtSim)
self:exec('onPreRender')
@/lua/ge/extensions/gameplay/markerInteraction.lua
local function onPreRender(dtReal, dtSim)
if not gameplay_playmodeMarkers.isStateWithPlaymodeMarkers() then
@/lua/ge/extensions/flowgraph/nodes/gfx/blur.lua
function C:onPreRender(dt, dtSim)
if not extensions.ui_visibility.getCef() then return end
@/lua/ge/extensions/core/hotlapping.lua
local colorOrange = ColorF(1, 0.5, 0, 0.5)
local function onPreRender(dt, dtSim)
if editMode then
@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua
-- gets called only while career mode is enabled
local function onPreRender(dtReal, dtSim)
if not gameplay_playmodeMarkers.isStateWithPlaymodeMarkers() then
@/lua/ge/extensions/scenario/busdriver.lua
local function onPreRender(dt, dtSim)
--local debugPath = true
@/lua/ge/extensions/ui/gameBlur.lua
local function onPreRender()
if not extensions.ui_visibility.getCef() then return end
@/lua/ge/extensions/scenario/waypoints.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if not scenario_scenarios then return end
@/lua/ge/extensions/editor/shapeEditor.lua
local function onPreRender()
if(shapePrev) then
@/lua/ge/extensions/core/checkpoints.lua
local function onPreRender(dt)
local scenario = scenario_scenarios and scenario_scenarios.getScenario()
@/lua/ge/extensions/core/sounds.lua
local function onPreRender(dtReal, dtSim, dtRaw)
if Engine.Audio.getGlobalParams then
@/lua/ge/extensions/util/decalRoadsEditor.lua
local function onPreRender(dt)
local camPos = core_camera.getPosition()
@/gameplay/missionTypes/cannon/customNodes/MarkersNode.lua
function C:onPreRender()
if self.markers then
@/lua/ge/extensions/util/instancedLineRenderDemo.lua
local function onPreRender(dtReal, dtSim, dtRaw)
t = t + dtSim * 0.5
@/lua/ge/extensions/editor/camPathEditor.lua
local function onPreRender()
if