mercoledì 23 dicembre 2015

Day 105: Huge changes

Today I continued my work on the automatization of shaders and materials.
In the end I managed to make both attributes and uniforms completely "dynamic".

Attributes:
Each material has a chunk of memory. When calling:

material->add_attr(name,value)

the value is inserted at the right position in the chunk. The position is retrieved from the shader class, which holds all the info about the attributes after the query to the gpu shader.

Uniforms:
Since uniforms don't require to be store in a contiguous chunk of memory, each material holds a map of uniforms built by getting infos from the shader class about the uniforms.
In the batch class only those materials with the same uniforms are drawn togheter.

The system still has lots of problems, and tomorrow i'll try and fix most of them. For example I need to write a function that sort the materials based on their uniforms (to be used in the batch class), and the whole system now only works with a single, mock shader I'm using to test everything. However for the first time, I'm actually seeing that this could be possible to achieve

Nessun commento:

Posta un commento