What's everyone working on this week (42/2017)?

New week, new Rust! What are you folks up to?

I'm working on a crate for building and linking Windows .rc files. There's still some things I need to address before publishing, but it already works for simple (i.e. language-neutral) .rc files.

https://github.com/FaultyRAM/windres-rs

2 Likes

Indigo UI Framework

This past week I got some more work done on Indigo, my UI framework prototype for Rust. (See last week here)
Here's what's new:

Text Primitive

I've implemented text support again. For now only a single style per text component is supported, but I hope to introduce the concept of text runs in order to have them styled independently. Text layout is very basic, with per-character text wrapping supported and that's about it. The property system lacks the concept of inherited styles, so setting a FontSize on a root component does not yet propogate it down to its children.

Image Primitive

I implemented image primitive support which let me build an image component. The loading happens on a dedicated thread which also caches the WebRender ImageKeys, ensuring only one copy of the image is ever stored in the texture cache. It also fallsback to a checkboard image if it cannot find the image specified. Right now it only supports local file sources, but I hope to expand this to include remote sources soon.

Scroll Primitive

The scroll primitive got some fixes,it now properly calculates the viewport (bounds minus scrollbar size) and scrollable extent of its child.

Here's an example of the ScrollViewer component built using the Scroll primitive.

#[component]
impl Component for ScrollViewer {
    fn primitive_type(&self) -> PrimitiveType {
        PrimitiveType::Scroll(Cell::new(ScrollPrimitiveInfo::new()))
    }
    
    style! {
        ScrollViewerDefaultStyle {
            HorizontalAlignment: Alignment::Stretch;
            VerticalAlignment: Alignment::Stretch;
            Scroll: Scroll::Vertical;
        }
    }

    ui! {
    }
}

Layout

Layout is now done on its own dedicated thread ensuring that scrolling remains smooth even when dealing with a really bad layout pass.
Padding (which includes border thickness) is now taken into account as part of the content size.
Grid layout support is still a work in progress, I need to land some architectural changes in layout before I could move on this anymore.

Here is a video showing why this is important, I put code in there to purposely choke the Layout Thread. Notice how scrolling remains responsive even while the layout of primitives catches up to viewport changes.

Here is a video without the layout performance issues, just for comparison.

Style

The style macro got some love this week, I removed the requirement for defining property values as brace delimited expressions. They're still supported, but now you can use normal expressions.

Before:

StyleName {
    BorderThickness: {Thickness::uniform(10.)};
    ... other properties
}

After:

StyleName {
    BorderThickness: Thickness::uniform(10.);
    ... other properties
}

I also reimplemented support for explicit properties passed into the RSX nodes themselves, so you can override properties by explicitly passing them in, for example:

<ScrollViewer BackgroundColor={ColorF::new(1., 0., 0., 1.)}>
	....
</ScrollViewer>

Next week

I spent a lot of time reorganizing code to make the whole thing less of a hack job, its getting there. Hit Testing broke as a result of all these changes, I'll probably focus on fixing that this week, and making the necessary style macro changes to support defining a style per visual-state.
The syntax I'm considering would be something like:

StyleName {
    VisualStyle::Normal => {
        BackgroundColor: ColorF::new(1., 0., 0., 1.);
    },
    VisualStyle::Hovered => {
        BackgroundColor: ColorF::new(0., 1., 0., 1.);
    }
}
3 Likes

After spending way too much time playing with my vimrc I'm back to uom (type-safe zero-cost dimensional analysis) working through doing unit conversions... or more accurately, propagating a lot of generic type bounds.

1 Like

I think this week I should spend some time on env_logger , which doesn't live with the log crate anymore. We've got some open-ended discussion about env_logger's future-direction I need to break down into actionable contribution opportunities.

1 Like

Considering that the week is nearly over, I can tell you what I did work on:

  1. Last week I fixed a major bottleneck of BVH creation. Details can be found here. Bringing down the recursive call time for a complex scene from 17 minutes to 1.9 seconds was worth investigating profilers etc. :sweat_smile:
  2. This week started with implementing some missing code for mipmaps. Basically if your textures have a resolution which does not match a power of 2 you have to resize the textures in memory and resample the texture before creating mipmap levels.
  3. I fixed an issue regarding the 'GlassMaterial'. Basically the Rust version of the renderer didn't take transmissivity into account, so you could not use colored glass pieces as in the test scene, or at least the color didn't get trough in the final image.
  4. There were also a couple of minor changes, removing side-effects from two functions (where the input parameter got changed, but really shouldn't have, because we got the proper return value), renaming functions slighlty, and adding helper functions where needed. All of this is reflected in the latest documentation update, but hard to miss without looking at the commits.

The rest of the week I will probably work on some new test scenes and/or render existing scenes (with less noise) with the current state of the renderer and document the progress here. Search for checkins starting with "PBRT (Rust version) ...".

1 Like

I started laying out the basics of a tool for demo making (demo as in demo scene, see http://www.pouet.net if interested). I've got intrigued by what can be achieved using just a quad and some shaders based on ray marching and SDF.

So I started putting together a basic 3D engine based on OpenGL and I'm experimenting with this.

Here's what it looks like so far:

sdf-02

3 Likes