summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 01:40:01 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 01:40:01 +0200
commitc0b81150298ce9f2f21da42f26a57fe59a93bb77 (patch)
tree15304e4c36093a5beb524e67c976a241c5c556f3 /src/AssetManager.cpp
parentImplemented texture atlas (diff)
downloadAltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar.gz
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar.bz2
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar.lz
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar.xz
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.tar.zst
AltCraft-c0b81150298ce9f2f21da42f26a57fe59a93bb77.zip
Diffstat (limited to 'src/AssetManager.cpp')
-rw-r--r--src/AssetManager.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index 9e360c0..0579b5d 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -366,10 +366,10 @@ void AssetManager::ParseBlockModels() {
break;
}
parsedFace.transform = faceTransform;
- glm::vec4 texture;
+ TextureCoord texture;
textureName = face.second.texture;
if (model.Textures.empty()) {
- texture = GetTextureByAssetName("minecraft/texture/blocks/tnt_side");
+ texture = GetTexture("minecraft/texture/blocks/tnt_side");
}
else {
while (textureName[0] == '#') {
@@ -378,7 +378,7 @@ void AssetManager::ParseBlockModels() {
textureName = textureIt != model.Textures.end() ? textureIt->second : "minecraft/texture/blocks/tnt_side";
}
textureName.insert(0, "minecraft/textures/");
- texture = GetTextureByAssetName(textureName);
+ texture = GetTexture(textureName);
if (!(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,16,0,16 }) && !(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,0,0,0 })
&& !(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,0,16,16 })) {
@@ -392,13 +392,17 @@ void AssetManager::ParseBlockModels() {
h /= 16.0;
double X = texture.x;
double Y = texture.y;
- double W = texture.z;
- double H = texture.w;
+ double W = texture.w;
+ double H = texture.h;
- texture = glm::vec4{ X + x * W, Y + y * H, w * W , h * H };
+ texture.x = X + x * W;
+ texture.y = Y + y * H;
+ texture.w = w * W;
+ texture.h = h * H;
}
}
- parsedFace.texture = texture;
+ parsedFace.texture = glm::vec4{ texture.x,texture.y,texture.w,texture.h };
+ parsedFace.layer = texture.layer;
if (face.second.tintIndex)
parsedFace.color = glm::vec3(0.275, 0.63, 0.1);
else