Skip to content

v0.3.8

Pre-release
Pre-release

Choose a tag to compare

@mkeeter mkeeter released this 25 Jun 22:11
· 131 commits to main since this release
0cd0af8

This release focuses heavily on Rhai ergonomics, improving the standard library and making it easier to write scripts.

There are a bunch of other fixes and improvements as well; see the detailed log below or details!

  • Bug fix: Image::height() was returning width instead!
  • Add #[derive(PartialEq)] to View2 and View3
  • Improve rendering at small images sizes
    • Previously, we rendered at least one tile of size cfg.tile_sizes[0]
    • Now, we pick the smallest possible tile size for the root tiles; if we're rendering a 32×32 image with tile sizes of [128, 32, 8], then we'll render a single 32×32 tile (instead of 128×128)
    • As part of this change, a few functions were removed from the TileSizes public API; they're now attached to an internal struct TileSizesRef.
  • Add a new trait ShapeVisitor and pub fn visit_shapes(..) for introspection into shapes and transforms defined in the shapes module. This is expected to be useful for automatically generated scripted bindings (indeed, fidget::rhai now uses it).
  • Added more document to fidget::shapes
  • Made fidget::rhai::shapes::register_shape private
  • Significant changes to 2D rendering API:
    • Changed fidget::render::render2d to always return an Image<DistancePixel>, which encodes either a distance sample or details on fill at that point.
    • Removed the trait RenderMode, which was previously used to generate pixel samples from a distance field.
    • Added ImageRenderConfig::pixel_perfect, which forces sampling down to individual pixels.
    • Added fidget::render::effects::{to_rgba_bitmap, to_debug_bitmap, to_rgba_distance} to post-process an Image<DistancePixel>. These replace the previous RenderMode objects for generating specific flavors of image.
    • Note that approximate SDFs are entirely removed; they were not substantially faster, added complexity, and looked bad.
  • Add #[facet(default = ...)] annotations to relevant fields in
    fidget::shapes.
    • These annotations are used in the Rhai bindings to build shapes without specifying every field, e.g. circle(1) leaves the center as a default value.
  • Fix issue where Shape::eval_* functions would return an empty slice if there were no active variables in the shape; it now returns a slice that's the correct size (i.e. matching the input slices).
  • In Rhai bindings, FromDynamic now takes the field's default value as a hint, which may be used when promoting other types. For example, if you pass a vec2 (instead of a vec3) to both Move and Scale, the z component will be set to 0 for Move and 1 for Scale.
  • Add helper functions to destructure and rebuild Canvas2, Canvas3, View2, and View3 into their component values.
  • Rename fidget::{shapes, rhai}::vec to fidget::{shapes, rhai}::types
  • Add more common types used in shapes and Rhai bindings:
    • Axis is a unit Vec3
    • Plane is an Axis and offset
  • Add Reflect shape, as well as ReflectX/Y/Z
  • Removed fidget::rhai::Engine and fidget::rhai::Axes
    • Previously, fidget::rhai::Engine wrapped a Rhai engine and Fidget-specific functionality
    • The internals of Engine were tightly coupled to fidget-viewer, in ways that weren't useful for other GUIs.
    • Now, fidget::rhai::engine() returns a rhai::Engine object with Fidget types pre-installed, but without the wrapper type.
    • The Rhai draw(..) and draw_rgb(..) functions are moved into fidget-viewer, because they're specific to that one GUI (fidget-cli is also aware of draw, but now has its own simpler implementation).
  • Move Vec2/3/4, Axis, Plane into fidget::shapes::types instead of re-exporting them in fidget::shapes.
  • Make fidget::shapes::types::{Value, Type} public; these represent types which can be used in shapes (with ergonomic Rhai bindings).
  • Fix missing local optimizations in Context::import (e.g. x * 0 => 0)
  • Rename remap_xyz(..) to just remap(..) in Rhai bindings; add a two-argument version which leaves z unchanged