v0.3.8
Pre-release
Pre-release
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)]toView2andView3 - 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
TileSizespublic API; they're now attached to an internalstruct TileSizesRef.
- Previously, we rendered at least one tile of size
- Add a new
trait ShapeVisitorandpub fn visit_shapes(..)for introspection into shapes and transforms defined in theshapesmodule. This is expected to be useful for automatically generated scripted bindings (indeed,fidget::rhainow uses it). - Added more document to
fidget::shapes - Made
fidget::rhai::shapes::register_shapeprivate - Significant changes to 2D rendering API:
- Changed
fidget::render::render2dto always return anImage<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 anImage<DistancePixel>. These replace the previousRenderModeobjects for generating specific flavors of image. - Note that approximate SDFs are entirely removed; they were not substantially faster, added complexity, and looked bad.
- Changed
- 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.
- These annotations are used in the Rhai bindings to build shapes without specifying every field, e.g.
- 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,
FromDynamicnow takes the field's default value as a hint, which may be used when promoting other types. For example, if you pass avec2(instead of avec3) to bothMoveandScale, thezcomponent will be set to 0 forMoveand 1 forScale. - Add helper functions to destructure and rebuild
Canvas2,Canvas3,View2, andView3into their component values. - Rename
fidget::{shapes, rhai}::vectofidget::{shapes, rhai}::types - Add more common types used in shapes and Rhai bindings:
Axisis a unitVec3Planeis anAxisand offset
- Add
Reflectshape, as well asReflectX/Y/Z - Removed
fidget::rhai::Engineandfidget::rhai::Axes- Previously,
fidget::rhai::Enginewrapped a Rhai engine and Fidget-specific functionality - The internals of
Enginewere tightly coupled tofidget-viewer, in ways that weren't useful for other GUIs. - Now,
fidget::rhai::engine()returns arhai::Engineobject with Fidget types pre-installed, but without the wrapper type. - The Rhai
draw(..)anddraw_rgb(..)functions are moved intofidget-viewer, because they're specific to that one GUI (fidget-cliis also aware ofdraw, but now has its own simpler implementation).
- Previously,
- Move
Vec2/3/4,Axis,Planeintofidget::shapes::typesinstead of re-exporting them infidget::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 justremap(..)in Rhai bindings; add a two-argument version which leaveszunchanged