From eb011068c01986fb7172ee2bcad67fd43a3013f4 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 23 Feb 2019 21:15:45 +0100 Subject: [PATCH] Added function to easily access texture coordinate set index on a texture parameter --- tiny_gltf.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tiny_gltf.h b/tiny_gltf.h index f6181c4..c602e0d 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -380,6 +380,17 @@ struct Parameter { return -1; } + /// Return the index of a texture coordinate set if this Parameter is a texture map. + /// Returned value is only valid if the parameter represent a texture from a + /// material + int TextureTexCoord() const { + const auto it = json_double_value.find("texCoord"); + if (it != std::end(json_double_value)) { + return int(it->second); + } + return 0; + } + /// Material factor, like the roughness or metalness of a material /// Returned value is only valid if the parameter represent a texture from a /// material