Log 2 - Finnished Rendering shapes -
⠀
It goes without saying that 30h is insane, and that one Devlog probably won’t cover it, but I am going to try my best to describe my journey.
⠀
As of now, we currently support DefineShape, DefineShape2, and DefineShape3, not DefineShape4* yet, but I will get to that. I will work on re-porting to WASM for shapes, and cleaning up the website for easy access to voters.
⠀
The Journey:
⠀
I started off very overwhelmed, this part took 30h for a reason, and thats because I have a massive pipeline, of storing, more storing, conditional storing, then once everything is stored, I need to create lines for both linestyles, and fillstyles(Line Styling, and Shape Styling), and for fillstyles I need to create each fill with edges, one in forward order(Fillstyle 1) and one in reversed order(Fillstyle 0). I then need to apply an evenodd rule based on winding(Which is why one is reversed, and one is forward), and cut holes in shapes when there is overlap. As of now, we are handling gradients and normal fills, after this upcoming ship, I will add bitmap support for fills, and add DefineShape4. So this is a huge undertaking, and while I don’t have to calculate geometries myself(Skia does it for me), I do have to calculate the coordinates, and scale and everything else required to create an edge, and not just an edge I know, a random one, coming from the parser.
⠀
My attempts:
⠀
- Showed good promise, but I was just reading out edges and creating fills. Fills didn’t even closely resemble expected result, and where scattered everywhere. The only really cool thing to see was that the linestyles(Which are just placed, and don’t really matter in terms of winding or placement order, only that they are in the right place) were showing outlines of things that I knew were in certain test animations. - Took around 5.5 hours to write.
⠀
- Did not work at all, I was constantly getting segment faults, because I was calculating everything wrong. The SWF Spec, does not convey how to do this at all, it just explains simple things about the shapes. - Took around 4 hours.
⠀
- Last attempt at my original idea, which ended up just as bad as number 2 - Took around 2 hours.
⠀
- This was a big break, because I decided to look into lightspark and ruffle, and saw the idea, I did it differently, but it had the same concept of tracking the edges, then building fills with directions, not just putting edges into fills. I was storing everything into arrays, then looping through piles of edges to construct paths. This was the first kinda working result, and showed actual fills that I could recognize. I re-added linestyles here. It was very buggy to say the least, some fills were in the right spots, but most shapes simply didnt render, and fills were all over. - Took around 7 hours.
⠀
Devlog continued in comment…