jfcameron / gdk-graphics

3D Rendering using OpenGLES 2.0/WebGL1.0. Platforms: Linux, Windows, Mac, x86 64bit, arm64, wasm
MIT License
1 stars 1 forks source link

transparency: make ordering strategy user-definable or at least selectable #46

Closed jfcameron closed 3 years ago

jfcameron commented 3 years ago

currently transparency sorting is done on a per-entity basis in webgl1es2_scene.cpp. The user should be able to either select from a variety of strategies or provide their own implementation.

jfcameron commented 3 years ago

none, per-entity and per triangle are realistically what would be wanted. However maybe a user provided functor is the way to go, since there could be novel problems with very simple solutions.

Blending a 2d scene for example would only require sorting by depth. or maybe no sorting at all, if the user was able to instead increment their depth while iterating a scene's transulcency set. This would require that the user can extend try_add

jfcameron commented 3 years ago

strategy could be global (context wide) or scoped to a camera, since transparency sorting is done with respect to the current camera. I think adding a param to the camera factories makes sense. could have static "built in" sorters in the camera class, a none, per-entity and... per triangle. The problem with per triangle is that I dont want to duplicate vertex data in RAM (library currently uploads to VRAM then throws away the copy). however if the user is provided a functor, then they could do the work to keep the required data in memory. Entity could hold a user pointer, where the user could store the required tri data.

jfcameron commented 3 years ago

this story has become the more concrete ticket #56