lovr.graphics.skybox

Render a skybox from a texture. Two common kinds of skybox textures are supported: A rectangular texture with an equirectangular projection can be used, or a "cubemap" texture created from 6 images.

lovr.graphics.skybox(texture, angle, ax, ay, az)

Arguments

NameTypeDefaultDescription
textureTextureThe texture to use.
anglenumber0How much to rotate the skybox around its axis of rotation.
axnumber0The x coordinate of the axis of rotation.
aynumber1The y coordinate of the axis of rotation.
aznumber0The z coordinate of the axis of rotation.

Returns

Nothing


lovr.graphics.skybox(canvas, angle, ax, ay, az)

Arguments

NameTypeDefaultDescription
canvasCanvasThe canvas to use.
anglenumber0How much to rotate the skybox around its axis of rotation.
axnumber0The x coordinate of the axis of rotation.
aynumber1The y coordinate of the axis of rotation.
aznumber0The z coordinate of the axis of rotation.

Returns

Nothing

Example

function lovr.load()
  skybox = lovr.graphics.newTexture({
    'right.png',
    'left.png',
    'up.png',
    'down.png',
    'back.png',
    'front.png'
  }, { type = 'cube' })

  -- or skybox = lovr.graphics.newTexture('equirectangular.png')
end

function lovr.draw()
  local angle, ax, ay, az = lovr.headset.getOrientation()
  lovr.graphics.skybox(skybox, -angle, ax, ay, az)
end

See also