summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-21 10:35:30 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-21 10:35:30 +0200
commit069c14067c9a88316a288eab1e97bd99a17910e6 (patch)
treea74ec293423078ae9471043b5bd4dd0ef5cce4f0 /src/AssetManager.cpp
parentMore correct face culling for rotated blocks (diff)
downloadAltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar.gz
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar.bz2
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar.lz
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar.xz
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.tar.zst
AltCraft-069c14067c9a88316a288eab1e97bd99a17910e6.zip
Diffstat (limited to '')
-rw-r--r--src/AssetManager.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index 9231bf3..6d0f33f 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -413,30 +413,36 @@ void ParseBlockModels() {
faceTransform = glm::translate(elementTransform, glm::vec3(0, 0, 0));
faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1.0f, 0, 0));
faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
+ faceTransform = glm::translate(faceTransform, glm::vec3(0.5f, 0.0f, 0.5f));
+ faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f));
+ faceTransform = glm::translate(faceTransform, glm::vec3(-0.5f, 0.0f, -0.5f));
break;
case FaceDirection::up:
faceTransform = glm::translate(elementTransform, glm::vec3(0.0f, 1.0f, 0.0f));
+ faceTransform = glm::translate(faceTransform, glm::vec3(0.5f, 0.0f, 0.5f));
+ faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f));
+ faceTransform = glm::translate(faceTransform, glm::vec3(-0.5f, 0.0f, -0.5f));
break;
case FaceDirection::north:
- faceTransform = glm::translate(elementTransform, glm::vec3(0, 0, 1));
+ faceTransform = glm::translate(elementTransform, glm::vec3(1, 0, 0));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
- faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1, 0, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1.0f));
break;
case FaceDirection::south:
- faceTransform = glm::translate(elementTransform, glm::vec3(1, 0, 0));
+ faceTransform = glm::translate(elementTransform, glm::vec3(0, 0, 1));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f));
+ faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
+ faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1, 0, 0.0f));
+ faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1.0f));
break;
- case FaceDirection::west:
+ case FaceDirection::east:
faceTransform = glm::translate(elementTransform, glm::vec3(1, 0, 0));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0, 0.0f, 1.0f));
faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f));
faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
break;
- case FaceDirection::east:
+ case FaceDirection::west:
faceTransform = glm::translate(elementTransform, glm::vec3(0, 0, 0));
faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0, 0.0f, 1.0f));
break;
@@ -537,9 +543,9 @@ BlockFaces &AssetManager::GetBlockModelByBlockId(BlockId block) {
if (model.y != 0) {
blockFaces.transform = glm::translate(blockFaces.transform, glm::vec3(0.5f, 0.0f, 0.5f));
- blockFaces.transform = glm::rotate(blockFaces.transform, glm::radians((float)model.y), glm::vec3(0.0f, 1.0f, 0.0f));
+ blockFaces.transform = glm::rotate(blockFaces.transform, glm::radians((float)model.y), glm::vec3(0.0f, -1.0f, 0.0f));
blockFaces.transform = glm::translate(blockFaces.transform, glm::vec3(-0.5f, 0.0f, -0.5f));
- transform = glm::rotate(transform, glm::radians((float)model.y), glm::vec3(0.0f, 1.0f, 0));
+ transform = glm::rotate(transform, glm::radians((float)model.y), glm::vec3(0.0f, -1.0f, 0));
}
if (model.x != 0) {