mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
fix vcm texture sides
This commit is contained in:
parent
1300488a82
commit
38bebac37e
3 changed files with 23 additions and 23 deletions
|
|
@ -55,12 +55,12 @@ model::Model VcmModel::squashed() const {
|
|||
}
|
||||
|
||||
static const std::unordered_map<std::string, int> side_indices {
|
||||
{"north", 0},
|
||||
{"south", 1},
|
||||
{"top", 2},
|
||||
{"bottom", 3},
|
||||
{"west", 4},
|
||||
{"east", 5},
|
||||
{"east", 0},
|
||||
{"west", 1},
|
||||
{"bottom", 2},
|
||||
{"top", 3},
|
||||
{"south", 4},
|
||||
{"north", 5},
|
||||
};
|
||||
|
||||
static bool to_boolean(const xml::Attribute& attr) {
|
||||
|
|
|
|||
|
|
@ -136,18 +136,18 @@ void Mesh::addBox(
|
|||
const bool enabledSides[6],
|
||||
const glm::mat4& transform
|
||||
) {
|
||||
if (enabledSides[0]) // north
|
||||
addPlane(pos+Z*size, X*size, Y*size, Z, uvs[0], transform);
|
||||
if (enabledSides[1]) // south
|
||||
addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[1], transform);
|
||||
if (enabledSides[2]) // top
|
||||
addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[2] * glm::vec2(-1), transform);
|
||||
if (enabledSides[3]) // bottom
|
||||
addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[3] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[4]) // west
|
||||
addPlane(pos+X*size, -Z*size, Y*size, X, uvs[4], transform);
|
||||
if (enabledSides[5]) // east
|
||||
addPlane(pos-X*size, Z*size, Y*size, -X, uvs[5] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[0]) // east
|
||||
addPlane(pos-X*size, Z*size, Y*size, -X, uvs[0], transform);
|
||||
if (enabledSides[1]) // west
|
||||
addPlane(pos+X*size, -Z*size, Y*size, X, uvs[1] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[2]) // bottom
|
||||
addPlane(pos-Y*size, X*size, Z*size, -Y, uvs[2], transform);
|
||||
if (enabledSides[3]) // top
|
||||
addPlane(pos+Y*size, X*size, -Z*size, Y, uvs[3] * glm::vec2(-1, 1), transform);
|
||||
if (enabledSides[4]) // south
|
||||
addPlane(pos-Z*size, -X*size, Y*size, -Z, uvs[4], transform);
|
||||
if (enabledSides[5]) // north
|
||||
addPlane(pos+Z*size, X*size, Y*size, Z, uvs[5] * glm::vec2(-1, 1), transform);
|
||||
}
|
||||
|
||||
void Mesh::scale(const glm::vec3& size) {
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ static util::TextureRegion determine_texture_region(
|
|||
const Assets& assets, const std::string& texture
|
||||
) {
|
||||
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_west",
|
||||
"blocks:dbg_bottom",
|
||||
"blocks:dbg_top",
|
||||
"blocks:dbg_south",
|
||||
"blocks:dbg_north",
|
||||
};
|
||||
|
||||
if (texture.length() < 2 || texture.at(0) != '$') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue