TextureObject
Generated from engine/render/texture_object.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
Audience: game code.
#include "engine/render/texture_object.h" · namespace labrador
class TextureObject
Section titled “class TextureObject”One still frame out of a sprite sheet.
The frame name is resolved against the sheet once, at construction, and what is kept is a handle: an index into that sheet's frame table. Drawing is then two indexed loads - the sheet out of its registry slot, the frame out of the sheet - with no string touched on the way.
NO CAMERA PARAMETER. The list holds the camera (renderer.h, DrawList::set_camera), so a caller wanting screen space sets nothing and a caller wanting a player's view sets it once for the range rather than passing it down through every signature.
A FRAME CAN ALSO ARRIVE RESOLVED, as a RenderResources::SheetFrame: the sheet and the frame as one value, resolved at load so that per-frame code re-points the object without a string-keyed lookup (PHILOSOPHY T7, T8). A pair is meaningful only against the RenderResources this object was built on.
TextureObject
Section titled “TextureObject”Resolves nothing and holds no resource table.
TextureObject
Section titled “TextureObject” const std::string& frame_name, float rotation = 0.0f, float layer_depth = 0.0f);render_resources is borrowed and must outlive this drawable. Frame resolution and later draws read that same table, never a copy of it.
TextureObject
Section titled “TextureObject” float rotation = 0.0f, float layer_depth = 0.0f);The same, from a pair resolved at load. Throws std::out_of_range if the pair is unresolved. The same borrowed-table lifetime applies.
frame (protected)
Section titled “frame (protected)”set_frame (protected)
Section titled “set_frame (protected)”void set_frame(const std::string& sheet_name, const std::string& frame_name);void set_frame(const std::string& frame_name);Every setter moves sheet and frame together, because a frame handle taken from one sheet indexes nothing meaningful in another. There is deliberately no way to change the sheet on its own.
The pair form resolves nothing and is the one for per-frame code. It throws std::out_of_range, at the call rather than at the next draw, if the pair is unresolved or names a slot this object's table does not have. The name forms resolve first and assign after, so a name that does not resolve throws and leaves the object as it was.
draw (protected)
Section titled “draw (protected)”virtual void draw(DrawList& draw_list,draw_with (protected)
Section titled “draw_with (protected)” float rotation) const;Draws reading only one per-draw member, layer_depth, which orders nothing on any backend - so callers can compute frame / colour / origin / flip / rotation into locals instead of assigning them to this object first.
A SCENE RUNS draw() ON THE SAME OBJECT FROM EVERY RENDER WORKER AT ONCE, so "set members, then draw" is an unsynchronised data race - and with a std::string element it is concurrent free/allocate on one control block, i.e. heap corruption. The frame is a handle, so passing it costs a register rather than a string copy. The fan-out this describes is engine/scene/scene.cpp's and is pinned by tests/scene/fanout_tests.cpp.
Related types
Section titled “Related types”Named in the public declarations above: Colour, DrawList, RectangleF, RenderResources, SheetFrame, SpriteFlip, SpriteSheet, SpriteSheetObject, 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/null_resource_tests.cpp,sprite_sheet_object_tests.cpp
Explained in
Section titled “Explained in”Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.