AlexvZyl / NativeFramework

💡 A GPU-accelerated native application framework, with performance and scalability at its core. Written in C++ using GLFW, OpenGL and dear imgui.
4 stars 1 forks source link

Fix drawing layer organisation #54

Open Cullen-Enerdyne opened 3 years ago

Cullen-Enerdyne commented 3 years ago

Make sure entities are being drawn at the correct layer.

AlexvZyl commented 3 years ago

Might be a good idea to make some sort of array that layers the data from top to bottom according to an index, instead of manually entering numbers.

Cullen-Enerdyne commented 2 years ago

I like this idea, @AlexEnerdyne. Can we discuss this? Do you have an idea on how to implement this?

Cullen-Enerdyne commented 2 years ago

@AlexEnerdyne , this is currently being handled by manually keeping track of which entities are in which layer, and hard-coding this. Any ideas on how to do this properly (and efficiently) would be great. I can think of ways of populating vectors of entities, then layering them in the order in which they appear, however the implementation I'm thinking of would require updating the layer of all entities whenever another layer is added. This obviously isn't viable.

AlexvZyl commented 2 years ago

@Cullen-Enerdyne Correct me if I am wrong, but the only reason we need so many layers is because of the way blending currently works?

Cullen-Enerdyne commented 2 years ago

@Cullen-Enerdyne Correct me if I am wrong, but the only reason we need so many layers is because of the way blending currently works?

That's part of the reason, but sometimes we also need it for occlusion.

AlexvZyl commented 2 years ago

This is not a full solution, but we could definitely add Move back and Move forward options to the context menu. Then all components are added to the same layer, and the user can adjust as needed.