GE Lua Documentation

Press F to search!

preProcess

Definition


-- @/lua/ge/client/postFx/smaa.lua:62

smaaPostEffectCallbacks.preProcess = function()
  local smaaPostEffect = scenetree.findObject("SMAA_PostEffect")
  if smaaPostEffect then
    local rtSize = smaaPostEffect:getRenderTargetSize()
    local rtResolution = string.format("float4(1.0 / %d, 1.0 / %d, %d, %d)", rtSize.x, rtSize.y, rtSize.x, rtSize.y)
    local currentRTResolution = smaaPostEffect:getField("rtResolution", 0)
    if rtResolution ~= currentRTResolution then
      smaaPostEffect:setField("rtResolution", 0, rtResolution)
      smaaPostEffect:setShaderMacro("SMAA_RT_METRICS", rtResolution)
      local smaaPostEffect1 = scenetree.findObject("SMAA_PostEffect1")
      if smaaPostEffect1 then
        smaaPostEffect1:setShaderMacro("SMAA_RT_METRICS", rtResolution)
      end
      local smaaPostEffect2 = scenetree.findObject("SMAA_PostEffect2")
      if smaaPostEffect2 then
        smaaPostEffect2:setShaderMacro("SMAA_RT_METRICS", rtResolution)
      end
    end
  end
end

Callers

@/lua/ge/client/postFx/smaa.lua

-- log('I','postfx', 'Smaa.lua calling preProcess()....')
smaaPostEffectCallbacks.preProcess()
-- log('I','postfx', 'Smaa.lua calling preProcess()....')
smaaPostEffectCallbacks.preProcess()