CameraTools
Generated from engine/render/camera_tools.h at 862e08b. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
#include "engine/render/camera_tools.h" · namespace labrador
class CameraTools
Section titled “class CameraTools”calculate_camera
Section titled “calculate_camera” const mattmath::Vector2F& viewport_size, const Camera& prev_camera,viewport_size is in WORLD units, not pixels, and that distinction is the whole contract. Every line of the body adds it to prev_camera.translation, which is a world position, and compares the result against camera_bounds, which is a world rectangle. The function never reads prev_camera.scale and must not: the scale is already spent by the time the size gets here.
So a caller with a zoomed camera passes camera.visible_rectangle(viewport).size(), not viewport.size(). Passing pixels is correct only at scale 1, silently and everywhere - the borders, the edges and the bounds test all drift together, so the camera simply chases wrong without ever looking broken.
calculate_camera_scroll_border
Section titled “calculate_camera_scroll_border”The dead zone the player moves inside before the camera follows, for a viewport this size. Public because it is the whole of the camera model that can be checked without simulating one, and it carries an invariant worth checking directly: opposing borders never sum past the viewport, or calculate_camera()'s near edge ends up beyond its far edge.
Related types
Section titled “Related types”Named in the public declarations above: BorderThickness, Camera, RectangleF, Vector2F.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
tests/render/camera_tools_tests.cpp
Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.