Modifiable rendering order
Posted: Thu Oct 06, 2016 7:37 am
Obviously, in my projects I use (or at least would like to use) ZApplication.OnRender for drawing background of the whole application, AppState.OnRender to draw an overlay specific for given application state, Model.OnRender to render model's basic shape and ModelState.OnRender to render model state's specific overlay parts. So more specific OnRender section should add more specific rendering artifacts. Unfortunately, ZGE uses different rendering order, so for instance, when someone tries to render transparent model sprites on top of background rendered by ZApplication.OnRender, he obtains sprite squares where alpha channel is drawn with application's ClearColor, because models are rendered before ZApplication.OnRender. Therefore, it is necessary to render background as a Model. This is not so convenient.
I'm suggesting the following rendering order which for many cases is more logical:
1. ZApplication.OnRender
2. AppState.OnRender if it is active
3. Model.OnRender for each model instance depending on Model.RenderOrder
4. ModelState.OnRender if it is active
Because we do not want to corrupt backward compatibility, the best solution is to add the Application.RenderOrder property with a dropdown for choosing between "ModelsBeforeApp" or "AppBeforeModels", and the default is ModelsBeforeApp. This proposal has been discussed already with Ville who agrees, but we would like to know your opinion. Do you agree with the proposal?
I'm suggesting the following rendering order which for many cases is more logical:
1. ZApplication.OnRender
2. AppState.OnRender if it is active
3. Model.OnRender for each model instance depending on Model.RenderOrder
4. ModelState.OnRender if it is active
Because we do not want to corrupt backward compatibility, the best solution is to add the Application.RenderOrder property with a dropdown for choosing between "ModelsBeforeApp" or "AppBeforeModels", and the default is ModelsBeforeApp. This proposal has been discussed already with Ville who agrees, but we would like to know your opinion. Do you agree with the proposal?