four.Renderer

.new (def)

-- Module definition

local ffi = require 'ffi' local lib = { type = 'four.Renderer' } lib.__index = lib four.Renderer = lib setmetatable(lib, { __call = function(lib, ...) return lib.new(...) end })

local V2 = four.V2 local V4 = four.V4 local Buffer = four.Buffer local Geometry = four.Geometry

-- h2. Renderer backends

lib.GL32 = 1 lib.GLES = 2 lib.DEFAULT = lib.GL32

-- h2. Constructor

--[[-- @Renderer(def)@ is a new renderer. @def@ keys:

  • @backend@, the renderer backend (defaults to @GL32@).
  • @size@, a @V2@ defining the viewport size (defaults to V2(480,270).
  • @error_line_pattern@, a string used to parse GPU compiler logs. Must split a line in three part, before the GLSL file number, the file number, after the file number.

:set (def)

TODO MISSING DOCUMENTATION

:_setBackend ()

TODO MISSING DOCUMENTATION

:_init ()

TODO MISSING DOCUMENTATION

:info ()

TODO MISSING DOCUMENTATION

TODO MISSING DOCUMENTATION

:caps ()

TODO MISSING DOCUMENTATION

:limits ()

TODO MISSING DOCUMENTATION

:stats ()

TODO MISSING DOCUMENTATION

.statsTable ()

:resetStats ()

TODO MISSING DOCUMENTATION

TODO MISSING DOCUMENTATION

:beginStats (now)

:endStats ()

TODO MISSING DOCUMENTATION

:addGeometryStats (g)

TODO MISSING DOCUMENTATION

TODO this doesn't work once data was uploaded on the GPU.

:log (msg)

@self:log(msg)@ is called by the backend renderer to log message @msg@. Clients can override the function to redirect the renderer log (the default implementation @print@s the message).

TODO MISSING DOCUMENTATION

:logInfo (verbose)

:logStats ()

TODO MISSING DOCUMENTATION

:normalizeScreenPos (pos, noflip)

@r:normalizeScreenPos(pos [,noflip])@ is the normalized position of @pos@ expressed relative to the top left (bottom left if @noflip@ is true) corner of the rendering surface.

:isRenderable (cam, o)

@renderable(cam, o)@ is @true@ if @o@ can be rendered with @cam@.

:addRenderable (cam, o)

TODO MISSING DOCUMENTATION

:render (cam, objs)

@render(cam, objs)@ renders the renderables in @objs@ with @cam@.

TODO

#setTODO MISSING DOCUMENTATION

#_setBackendTODO MISSING DOCUMENTATION

#_initTODO MISSING DOCUMENTATION

#infoTODO MISSING DOCUMENTATION

#infoTODO MISSING DOCUMENTATION

#capsTODO MISSING DOCUMENTATION

#limitsTODO MISSING DOCUMENTATION

#statsTODO MISSING DOCUMENTATION

#resetStatsTODO MISSING DOCUMENTATION

#resetStatsTODO MISSING DOCUMENTATION

#endStatsTODO MISSING DOCUMENTATION

#addGeometryStatsTODO MISSING DOCUMENTATION

#addGeometryStatsTODO this doesn't work once data was uploaded on the GPU.

#logTODO MISSING DOCUMENTATION

#logStatsTODO MISSING DOCUMENTATION

#addRenderableTODO MISSING DOCUMENTATION