Keel separates rendering data from rendering logic. The three rendering components —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/VKSFY/keel/llms.txt
Use this file to discover all available pages before exploring further.
Sprite, MeshRenderer, and TextLabel — carry only the declarative state the renderers need. The actual draw calls are issued by the systems registered in setup_renderer_2d, setup_renderer_3d, and setup_text. You never call draw methods yourself.
Sprite
Sprite makes a 2D entity visible as a textured quad. It pairs with Transform2D on the same entity; the SpriteBatch2D system queries both every frame and issues a single instanced draw call per texture group. The full RGBA tint is multiplied against the sampled texel, so (r=1, g=1, b=1, a=1) is fully opaque white (no tint).
texture_id is the integer returned by atlas.load("path/to/image.png") or setup_assets + registry.load(...). Texture ID 0 is always a 1×1 white pixel baked in by setup_renderer_2d, which makes plain color quads possible without loading any image.
Fields
Index into the active
TextureAtlas. Returned by atlas.load(path). ID 0 is the built-in 1×1 white texture, safe to use for colored quads without loading any file.Red channel of the RGBA tint multiplied against the sampled texture. Range
[0.0, 1.0].Green channel of the RGBA tint. Range
[0.0, 1.0].Blue channel of the RGBA tint. Range
[0.0, 1.0].Alpha channel of the RGBA tint.
1.0 is fully opaque, 0.0 is invisible. The sprite batch renders with alpha blending when a < 1.0.Width of the quad in world units (pixels at default zoom). Multiplied by
Transform2D.scale_x before upload. A negative value mirrors the quad horizontally.Height of the quad in world units. Multiplied by
Transform2D.scale_y. A negative value mirrors the quad vertically.When
True, negates the effective width in the instance buffer, flipping the quad horizontally without changing its UV rectangle. Useful for left/right character facing without separate sprites.When
True, negates the effective height, flipping the quad vertically.The
TextureAtlas supports up to 16 textures (the minimum GL guarantee for fragment shader sampler units). Plan your atlas layout around this limit; a sprite sheet with sub-rectangle UVs is the recommended approach for games with many art assets.MeshRenderer
MeshRenderer makes a 3D entity visible by linking it to a mesh and a material from the MeshRegistry and MaterialRegistry created by setup_renderer_3d. The renderer queries (Transform3D, MeshRenderer) each frame, frustum-culls by bounding sphere, resolves the world matrix through the parent chain, uploads PBR-lite uniforms, and issues one draw call per surviving entity.
Fields
Index into
MeshRegistry, returned by mesh_registry.add(mesh). If the ID is out of range the entity is silently skipped.Index into
MaterialRegistry, returned by material_registry.add(material). ID 0 is always the default mid-gray Material(). Out-of-range IDs fall back to the default.Reserved for future shadow-map support. Currently has no runtime effect; stored in the component for forward compatibility.
Reserved for future shadow-map support. Currently has no runtime effect.
When
False, the entity is skipped entirely by the 3D render system — no frustum cull check, no draw call. Use this to hide entities without despawning them.TextLabel
TextLabel renders a string of text in screen space, anchored to a Transform2D position interpreted as pixels with the origin at the top-left and Y growing downward. Text does not scroll with the camera — it is always UI space. Pair with keel.text.set_text(entity_id, "...") to set the string content.
The actual text string is stored in a module-level side dict (not in the component) because NumPy structured arrays cannot hold variable-length strings. This is a known v0.1 limitation and will be resolved in v0.2.
Fields
Index into the
FontRegistry, returned by font_registry.id_of(font) after loading with load_font. Each (path, size_px) pair is cached as a separate Font with its own GPU texture atlas.Red channel of the text color. The shader multiplies this against the glyph coverage (alpha). Range
[0.0, 1.0].Green channel of the text color. Range
[0.0, 1.0].Blue channel of the text color. Range
[0.0, 1.0].Alpha channel.
1.0 is fully opaque. The text batch always draws with SRC_ALPHA / ONE_MINUS_SRC_ALPHA blending regardless of this value.Uniform scale applied to glyph quads and advances.
2.0 doubles the rendered font size without re-baking the atlas.When
False, this entity is skipped by the text render system. Toggle with keel.set_label_visible(world, entity_id, False) for convenience.