RobustToolbox
RobustToolbox copied to clipboard
Add support for drawdepths per sprite layer
scrungles some sprite code to enable individual layers to specify drawdepths.
Main change is that ProcessSpriteEntities now gets and sorts individual sprite layers rather than entire sprites.
Why do we need to have per-layer draw depths? I know its mentioned in #4803, but why is it actually useful, and how would it work with shaders or eventual support for advanced sprite rendering options (layer groups / byond style "draw together", or drawing an entity's sprite within another entity's layers, etc)? And would it be worthwhile given it would probably appreciably slow down the sorting step while rendering?
I do think layers should have a depth/sorting (e.g. #2970), but I'm not sure about having them sort across different entities
Why do we need to have per-layer draw depths? I know its mentioned in #4803, but why is it actually useful, and how would it work with shaders or eventual support for advanced sprite rendering options (layer groups / byond style "draw together", or drawing an entity's sprite within another entity's layers, etc)? And would it be worthwhile given it would probably appreciably slow down the sorting step while rendering?
I do think layers should have a depth/sorting (e.g. #2970), but I'm not sure about having them sort across different entities
Chairs are an easy example, currently they're missing an overlay they're supposed to have which would make it so the armrest draws over the player.
Chairs are an easy example, currently they're missing an overlay they're supposed to have which would make it so the armrest draws over the player.
I think that should be done by allowing a sprite to get drawn as a layer of some other sprite, as mentioned in my previous comment. I.e., the whole mob should just become a layer within the chair's sprite. If you just changed the armrest's drawdepth to get drawn over mobs, it would be drawn over any mob that moves near the chair, not just the mob that is currently in the chair.
My vague wishlist/todolist for sprites is:
- Move logic out of sprite component and into the system
- Move clickmaps from content to engine
- Rework
ISpriteLayerand add layer groups (collections of other layers or layer groups), and allow each group to have its own shader & color modulation - Change sprites component to basically just be a kind of layer group, and allow sprites to use the sprites of other entities as a layer.
- Would requires somehow updating clickmaps so that you can still click on an entity that is in a chair.
- Add support for multiple "PostShader"s
- Add direction dependent drawdepths for 4/8-dir sprites to fix things like inhands being rendered incorrectly
Is there anything significant blocking this? Would be useful on downstreams.
not good code and not a good approach to be worth really considering