mercoledì 30 dicembre 2015

Day 110: Upgrading the last scene

Today I finished once and for all to upgrade all the game-side code.
I updated the last scene, the most complex one, and everything is working fine with the new geometry shader system.
I found out that every resource must be defined as a New pointer in the header file of the scene. Most of them were now declared in the start function, but out of scope they become dangling with the new way of doing things, and garbage is sent to the shader. For this reason this simple declaration rule must be followed carefully.

In the next days I'll have to decide how to handle shadows and ligthing shaders. The idea is to use the same batch for all three, however the shadow shader will not be accessible from the game, because I don't think that it needs to be modified... it will eventually expose a few uniforms, like shadow thinckness or shadow fading, and the rest will be shared among all shadows.

EDIT:
In the evening I had a little more time and I did a few things I was planning to do for a while.
First I made a system to recognize which parts of shaders are loaded (for example if the geometry shader is used or not), which I was manually doing right now.
Then I created a shader folder in the game and moved the geometry shaders in there, because now it's a user job. However the folder in the engine remains, to contain a list of standard shaders, which I'll maybe do in the future.

In the picture I tweaked a little with the second geometry shader. The particles change color randomly each frame (from purple to blue), and at the same time the lerp over time from black to the random color. This would not be possible with the standar shader.


Nessun commento:

Posta un commento