simvx.graphics.renderer.water_pack

Shared water-surface wire packing (design D16, RM-E1/E1w).

Dependency-free (numpy + core math only, no Vulkan) so BOTH the desktop water pass (water_pass.py) and the browser exporter (simvx.web runtime, which runs under Pyodide where vulkan is unavailable) pack a WaterSurface3D into the identical std430 record. One canonical layout, mirrored by the WaterSurface struct in water.vert / water.frag (desktop) and water3d.wgsl (web).

Module Contents

Functions

pack_water_surface

Pack one surface (row-major model + a WaterMaterial) into a record.

build_water_records

Pack a list of WaterSurface3D nodes into a contiguous record array.

Data

API

simvx.graphics.renderer.water_pack.__all__

[‘WATER_SURFACE_DTYPE’, ‘WATER_SURFACE_STRIDE’, ‘build_water_records’, ‘pack_water_surface’]

simvx.graphics.renderer.water_pack.WATER_SURFACE_DTYPE

‘dtype(…)’

simvx.graphics.renderer.water_pack.WATER_SURFACE_STRIDE

None

simvx.graphics.renderer.water_pack.pack_water_surface(model: numpy.ndarray, mat: Any, subdivisions: int, size: tuple[float, float], reflection_tex: int = -1) numpy.ndarray[source]

Pack one surface (row-major model + a WaterMaterial) into a record.

model is transposed to column-major for the shader std430 mat4. reflection_tex is the bindless index of a :class:PlanarReflection3D capture feeding a true planar mirror (RM-E2), or -1 for none (the shader then keeps the cubemap/sky reflection, byte-identical to RM-E1 water).

simvx.graphics.renderer.water_pack.build_water_records(surfaces: list[Any]) tuple[numpy.ndarray, int][source]

Pack a list of WaterSurface3D nodes into a contiguous record array.

Used by the web exporter (the desktop pass packs per-frame from its own submission tuples via :func:pack_water_surface). Reads each node’s world transform live, so a moving surface repacks correctly every frame. Returns (records, count); records is empty when surfaces is empty.