From 55a2d7f47203920c6943882b33e95c5c8e395d57 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Tue, 28 Nov 2023 07:51:40 -0500 Subject: [PATCH] Verbose scale --- source/Irrlicht/CB3DJSONMeshFileLoader.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp index 5c7c3391..e17f9ecc 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp @@ -326,6 +326,35 @@ std::tuple CB3DJSONMeshFileLoader::readChunkTEXS() { return {false, "Malformed \"pos\" in TEXS block index (" + std::to_string(index) + "). Must be an array with 2 numbers."}; } + //* Scale. + if (t.contains("scale") && t["scale"].is_array()) { + + irr::core::vector2df scale {0,0}; + + auto scaleSuccess = grabVec2f(t, "scale", scale); + + // Something went horribly wrong. + if (!std::get<0>(scaleSuccess)) { + + return {false, "TEXS: " + std::get<1>(scaleSuccess)}; + } + + // Success. + B3DTexture.Xscale = scale.X; + B3DTexture.Yscale = scale.Y; + + } else { + + if (t.contains("scale") && !t["scale"].is_array()) { + return {false, "\"scale\" in TEXS block index(" + std::to_string(index)+") is not an array."}; + } + + if (!t.contains("scale") ) { + return {false, "\"scale\" in TEXS block index(" + std::to_string(index)+") is missing."}; + } + + return {false, "Malformed \"scale\" in TEXS block index (" + std::to_string(index) + "). Must be an array with 2 numbers."}; + }