World coordinates were passed to GPU as floats: u_model of a chunk and
of a model had the world translation, vertices of translucent blocks,
particles, precipitation, block wrappers, lines and 3D texts were built
in the world space, and the camera position was subtracted in shaders.
The float step grows with the distance from the world origin (6 cm at
1M blocks, 2 m at 30M): blocks got skewed, then stuck together.
Camera::getOrigin() is an integer point near the camera (X and Z are
rounded to 1024 blocks, Y is 0). Camera::getView() is relative to it,
and every position passed to GPU is "world - origin" calculated on CPU,
so the shaders keep working with small numbers and do not change:
u_cameraPos, a_modelpos, u_inverseView and the shadows matrices are in
the same space as before, shifted by the origin. Matrices of a shadow
map are converted from the origin of its camera to the origin of the
player camera. The clouds shader gets the origin wrapped by the period
of its waves, the waves stay bound to the world.
Vertices of translucent blocks are local to the chunk now, as vertices
of opaque ones, and drawn with u_model of the chunk.
stdlib.lua runs from scripting::initialize before the main loop starts,
so time.uptime() is still 0 there and math.randomseed(time.uptime() *
1536227939) is math.randomseed(0). math.random() gave the same sequence
on every launch, and so did the random seed placeholder of the "New
World" page: every world created without typing a seed got the same
seed. Seed from time.precise_utc_time() instead.
Since b2bbef69 the first content-related app function ticks first, and in a
client app that tick loads the default content. app.config_packs read the
installed packs before that tick, so it asked reconfig_packs to add base
again: "pack duplication [base]". Do the pending tick before reading them.
Add hotbar-size, hotbar-layout and inventory-layout to config/defaults.toml,
player.get_hotbar_size / player.set_hotbar_size and
hud.is_hotbar_visible / hud.set_hotbar_visible.
reload_module loaded the new module code with the global environment,
while require runs modules in their pack environment. After reload,
PACK_ID and other pack globals were nil in the module.