Skip to content

Strata 0.8.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 04:15
· 3 commits to main since this release
5ea7e14

Wide lines, world-anchored labels, RGBA mesh colours, ambient and sun
levels, and window fullscreen: STRATA_ABI_MINOR moves from 12 to 17, and
every addition is compatible (STRATA_ABI_VERSION stays 1). The web kit
moves to 1.2 (Host::wideLine, Host::label, the light levels, a loader
that can cover one section of a page). The Python binding knows the v0.7.0
and v0.8.0 libraries' SHA-256s and gains Engine.set_fullscreen() and
Engine.fullscreen().

  • ABI 1.17: window fullscreen. strata_set_fullscreen(engine, enabled) makes
    the window cover its display, borderless at the desktop's resolution (no
    video mode change), or puts it back as a window at its earlier size;
    strata_is_fullscreen(engine) reports the state. The switch is synced
    before the call returns, so strata_get_drawable_size is already right,
    and a STRATA_EVENT_RESIZED follows as for any resize. Window surface
    only: headless and host-context engines return STRATA_ERROR_UNSUPPORTED
    and change nothing. In a browser it's the Fullscreen API, granted only from
    a user gesture. Python: Engine.set_fullscreen(), Engine.fullscreen();
    C#: StrataNative.strata_set_fullscreen, strata_is_fullscreen. No
    golden changes.

  • ARCHITECTURE.md, STRATA_LIGHTING_SUN (#99): why a sun a few degrees above
    the horizon draws a dark frame with the default levels. A table gives the
    key light, n·l, ambient and the fraction of a flat surface's colour
    received at 2°, 5° and 30°, evaluated from src/render/sun.cpp and the sun
    shader. The section also covers how to raise and then reset the ABI 1.16
    light levels for low-sun stills. Docs only: no ABI change, and no golden
    changes.

  • docs/LARGE_SCENES.md (#102): a guide to map-sized scenes. It covers
    choosing the near and far planes (depth precision, and fog, which runs from
    0.35 × the far plane to the far plane), camera height compared with terrain
    relief, exaggerating heights in the terrain tile rather than the camera,
    shadow_distance and marker size. Docs only: no ABI change, and no golden
    changes.

  • Value noise and fractal Brownian motion in modules/sim
    (strata/sim/noise.hpp). valueNoise(x, y, seed) is smoothstep-blended
    lattice value noise from an integer hash; fbm(x, y, FbmParams) sums
    octaves layers (each with its own seed and lattice offset) with gain
    and lacunarity, normalised to [-1, 1]. No global state; the same seed
    gives the same values on every compiler. Games built on Strata that drew
    terrain or patches from one or two octaves got smooth, round edges: the
    header carries a table, measured on this implementation with the new
    strata-sim-fbm-dimension tool, of the box-counting dimension of a level
    set's edge (about 1.0 for 1-4 octaves; 1.01 to 1.31 for gain 0.5 to 0.75
    at 9 octaves; natural coastlines are about 1.1-1.3). Unit tests pin the
    values for fixed seeds and check that more gain gives a rougher edge. C++
    only: no ABI change, and no golden changes.

  • Wide lines (ABI 1.13, #46). strata_submit_lines draws GL_LINES, which
    are one pixel wide, and WebGL 2 draws no wider, so at DPR 2 or 3 a road,
    river or route nearly vanished. strata_submit_wide_lines(engine, vertices, count, flags) takes pairs of the new StrataWideLineVertex (36
    bytes: position, colour, width_pixels, world_width;
    STRATA_STRUCT_WIDE_LINE_VERTEX = 17) and draws each segment as a
    camera-facing quad with a one-pixel antialiased edge, in the browser as on
    the desktop. The width at each end is the larger of width_pixels and
    world_width as projected there, and varies along the segment, so a
    ribbon can taper; the colour varies too. Flags: STRATA_LINES_ON_TOP (as
    for strata_submit_lines_ex) and the new STRATA_LINES_ROUND_CAPS, round
    ends so a polyline's segments join without notches
    (strata_submit_lines_ex still rejects it). A segment that crosses behind
    the eye is cut there. StrataLineVertex, strata_submit_lines and
    strata_submit_lines_ex are unchanged and draw exactly what they drew:
    every existing golden passes as it was. STRATA_ABI_MINOR is 13. The C#
    (StrataWideLineVertex, strata_submit_wide_lines, LinesRoundCaps)
    and Python (WideLineVertex, Engine.submit_wide_lines,
    LINES_ROUND_CAPS) bindings have it, and the web kit's host has
    Host::wideLine(...) (round caps by default), submitted with the frame
    and counted in sk_stats line segments; the kit's version stays 1.1, as
    its page/wasm contract did not change. The scene format has wide_line;
    new golden w1_wide_lines, unit tests for validation and the layout,
    layout tests in C# and Python, and a Python test that a 10-pixel line
    covers 10 pixels.

  • ABI 1.14, world-anchored labels (#47). Both additions are compatible;
    every ABI 1.x host keeps working and no existing image changes.

    • strata_project_point projects a world point with the camera last set
      onto the drawable as it is now: pixels from the top-left (the
      coordinates StrataText and StrataRect use), the distance along the
      view axis (as strata_read_depth_f32 measures it) and whether the
      point is in front of the camera. Hosts in C, C++, C# and Python no
      longer re-derive the engine's view-projection to place a label.
    • strata_submit_world_text takes StrataTexts plus one world anchor
      each; a text's x and y become a pixel offset from where its anchor
      lands. Anchors are projected at end_frame with the frame's camera and
      size, labels behind the camera are skipped, and labels are drawn after
      the frame's rectangles and before its screen text. They are not
      depth-tested. GL-free projectPoint in src/render/overlay.cpp, with
      unit tests; Engine::projectPoint, Engine::submitWorldText.
    • Python: Engine.project_point ((x, y, depth) or None behind the
      camera) and Engine.submit_world_text. C#: the two P/Invokes.
    • Web kit 1.2: Host::label(x, y, z, text) centres an engine-drawn label
      just above a world point, so it shows in stills rendered with
      sk_save_png as well as in the page. It compiles out against an older
      strata.h, so a vendored kit still links with the 0.7.0 library. The
      example scene labels its lamp.
    • New golden o3_world_labels and a label scene directive.
    • Text is still Strata's 8 x 8 printable-ASCII font: a non-ASCII
      character (an accented place name) shows as one ?. A wider glyph set
      is left for a separate change.
  • ABI 1.16: ambient and sun levels (#49). In STRATA_LIGHTING_SUN the ambient
    and the sun's strength were fixed functions of time of day, so a host could
    not lift a scene's shadow side or dim the sun for weather without moving
    it. strata_set_ambient(engine, tint, lift) makes the hemisphere ambient
    (and SPACE's flat legacy_ambient) ambient * tint + lift;
    strata_set_sun_intensity(engine, intensity, tint) scales the key light
    (the sun, or the moon at night) and keeps its direction, shadows and the
    sky. Both stay across strata_set_lighting, are ignored by LEGACY, and
    are validated (tint and intensity 0..16, lift 0..1; NULL is the default).
    New functions only: StrataLighting is unchanged, STRATA_ABI_VERSION
    stays 1 and STRATA_ABI_MINOR is 16. The defaults draw exactly what 1.15
    drew (x * 1 + 0 is x): every existing golden passes unchanged, a unit
    test checks the sky bit for bit over a whole day, and the Python test
    draws the same bytes with and without explicit default calls. In the C#
    and Python bindings (set_ambient, set_sun_intensity). Scene files gain
    ambient and sun_intensity; new golden sun_levels_overcast
    (before and after: docs/media/light-levels.png).

  • Web kit 1.2 (the same unreleased kit minor as Host::label, #47):
    Host::ambientTint, ambientLift, sunIntensity and
    sunTint (applied every frame; the defaults draw what 1.1 drew), and
    Host::fill(light, lift, priority): a fill light whose lift is added to
    the ambient when the tier's light budget drops it, so a scene that stands
    in fill lights for ambient no longer goes dark at tier 0 (4 lights). The
    tiers' budgets are unchanged, and a light added with light() adds
    nothing when dropped, so no tier changes for an existing host. Unit tests
    in test_kit_lights.cpp.

  • Web kit: a vendored kit builds against the 0.7.0 library again (#68).
    Host::wideLine (ABI 1.13) and the light levels (ABI 1.16) called the
    newer functions with no STRATA_ABI_MINOR guard, so docs/WEB.md's
    promise that the newer parts compile out held only for Host::label.
    They are now guarded like it; against an older strata.h they are absent
    and a dropped fill light adds no ambient. A new compile-only target,
    strata-kit-abi-floor, builds the kit's example scene with
    STRATA_ABI_MINOR lowered to 12 and every newer name poisoned (GCC and
    Clang), so an unguarded call fails the build. No ABI or pixel change.

  • Web kit: the slow bar (StrataLoader.slow()) wraps its buttons under its
    text when the row is too narrow, and its width is no longer capped at half
    the viewport (an auto width beside left:50%). On a 390 px phone it used
    to squeeze the text and the button onto several lines each, side by side.
    The smoke test's loader checks now include the bar at 390 px. The kit
    version stays 1.1.

  • Web kit: a canvas with no CSS size no longer grows on every frame at a
    device pixel ratio over 1 (#89). Such a canvas is shown at its width and
    height attributes, which the kit sets to its displayed size times the
    DPR, so it doubled until the browser's canvas limit; docs/WEB.md's page
    example had one. StrataKit.create now finds a canvas sized only by its
    attributes, pins its CSS size once at what it showed (kit.cssPinned)
    and warns in the console; a canvas with a CSS width or height is left as
    it is. The WEB.md example gives its canvas a CSS size, and the smoke test
    checks, with a stub module, that an unstyled canvas at DPR 2 keeps its
    size over 12 frames of the real loop. Part of the unreleased kit 1.2.

  • Web kit: multi-touch no longer makes taps nobody made (#90). Every
    pointer-down reset the shared drag distance and every pointer-up under
    6 px tapped, so a second finger touched during an orbit selected
    something, a two-finger tap or small pinch tapped twice (the second
    usually clearing the first's selection), and a right click tapped. A
    gesture now runs from the first pointer down to the last pointer up and
    taps once, on that last pointer-up, only if exactly one pointer was down
    in it, it moved under 6 CSS pixels in all, and it was not a right or
    middle mouse button. The smoke test's stub-module checks drive two
    synthetic touch pointers and real right, middle and left clicks. Part of
    the unreleased kit 1.2.

  • Docs: shadow_distance should be scaled to the scene. The shadow bias is
    measured in cascade texels, and a cascade's size follows shadow_distance
    (capped at the far plane), so a scene a few units across under the
    default 150, with one 1024² cascade, loses its small objects' shadows.
    strata.h, ARCHITECTURE.md and docs/WEB.md now say so, along with the
    web kit's shadowDistanceMin. No ABI, code or pixel change. (#53)

  • Docs: what colour space Strata outputs. Colours are documented as linear,
    but nothing encodes them on the way out: the shaders write the lit value
    unencoded and Strata does not touch GL_FRAMEBUFFER_SRGB, so the screen,
    strata_read_pixels_rgba8 and the golden PNGs show those bytes as sRGB.
    Hosts have guessed differently at what to pass. strata.h and a new
    "Colour space" section in ARCHITECTURE.md now say what reaches the screen.
    Opaque, untextured unlit draws show a colour exactly as passed (soft
    points are added to what is beneath instead). Lit surfaces come out darker
    in the mid-tones, and decoding sRGB to linear first only darkens
    everything further. None of this holds when a host context enables
    GL_FRAMEBUFFER_SRGB itself. An opt-in output encode is still open. No ABI, code
    or pixel change. (#48)

  • Docs: caught up with what has landed since 0.7.0. README.md's status table
    gains wide lines (ABI 1.13) and RGBA mesh colours (ABI 1.15), and no longer
    lists the OpenUSD modules as still to come. ARCHITECTURE.md gains the light
    levels (ABI 1.16), RGBA vertex colours, and src/core/ and web/kit/ in its
    layer table. No ABI, code or pixel change.

  • Docs: docs/DRIVE.md now gives the two replies it left out: a line that is
    not a JSON object answers with no op, and a step cut short by the engine
    going away replies with ended: true. It also says that a blank line gets
    no reply, and that more than 1 MiB waiting to be read with no newline closes
    the connection. docs/WEB.md no
    longer says CI holds browser goldens to 0 pixels over ΔE 4 (both browser
    checks use the default tolerance), no longer gives 22 as the current number
    of golden scenes, lists the native sk_shutdown, and puts the web kit's row
    back in the Testing table. No ABI, code or pixel change.

  • Web kit: the loader can cover one section of a page instead of the
    viewport. StrataLoader.load() and show() take contain: true with
    mount: the overlay and the slow bar are then position:absolute inside
    mount and scroll with it (a static mount is made position:relative).
    Without contain nothing changes. The smoke test (testing/smoke.cjs)
    scrolls a canvas that is not wholly on screen into view before it captures
    and taps, so a scene below the fold no longer reports "0 target(s) on
    screen"; a full-screen canvas is not moved. The example page has an
    ?embed=1 layout (the scene below the fold, the loader contained), and CI
    runs the smoke test against it. The kit version stays 1.1. (#53)

  • ABI 1.15: STRATA_MESH_COLORS_RGBA (StrataTexturedMesh.flags) reads
    mesh.colors as RGBA quadruples per vertex instead of RGB triples; the
    alpha is validated and ignored (a mesh's alpha is still color[3]).
    StrataMesh.colors is RGB while StrataMesh.color is RGBA, and a host
    that passed RGBA per vertex got every vertex after the first coloured
    wrongly with no error; the header now says so, and such a host can pass
    the flag through strata_add_textured_mesh with texture 0. Older
    libraries reject the flag as unknown. The Python binding's add_mesh
    raises ValueError when colors is too short for the vertices (the
    library would read past it) and warns when it is RGBA without the flag.
    STRATA_ABI_VERSION stays 1; no layout or pixel change. The drive
    channel's hello reports "abi":"1.15". (#53)

  • Scene files read by tools/common/scene_file.cpp (strata-golden)
    refuse a few malformed lines they used to load (#75); the C# primitives
    harness parses scenes itself and is unchanged. An expect_ray distance or an
    item alpha that is present but does not parse is an error instead of
    being dropped, so a typo can no longer turn off a distance check. Numbers
    in expect_ray's mesh index and expect_depth's distance must parse
    whole (5x is no longer read as 5). A sun date day is checked against
    its month, leap years included. Anything after a directive's last field
    is refused as unexpected '<word>' at the end of the line. Every scene in
    tests/scenes still loads; no library or pixel change.

  • Sim module: Registry::clear() no longer brings old handles back to life
    (#80). It threw the slot generations away, so the first entity created
    after it was {0, 0} again and a handle kept from before the clear read as
    alive and pointed at the new entity. Slots are now kept and freed, and each
    living slot's generation is bumped as destroy() bumps it; new entities
    still take the lowest slot first. capacity() no longer drops to 0 on
    clear(). No library, ABI or pixel change.

  • Sim module: Rng::range(lo, hi) works for spans wider than INT32_MAX
    (#81). It computed hi - lo in int32_t, which overflows (undefined
    behaviour) for such spans; with the usual wrapping
    range(INT32_MIN, INT32_MAX) always returned lo. The span and the result
    are now computed in 64 bits, and the full int32 range takes one
    nextU32(). Every span that did not overflow gives the same numbers as
    before, bit for bit (a pinned-sequence test checks it), so seeded runs and
    their state hashes are unchanged. No library, ABI or pixel change.

  • CI: the Linux save-benchmark gate fails when strata-save-bench does
    (#82). The step ran under bash -e without pipefail, so tee's exit
    status hid a failed or crashed benchmark, and modules/save/bench/gate.py
    passed whatever lines it was given, an empty file included. The step now
    runs with shell: bash (which adds pipefail), the benchmark's stderr is
    no longer discarded (on Windows either), and the gate fails with an
    ::error:: for every budgeted size (1000 and 10000 agents) that has no
    result. New Python tests (tests/python/test_save_bench_gate.py) check
    that an empty or partial results file fails. No library change.

  • Docs: two comments in strata.h are corrected (#84). The ABI 1.7
    textures paragraph said texel alpha is ignored because meshes are opaque;
    since ABI 1.11 a STRATA_MESH_TRANSLUCENT mesh's alpha is mesh.color[3]
    times the texel's alpha, as the translucent flag's own comment says.
    STRATA_MESH_COLORS_RGBA said a 1.7 to 1.12 library rejects it; 1.13 and
    1.14 libraries do too, so the range reads 1.7 to 1.14. No code change.

  • Python binding: Engine.add_mesh raises ValueError when normals has
    fewer than 3 floats a vertex or uvs fewer than 2, as it already did for
    colors, and create_texture_rgba8 / update_texture_rgba8 raise it when
    rgba is shorter than width * height * 4 bytes (#79). The C ABI takes no
    lengths for these, so a short sequence was read past its end in native
    code. Tests in tests/python/test_argument_checks.py need no library.

  • C# binding: StrataNative declares strata_status_string,
    strata_set_log_callback and strata_camera_look_at, which it was
    missing, and StrataAbi has MaxTextures and MaxTextureSize (#83). The
    log callback is a StrataNative.StrataLogFn delegate that the binding
    keeps referenced while it is installed, so the GC cannot collect it under
    the library. A new test checks that every STRATA_API function in
    strata.h has a matching DllImport entry point, so the binding cannot
    fall behind the header again.

  • Save module: loading past a damaged HEAD no longer costs the older saves
    (#85). The next save hard-linked the damaged HEAD over the valid
    HEAD.prev, and its history held only the loaded save, so prune deleted
    every older intact save; a migration after a fallback pruned the original
    save it had just promised to keep. HEAD.prev is now replaced only when
    the current HEAD parses, and after a fallback the slot's history lists
    every save whose bytes still match the hash in its name, loaded save
    first, so the next save prunes by the usual keep limit instead. A
    migration keeps the original save in the history right after the migrated
    one. No ABI change; saves written before are read as they were.

  • USD module: a variant selection cleared since the baseline is saved (#86).
    writeDelta skipped empty selections, and SetVariantSelection(set, "")
    erases the opinion rather than authoring one, so the baseline's selection
    came back on load. A cleared selection is now written as an explicit empty
    selection (BlockVariantSelection), which blocks the weaker layers.
    Unchanged selections still write nothing, so existing save bytes do not
    change.

  • Save module: a never-saved slot whose HEAD is damaged loads its base
    (#87). It failed with no save in slot, although the base was intact. Now
    the newest base whose bytes match the hash in its name loads as a
    never-saved slot, with usedFallback and a warning; the next save rewrites
    HEAD. A missing HEAD behaves as before, a damaged base is still
    refused, and the no save in slot error now lists why each file was
    rejected.

  • USD module: hydrate no longer sizes an allocation from the grid header
    alone (#88). It allocated the whole grid before reading any chunk, so a
    header claiming a huge grid over few chunks could throw bad_alloc, which
    the never-saved load path did not catch. Every chunk is now counted, found
    and size-checked before the grid is allocated, and that path catches
    exceptions as the save candidates' path does.