Home Artists Posts Import Register
Join the new SimpleX Chat Group!

Content

There are many different ways to implement 2D rasterization from scratch. Retroquad needs an implementation that's flexible enough to handle all of the different cases of 2D drawing required for usability purposes, while also being fast enough to have nearly zero impact on the framerate.

The SPR sprite rasterizer is extremely flexible due to operating in 3D space, but it's too slow for GUI rendering because a single GUI screen can have many hundreds of individual elements, including each individual character of each string of text.

A rasterizer that operates in 2D space will be much faster because the same uv texture mapping increments can be used for the whole image. This allows for scaling (including flipping), shearing and free rotation at any degree.

However, free rotation means that each span would have a different size, which would require extra steps to compute the edges of each span, and to clip each span individually. There's likely a fast way to implement this, but square angle rotations are enough for most use cases and can be done using the same edges for all spans.

Similarly, shearing would require per-span clipping, which I prefer to avoid. It's a shame, because shearing would be useful for drawing text in italic, but I don't think it would be useful enough to justify the performance impact.

Tiling is going to be implemented because it's actually used in a few places, and it will speed up the rendering of elements such as menu sliders.

Scaling will be a little complicated because there are several ways to use it, and it does affect alignment accross different elements. Alignment is where a canvas system is needed, and it's what I'm going to design now.

Comments

No comments found for this post.