Inventory blocks render fix

This commit is contained in:
MihailRis
2023-11-12 05:52:14 +03:00
parent de92cff0aa
commit 163fdd2e37
4 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -301,8 +301,9 @@ void Batch2D::blockSprite(float x, float y, float w, float h, int atlasRes, int
float vu = 1.0f - ((index[3] / atlasRes) * scale) - scale;
float uf = (index[0] % atlasRes) * scale;
float vf = 1.0f - ((index[0] / atlasRes) * scale) - scale;
// if (this->index + 18*VERTEX_SIZE >= capacity)
// render();
if (this->index + 18*VERTEX_SIZE >= capacity)
render();
float ar = 0.88f;
float ox = x + (w * 0.5f);
+1 -1
View File
@@ -292,7 +292,7 @@ vec4 BlocksRenderer::pickSoftLight(int x, int y, int z, ivec3 right, ivec3 up) c
// Get texture atlas UV region for block face
inline UVRegion uvfor(const Block& def, uint face, int atlas_size) {
float uvsize = 1.0f / (float)atlas_size;
float us = 0.0097;
float us = 0.0097; // TODO: replace with correct calculations (including 0.36)
const uint id = def.textureFaces[face];
float u = (id % atlas_size) * uvsize;
float v = 1.0f - (id / atlas_size + 1) * uvsize;