feat: different textures/atlases support

This commit is contained in:
MihailRis 2025-12-20 22:21:00 +03:00
parent 27dd8f6375
commit b0ecfd5add
3 changed files with 110 additions and 44 deletions

View file

@ -40,11 +40,17 @@ static int l_set_faces(lua::State* L) {
if (auto wrapper = renderer->blockWraps->get(lua::tointeger(L, 1))) {
for (int i = 0; i < wrapper->textureFaces.size(); i++) {
if (lua::isnil(L, 2 + i)) {
wrapper->cullingBits &= ~(1 << i);
wrapper->textureFaces[i] = "";
if (wrapper->cullingBits & (1 << i)) {
wrapper->cullingBits &= ~(1 << i);
wrapper->textureFaces[i] = "";
wrapper->dirtySides |= (1 << i);
}
} else {
wrapper->cullingBits |= (1 << i);
wrapper->textureFaces[i] = lua::require_string(L, 2 + i);
auto texture = lua::require_string(L, 2 + i);;
if ((wrapper->cullingBits & (1 << i)) == 0x0 || wrapper->textureFaces[i] != texture) {
wrapper->cullingBits |= (1 << i);
wrapper->textureFaces[i] = texture;
}
}
}
}