simvx.core.env_sync_spec

Single source of truth for WorldEnvironment → renderer-subsystem field propagation. Both the Vulkan EnvironmentSync and the web WebApp _sync_world_environment walk the same spec; new env fields propagate to both backends by adding one row.

Composites (e.g. camera.exposure × env.tonemap_exposure) and structurally divergent bridges (sky_mode → clear-colour / skybox) stay imperative in the calling sync method: only field-to-attribute propagation lives here.

Module Contents

Classes

EnvField

One row of the WorldEnvironment → renderer mapping.

Functions

apply_spec

Walk ENV_SYNC_SPEC, read each env attr, write via resolve.

Data

API

simvx.core.env_sync_spec.__all__

[‘EnvField’, ‘ENV_SYNC_SPEC’, ‘ENV_SYNC_COMPOSITES’, ‘apply_spec’]

class simvx.core.env_sync_spec.EnvField[source]

One row of the WorldEnvironment → renderer mapping.

env_attr : name of the attribute on WorldEnvironment. target : logical "subsystem.field" path. The backend resolver maps the subsystem to a concrete object (Vulkan Renderer._post_process, web WebRenderer). transform : optional callable applied to the env value before write. Used for enum→int translation, alpha-trim, etc. backends : backends that should propagate this field. Lets the spec reflect today’s reality where some env fields are wired on web but not desktop yet (e.g. ssao_radius).

env_attr: str

None

target: str

None

transform: collections.abc.Callable[[Any], Any] | None

None

backends: tuple[str, ...]

(‘vulkan’, ‘web’)

simvx.core.env_sync_spec.ENV_SYNC_SPEC: tuple[simvx.core.env_sync_spec.EnvField, ...]

()

simvx.core.env_sync_spec.ENV_SYNC_COMPOSITES: frozenset[str]

‘frozenset(…)’

simvx.core.env_sync_spec.apply_spec(env: Any, *, backend: str, resolve: collections.abc.Callable[[str, str, Any], None]) None[source]

Walk ENV_SYNC_SPEC, read each env attr, write via resolve.

resolve(subsystem, attr, value) does the backend-specific dispatch (attribute write, method-kwarg accumulation, etc.). Fields whose backend list excludes the requested backend are skipped.