simvx.graphics.engine_surface

Structural contract for the engine object SceneAdapter drives.

SceneAdapter runs unchanged against both the Vulkan :class:~simvx.graphics.engine.Engine and the browser EngineStub (simvx.web). The two are mirrored by hand with no shared base, so a member added to one and consumed by the adapter but missing on the other surfaces only as a runtime AttributeError – in the browser, where it is hardest to catch (this is exactly how create_text_texture shipped broken on web).

This Protocol declares the subset of the engine that SceneAdapter and the example surface actually consume. Annotating SceneAdapter.__init__(engine: EngineSurface) turns any divergence into a mypy error at the construction site, not a browser crash. Keep it to the consumed surface; do not grow it into a mirror of the whole Engine.

Module Contents

Classes

EngineSurface

The engine members SceneAdapter (and text-on-3D examples) depend on.

API

class simvx.graphics.engine_surface.EngineSurface[source]

Bases: typing.Protocol

The engine members SceneAdapter (and text-on-3D examples) depend on.

Members are declared read-only (@property) so the contract is covariant and satisfied by either a property (the Vulkan Engine) or a plain attribute (the web EngineStub) – SceneAdapter only ever reads them.

property content_scale: tuple[float, float][source]

HiDPI content scale; (1.0, 1.0) when unscaled. Unpacked as sx, sy.

property extent: tuple[int, int] | None[source]

Swapchain/render-target extent, or None before init.

property mesh_registry: Any[source]

Mesh registrar (.register(vertices, indices) -> handle).

property texture_manager: Any[source]

Texture manager (.resolve(...) / pixel cache).

upload_texture_pixels(pixels: Any, width: int, height: int) int[source]

Upload raw RGBA pixels, returning a bindless texture index.

create_text_texture(font: str | None = None, size: int = 32, width: int = 256, height: int = 64) Any[source]

Create a text-on-3D texture object (.text / .colour / .texture_index).

__slots__

()

classmethod __init_subclass__(*args, **kwargs)
classmethod __class_getitem__(item)