RE: https://mastodon.gamedev.place/@eniko/116232581608004216

instead of dealing with any of that i spent the afternoon refactoring so that i can include my library multiple times with different suffixes. this will be useful for supporting different color bit depths and such without making my code completely impossible to maintain

i was looking at 9 functions

1. flat color
2. gouraud
3. luminance grayscale
4. luminance with color ramp
5. textured
6. textured with flat color
7. textured with gouraud
8. textured with luminance grayscale
9. textured with luminance with color ramp

times 6 color depths (32, 24, 16 555 & 565, 8 332 and 8 bits with CLUT) is 54

(times two for depth buffer is 108)

now instead it can just be one include per desired supported mode

though tbh i'm dubious on the usefulness of 24 bit vs 32 bit color
as you can see the 332 bit rgb 8 bit mode is working perfectly
its ok don't worry i fixed it

ok it's actually looking proper now except that it throws an access violation when i exit so that's probably not an amazing sign

update: i fixed the access violation

you're telling me 3 bits of red/green and 2 bits of blue isn't enough to smoothly gouraud shade a triangle? i'm shocked, shocked!

well. not that shocked

really had to amp up the brightness boost for this to work but gouraud shaded rotating 8 bits per pixel skull is real

anyway now i can support all sorts of customizations, including different color modes easily. all you gotta do is include the header again for the mode you want:

⋕undef AFINETRI_H
⋕define AFINETRI_SUFFIX _Rgb8
⋕define AFINETRI_MODE_RGB8
⋕include "afinetri.h"

and there won't be a combinatorial explosion and my code won't become as much of a godawful mess so that's neat

ok, that's it. *dithers your 8 bit gothic wall skull*
bonus dithered gouraud
made it so it dithers flat color triangles too. the 16 colors for the pattern are calculated once, before the triangle renders
@eniko Looks like the green dither isn't "big" enough? Red and blue look fine.
@TomF yeah I was playing with different dither strengths for each color channel
@eniko noooo... not my 8 bit gothic wall skull 😭
@eniko wall skull in da club