MCPcopy Create free account
hub / github.com/Kitware/VTK / LoadTextureInfo

Method LoadTextureInfo

IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx:1263–1300  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1261
1262//------------------------------------------------------------------------------
1263bool vtkGLTFDocumentLoaderInternals::LoadTextureInfo(
1264 const nlohmann::json& root, vtkGLTFDocumentLoader::TextureInfo& textureInfo)
1265{
1266 if (root.empty() || !root.is_object())
1267 {
1268 vtkErrorWithObjectMacro(this->Self, "Invalid textureInfo object");
1269 return false;
1270 }
1271 textureInfo.Index = -1;
1272 if (!vtkGLTFUtils::GetIntValue(root, "index", textureInfo.Index))
1273 {
1274 vtkErrorWithObjectMacro(this->Self, "Invalid textureInfo.index value");
1275 return false;
1276 }
1277 if (textureInfo.Index < 0)
1278 {
1279 vtkErrorWithObjectMacro(this->Self, "Invalid textureInfo.index value");
1280 return false;
1281 }
1282
1283 textureInfo.TexCoord = 0;
1284 vtkGLTFUtils::GetIntValue(root, "texCoord", textureInfo.TexCoord);
1285
1286 auto extRootIt = root.find("extensions");
1287 if (extRootIt != root.end())
1288 {
1289 auto texTrRootIt = extRootIt.value().find("KHR_texture_transform");
1290 if (texTrRootIt != extRootIt.value().end())
1291 {
1292 vtkGLTFUtils::GetDoubleArray(texTrRootIt.value(), "scale", textureInfo.Scale);
1293 vtkGLTFUtils::GetDoubleArray(texTrRootIt.value(), "offset", textureInfo.Offset);
1294 vtkGLTFUtils::GetDoubleValue(texTrRootIt.value(), "rotation", textureInfo.Rotation);
1295 vtkGLTFUtils::GetIntValue(texTrRootIt.value(), "texCoord", textureInfo.TexCoord);
1296 }
1297 }
1298
1299 return true;
1300}
1301
1302//------------------------------------------------------------------------------
1303bool vtkGLTFDocumentLoaderInternals::LoadModelMetaData(

Callers 1

LoadMaterialMethod · 0.95

Calls 7

GetIntValueFunction · 0.70
GetDoubleArrayFunction · 0.70
GetDoubleValueFunction · 0.70
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected