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¶
The engine members |
API¶
- class simvx.graphics.engine_surface.EngineSurface[source]¶
Bases:
typing.ProtocolThe 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 VulkanEngine) or a plain attribute (the webEngineStub) –SceneAdapteronly ever reads them.- property content_scale: tuple[float, float][source]¶
HiDPI content scale;
(1.0, 1.0)when unscaled. Unpacked assx, sy.
- property extent: tuple[int, int] | None[source]¶
Swapchain/render-target extent, or
Nonebefore init.
- 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)¶