Today I've written an enormous amount of code, mainly because somehow I didn't stumble in any stupid problem.
I started by creating a Sprite class, with the correct info to handle a 2D image.
Then I wrote a 2D batch to optimize the drawing of sprites (like I did for 3D stuff).
After that I proceeded to write a couple of shaders to render the 2D image on screen, and I added a method to my deferred rendered to draw with those shaders everything inside the batch.
I had a few troubles in blending the HUD on top of the 3D scene because of a pretty bad bug I never found till today, and I fixed that as well.
Once I got that working I needed to tweak a few parameters, implement the system to generate a 2D model matrix, fix a few other bugs, replaced the PNGLoading library, and now the system is working.
The coordinate system is quite good, but the scaling system is not, tomorrow I'll make it ratio-independent.
I also need to add an automatic system to add automatically to the batches the objects in the scene. Right now it is manually done, and it feels very unnecessary.
I'll probably refactor that as well.

Nessun commento:
Posta un commento