Skip to content

Strata 0.4.0

Choose a tag to compare

@github-actions github-actions released this 22 Oct 12:46
· 74 commits to main since this release
2e03be8

The browser (WebGL 2 through Emscripten), a seasonal sun, textures, picking
and texture updates. Every ABI addition is compatible: STRATA_ABI_VERSION
stays 1 and STRATA_ABI_MINOR is 8.

  • ABI 1.8, for Kindling
    (a first-person cozy restoration game): grime cleaned patch by patch,
    knowing what is under the crosshair, and mouse-look. All three are
    compatible additions; every ABI 1.x host keeps working.

    • strata_update_texture_rgba8 replaces a rectangle of an existing
      texture (same texel conventions as creation; the mip chain is rebuilt for
      STRATA_TEXTURE_MIPMAPS textures). New GpuDevice::updateTexture in the
      GL 4.5 and GLES 3.0 / WebGL 2 devices; Engine::updateTextureRgba8.
    • StrataRayHit (STRATA_STRUCT_RAY_HIT, 36 bytes) and
      strata_raycast_meshes: the nearest static-mesh triangle along a ray,
      through each mesh's model matrix, both faces counting. Meshes now keep a
      CPU copy of their positions and indices for this (12 bytes per vertex
      plus 4 per index). GL-free maths in src/render/ray_pick.cpp, with unit
      tests; Engine::raycastMeshes.
    • strata_set_relative_mouse_mode: on the SDL3 window, hides and captures
      the cursor and reports motion as dx/dy only (pointer lock in a
      browser); STRATA_ERROR_UNSUPPORTED on headless and host-context
      surfaces. Engine::setRelativeMouseMode.
    • C# mirror and P/Invokes in Strata.Interop, with layout tests.
    • New golden tex_update_grime, and two scene directives:
      texture_update (applied between the two frames strata-golden draws)
      and expect_ray (fails the scene unless the raycast hits the named mesh).
  • The WebGL 2 / GLES device starts on contexts with fewer than 16 fragment
    texture units. Its scratch unit (where textures are bound while created)
    was fixed at 15, so a phone browser reporting 13 failed with "the GLES
    device needs 16 fragment texture units". The scratch unit is now the
    device's last unit, and 9 units (Strata's 8 plus scratch) are required.

  • The USD and save modules build and pass their tests on Windows (MSVC).
    modules/save gains fs_win32.cpp (MoveFileExW with write-through,
    FlushFileBuffers, LockFileEx; UTF-8 paths converted to UTF-16), selected
    instead of fs_posix.cpp on Windows. The --crash suite (fork, setrlimit,
    SIGKILL) stays POSIX-only and reports itself skipped on Windows. CI builds a
    Windows OpenUSD prebuilt once (key.sh windows,
    build-openusd-windows.sh) and publishes it as a release asset beside the
    Linux one.

  • Strata runs in the browser (WebGL 2). A second GpuDevice backend,
    OpenGL ES 3.0 (src/rhi/gles3_device.cpp), draws every pass: the GL 4.5
    shaders are rewritten to GLSL ES 3.00 when pipelines are created, cube map
    arrays become one cube map per shadowed light, base vertex/instance fold
    into attribute offsets, and depth clamp uses EXT_depth_clamp or a shader
    fallback. The C ABI is unchanged (no new functions; ABI stays 1.7). Desktop
    builds still default to OpenGL 4.5 and its goldens are unchanged.

  • Emscripten builds (emcmake cmake ..., emsdk 6.0.11 in CI): SDL3's
    Emscripten driver for the canvas and input, libstrata.a (engine + SDL3 in
    one archive), C++ exceptions compiled as -fwasm-exceptions by default
    (STRATA_WASM_EXCEPTIONS), and strata-golden as a web page. See
    docs/WEB.md, including notes for .NET browser-wasm hosts.

  • examples/village-day: the L2 village through a day, from the C ABI only;
    an SDL3 window natively, a canvas in the browser. README animation of it
    running in headless Chromium (tools/make_web_media.py).

  • The desktop library can run the GLES device too: STRATA_GL_API=gles3
    selects it on an OpenGL ES 3.0 context (EGL or SDL3), and
    STRATA_GLES_NO_DEPTH_CLAMP=1 forces the depth clamp fallback. CI draws
    the desktop goldens through it on llvmpipe (0 pixels over ΔE 4 on all 22).

  • CI job build-web: builds with Emscripten, runs the unit tests under Node,
    checks libstrata.a defines the C ABI, and draws every golden scene in
    headless Chromium (Playwright 1.61.1, SwiftShader) against new
    web-swiftshader.png goldens, with and without EXT_depth_clamp, and
    against the desktop goldens at the default tolerance. Releases gain a
    strata-<version>-wasm32-emscripten.tar.gz asset.

  • glad is regenerated with OpenGL ES 3.0 merged into glad/gl.h.
    GpuDevice gains createIndexBuffer (WebGL fixes a buffer's kind at its
    first binding).

  • Seasonal sun (ABI 1.6): StrataSolarPosition, strata_solar_position
    (the sun's direction, elevation, azimuth, declination, hour angle and
    equation of time for a UTC moment, latitude and longitude, from NOAA's solar
    position equations) and strata_set_sun_direction, which places the
    STRATA_LIGHTING_SUN sun directly instead of by time_of_day and latitude.
    The existing time-of-day sun is unchanged and stays the default.

  • Scene files take sun date <YYYY-MM-DD> <HH:MM> <utc_offset> <lat> <lon>.
    New goldens sun_june_noon, sun_december_noon and
    sun_december_afternoon.

  • Textures and textured, transformable meshes (ABI 1.7):
    strata_create_texture_rgba8 (RGBA8, optional mip chain with trilinear
    filtering, wrap or clamp per axis) and strata_destroy_texture;
    StrataTexturedMesh and strata_add_textured_mesh (a static mesh with
    uvs, a texture that multiplies its colour, and STRATA_MESH_UNLIT for
    emissive surfaces that ignore lights and fog and cast no shadow); and
    strata_set_mesh_transform, a per-mesh model matrix (normals through its
    inverse transpose) applied in the opaque and shadow passes, so a planet
    spins about a tilted axis with one call a frame and no re-upload.

  • GpuDevice textures gain mip chains and repeat wrapping. Static meshes
    now have their own pipelines (a uv per vertex, a model matrix in uniform
    binding 3, the texture on unit 4); untextured meshes sample a white texel
    and draw exactly as before.

  • Scene files take texture, sphere_mesh, uvs, mesh_texture,
    mesh_unlit and mesh_transform. New goldens tex_globe_sun and
    tex_space_planets.