LFS: Faster autorotate and bytes operations + LfsApi: Add ScreenshotTextureEvent
This PR optimize the bytes and autorotation of screenshot after rendering. Some real numbers:
with 4K rendering
daky optimized v2 (this PR)
rgb 22ms!
rgba 20ms!
knah:
0°
rgb 55-65ms
rgba 80ms
270°
rgb 260ms
rgba 280ms
90°
rgb 100ms
rgba 130ms
180°
rgb 100ms
rgba 145ms
Details: Unity render is horizontally swapped so we need to mirror swap on X: That part was rewritten so it's simplified and optimized. Old code was doing the byte wizardry and then using another marshall.Copy which were combined in this PR and thus saving operations and memory.
Also if autorotate previous code was doing byte wizardry but that's not necessary and slow. In this new version we manipulate the camera so it's always upright before the rendering. So then there is no need to fix and correct anything except for the above mentioned unity X swap. Enjoy.
Also I added a new event (2nd commit) that allows more modding possibilities: For ex I have a WIP mod that allows to spawn the camera photos in VR directly.
@knah what do you need to review and merge this?