#camera #virtual #abstraction #little #position #system

little-camera

little engine virtual camera abstraction

1 unstable release

0.1.0 Mar 3, 2024

#36 in Rendering engine

30 downloads per month

GPL-3.0-or-later

13KB
232 lines

Little engine camera abstraction

Introduces a new position type: WorldPosition, which contains coordinates in f64 values. This allows little-bevy to model vast spaces, up to an entire solar system at millimetre precision.

How to use

The main product of little-camera is the VirtualCameraBundle, which defines a virtual camera in space, with additional settings (zoom, apeture size, exposure time, and ISO). A VirtualCamera can be marked as Active, which switches the rendered camera to that location and settings.

little-camera exposes a utility function init_base_camera(), which spawns a correctly tagged 2D camera. Alternatively, you can spawn your own camera, as long as it is tagged with the LittleCamera component.

The translate module is vital for translating different posititional systems to one-another.

  • Points from cursor positions and screen locations can be translated into render coordinates for indicator rendering, and world coordinates, for collision detection.

  • Points in world space can be translated into render coordinates, to place them at the correct location for the base camera.

Future ideas

  • Integrated camera-sharing capabilities, allowing players or different sessions to share camera views. Having a template to express camera locations and setting also allows for scripted camera transitions and cutscenes.

  • WorldPositionStack, which allows a range of possible WorldPositions, become the new base scalar value for another layer of WorldPosition. This way vast quantities of space can be modelled.

Dependencies

~46–84MB
~1.5M SLoC