scallyw4g / bonsai

A voxel engine in a pot
Do What The F*ck You Want To Public License
170 stars 10 forks source link

Change immediate geometry buffer to contain sim space positions #30

Open scallyw4g opened 6 months ago

scallyw4g commented 6 months ago

Right now all geometry pushed into the 3d immediate buffers are in camera space (called render space in the code), but that has some problems. Namely, the camera has to be updated before any of that geometry gets pushed. While this was a servicable approach for quite some time, there is a new constraint that the camera must be updated after the UI is drawn (to avoid a frame of camera jank when the UI captures input), which means there is now a frame of UI jank on the immediate geometry that the UI draws (things like the highlighted voxel, selection region, etc). The solution to this is using camera-independent coordinates in the immediate buffer, then transforming into camera space in the shader, like a real program.

scallyw4g commented 6 months ago

grep @immediate-geometry-is-a-frame-late