- Remove the degenerate case of vertical directions, by updating the viewup as the camera moves.
- Remove the consequent limitation to 89.9 degrees.
- Add (unused so far) camera roll angle, with setter.
- Add accessors for all angles. Lua will want to know that.
- Rename m_angleV/H to m_viewAngleV/H to distinguish them clearly from the orientation of the mesh. They will differ e.g. when the player is sitting somewhere.
- Rename vertical turn so it includes 'view' in the name, because this one does not affect the player's rotation as turnH does.
- Make player look north at start, like it originally did before the Z-up changes.
Get rid of floats when calculating chunk position from block position. This can be done in integers. Since CHUNK_WIDTH etc. are guaranteed to be powers of two, using & -N is equivalent to doing & ~(N-1), or put differently, making it divisible by N. That makes the division exact, and allows the compiler to transform it into a plain shift (tested with both gcc and clang).
We did the same in Part 3 of this series.
Improve rendering precision by subtracting the camera position from the models' position, then temporarily setting the camera to (0, 0, 0) for rendering. This keeps GL coordinates in a low range.
While this fixes the calculation, it introduces visibility determination problems, because the method was not correct. The centre may be out of the area of the camera, with nodes still visible inside. To fix this, the eight corners of the chunk need to be considered.
Missed the case of getting rid of the box at the southwest.
We take the chance for making it more robust by checking all four corners, just in case there's a platform with trouble in an edge case.
Fix neighbouring chunks list on the server side, which was causing some slices of trees to appear in the air.
Also switch order of loops for generating leaves to Z, Y, X.
Fix chunk visibility test and visibility of world at start.
The assumptions about the working of screen coordinates in the previous commit were clearly wrong.
Fix UVs and ambient occlusion maps. The change of chirality was not enough, as that rotated faces, so that needed to be fixed. This affected vertex indices that were manipulated by the AO algorithm, which needed to be fixed as well.