fix vcm texture sides

This commit is contained in:
MihailRis 2026-06-01 00:08:13 +03:00
parent 1300488a82
commit 38bebac37e
3 changed files with 23 additions and 23 deletions

View file

@ -55,12 +55,12 @@ model::Model VcmModel::squashed() const {
} }
static const std::unordered_map<std::string, int> side_indices { static const std::unordered_map<std::string, int> side_indices {
{"north", 0}, {"east", 0},
{"south", 1}, {"west", 1},
{"top", 2}, {"bottom", 2},
{"bottom", 3}, {"top", 3},
{"west", 4}, {"south", 4},
{"east", 5}, {"north", 5},
}; };
static bool to_boolean(const xml::Attribute& attr) { static bool to_boolean(const xml::Attribute& attr) {

View file

@ -136,18 +136,18 @@ void Mesh::addBox(
const bool enabledSides[6], const bool enabledSides[6],
const glm::mat4& transform const glm::mat4& transform
) { ) {
if (enabledSides[0]) // north if (enabledSides[0]) // east
addPlane(pos+Z*size, X*size, Y*size, Z, uvs[0], transform); addPlane(pos-X*size, Z*size, Y*size, -X, uvs[0], transform);
if (enabledSides[1]) // south if (enabledSides[1]) // west
addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[1], transform); addPlane(pos+X*size, -Z*size, Y*size, X, uvs[1] * glm::vec2(-1, 1), transform);
if (enabledSides[2]) // top if (enabledSides[2]) // bottom
addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[2] * glm::vec2(-1), transform); addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[2], transform);
if (enabledSides[3]) // bottom if (enabledSides[3]) // top
addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[3] * glm::vec2(-1, 1), transform); addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[3] * glm::vec2(-1, 1), transform);
if (enabledSides[4]) // west if (enabledSides[4]) // south
addPlane(pos+X*size, -Z*size, Y*size, X, uvs[4], transform); addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[4], transform);
if (enabledSides[5]) // east if (enabledSides[5]) // north
addPlane(pos-X*size, Z*size, Y*size, -X, uvs[5] * glm::vec2(-1, 1), transform); addPlane(pos+Z*size, X*size, Y*size, Z, uvs[5] * glm::vec2(-1, 1), transform);
} }
void Mesh::scale(const glm::vec3& size) { void Mesh::scale(const glm::vec3& size) {

View file

@ -83,12 +83,12 @@ static util::TextureRegion determine_texture_region(
const Assets& assets, const std::string& texture const Assets& assets, const std::string& texture
) { ) {
static std::array<std::string, 6> faces { static std::array<std::string, 6> faces {
"blocks:dbg_north",
"blocks:dbg_south",
"blocks:dbg_top",
"blocks:dbg_bottom",
"blocks:dbg_west",
"blocks:dbg_east", "blocks:dbg_east",
"blocks:dbg_west",
"blocks:dbg_bottom",
"blocks:dbg_top",
"blocks:dbg_south",
"blocks:dbg_north",
}; };
if (texture.length() < 2 || texture.at(0) != '$') { if (texture.length() < 2 || texture.at(0) != '$') {