GE Lua Documentation

Press F to search!

generateRouteDecals

Definition


-- @/lua/ge/extensions/core/groundMarkers.lua:139

local function generateRouteDecals(startPos)
  profilerPushEvent("Groundmarkers generateRouteDecals")

  if settings.getValue("showNavigationGroundmarkers") and M.decalPoolCount == 0 then
    increaseDecalPool(M.decalDrawingDistance/M.stepDistance + 10)
  end

  local path = M.routePlanner.path
  local totalDist = (startPos - path[1].pos):length() + (path[1].distToTarget or 0)
  M.startingDist = totalDist
  M.startingStep = ceil(totalDist/M.stepDistance)+1

  if settings.getValue("showNavigationGroundmarkers") then
    local nextIdx, cont, first = 1, true, 1
    local i = 1

    while cont do
      if path[i+1] then
        nextIdx, cont, first = generateDecalsForSegment(path[i], path[i+1], nextIdx, first)
        i = i+1
        cont = cont and path[i+1]
      else
        cont = nil
      end
    end
    M.activeDecalCount = nextIdx+1
    for i = max(nextIdx-1,1), M.decalPoolCount do
      M.decalPool[i].color.a = 0
    end
  end

  if settings.getValue("showNavigationArrows") then
    -- Update arrows using the new module
    core_groundMarkerArrows.updateArrows(path, totalDist)
  end

  profilerPopEvent('generateRouteDecals')
end

Callers

@/lua/ge/extensions/core/groundMarkers.lua
  if freeroam_bigMapMode.bigMapActive() or not lastGenerationPos or lastGenerationPos:distance(playerVehPos) > 1 then
    generateRouteDecals(playerVehPos)
    lastGenerationPos = lastGenerationPos or vec3()