luminance-0.27: cleanup, easier to use and examples!

examples, luminance

2018-06-28 14:00:00 UTC, by Dimitri Sabadie — feed

luminance-0.27 was released lately and a bunch of new and interesting things was added.

Easier API

The CHANGELOG is available to read but one of the most important change was the refactoring of the pipeline system and of the overall API to make it less confusing. For instance, the Framebuffer::default is now renamed Framebuffer::back_buffer. Another example is the face culling, that was in pre-0.27 enabled by default (causing people who don’t now about it to be confused because of a black screen). This is now disabled by default; hence less confusion.

The pipeline system types are now easier to use. For instance, redundancy was removed with the various Bound* objects. When you want a bound buffer of f32 for instance, you just have to use the type BoundBuffer<'a, f32> instead of the pre-0.27 BoundBuffer<'a, Buffer<f32>>. That is a small change but it will eventually make working with luminance more comfortable.

Another change that I think is beneficial is the new TessSlice type – that replaces the pre-0.27 TessRender. This type represents a GPU tessellation slice. Such a slice can be used to render part of a tessellation. What’s great is that the legacy methods to build such slices (TessRender::one_whole for instance) have a new, more generalized way to do it: TessSliceIndex<Idx>. This trait gives you a slice method which argument has type Idx. Several implementors exist:

They all give you a TessSlice to work with (with the appropriate lifetime). The four implementations listed above can be invoked with:

For those who wonder:

Why have you not implemented Index instead?

The current Index trait doesn’t give you enough power to index a value by returning something else than a direct reference. Everything is summed up in the RFC I wrote to fix Index.

Feel free to have a look at the CHANGELOG for further information.

Examples, examples, examples!

One of the most important feature people have asked is adding examples. The online documentation is not enough – even if I spent lots of hours enhancing it. So I added several examples:

You can find them in this place.

Please do contribute if you thing something is missing, either by opening an issue or by opening a PR. Any kind of contribution is highly welcomed!