Log inGet started
Package

ecs.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

ecs.Camera

Spec for the Camera component, which maps to the native Camera. Makes an entity a render viewpoint, with a configurable projection, render priority, layer selection, and an optional offscreen render target.

Fields

  • enabled — whether the camera renders.
  • fov, near, far — perspective projection parameters. fov is the angle in degrees across the side of the frame fovAxis names.
  • fovAxis — "shorter" (default: vertical in a landscape frame, horizontal in a portrait one), "vertical" or "horizontal".
  • priority — orders multiple cameras.
  • textureHandle — a renderer.texture.create({ width, height }) handle the camera renders into; absent means the main viewport.
  • layerIncludeMask — render-layer include bitmask; a layer draws into this camera only when its bit is set. The Camera component resolves its renderLayers name spec (e.g. "all !ui") down to this raw mask.
  • debugChannel — debug visualization channel.

Methods

  • scheduleRender(output, priority, fov, near, far, projection?) — schedule a single render of this camera into output (the "viewport" target or a named offscreen handle) for the current frame, at the given priority and projection. projection is { projection, orthoHeight, fovAxis }.
entity(id).component.add("Camera", { fov = 60, near = 0.1, far = 1000 })
entity(id).component.Camera:scheduleRender("viewport", 0, 60, 0.1, 1000)