simvx.graphics.renderer.ocean_pack¶
Shared ocean-surface wire packing (design D11, RM-E7).
Dependency-free (numpy + core math only, no Vulkan) so BOTH the desktop ocean
pass (ocean_pass.py) and a future browser twin pack an OceanSurface3D
into the identical std430 record. Mirrors the OceanSurface struct in
ocean.vert / ocean.frag (and, when it lands, ocean3d.wgsl).
The FFT ocean reuses the :class:~simvx.core.water.WaterMaterial shading knobs
(design D16): the colour / depth-fade / Fresnel / foam fields are packed exactly
like the Gerstner water record; the extra ocean* vec4s carry the cascade
geometry (patch lengths, count) and the FFT-specific displacement / foam scales.
Module Contents¶
Functions¶
Pack one ocean surface (row-major |
|
Pack a list of |
Data¶
API¶
- simvx.graphics.renderer.ocean_pack.__all__¶
[‘OCEAN_SURFACE_DTYPE’, ‘OCEAN_SURFACE_STRIDE’, ‘build_ocean_records’, ‘pack_ocean_surface’]
- simvx.graphics.renderer.ocean_pack.OCEAN_SURFACE_DTYPE¶
‘dtype(…)’
- simvx.graphics.renderer.ocean_pack.OCEAN_SURFACE_STRIDE¶
None
- simvx.graphics.renderer.ocean_pack.pack_ocean_surface(model: numpy.ndarray, mat: Any, subdivisions: int, size: tuple[float, float], patch_lengths: tuple[float, ...], *, choppiness: float, displacement_scale: float, foam_intensity: float) numpy.ndarray[source]¶
Pack one ocean surface (row-major
model+ aWaterMaterial) into a record.modelis transposed to column-major for the shader std430 mat4.patch_lengthsis the cascade patch-length tuple (metres, longest first); up to three are written and the count is stored inocean0.w.
- simvx.graphics.renderer.ocean_pack.build_ocean_records(surfaces: list[Any], patch_lengths: tuple[float, ...], *, choppiness: float, displacement_scale: float = 1.0, foam_intensity: float = 1.0) tuple[numpy.ndarray, int][source]¶
Pack a list of
OceanSurface3Dnodes into a contiguous record array.Used by the web exporter (the desktop pass packs per-frame from its own submission tuples via :func:
pack_ocean_surface). Reads each node’s world transform live, so a moving surface repacks correctly every frame. Returns(records, count);recordsis empty whensurfacesis empty.