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

Method LoadTexture

IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx:1238–1260  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1236
1237//------------------------------------------------------------------------------
1238bool vtkGLTFDocumentLoaderInternals::LoadTexture(
1239 const nlohmann::json& root, vtkGLTFDocumentLoader::Texture& texture)
1240{
1241 /**
1242 * This loads a glTF object from a Json value, no files are loaded by this function.
1243 * Apart from the 'name' field, glTF texture objects contain two integer indices: one to an
1244 * image object (the object that references to an actual image file), and one to a sampler
1245 * object (which specifies filter and wrapping options for a texture).
1246 */
1247 if (root.empty() || !root.is_object())
1248 {
1249 vtkErrorWithObjectMacro(this->Self, "Invalid texture object.");
1250 return false;
1251 }
1252 texture.Sampler = -1;
1253 vtkGLTFUtils::GetIntValue(root, "sampler", texture.Sampler);
1254 texture.Source = -1;
1255 vtkGLTFUtils::GetIntValue(root, "source", texture.Source);
1256 texture.Name = "";
1257 vtkGLTFUtils::GetStringValue(root, "name", texture.Name);
1258
1259 return true;
1260}
1261
1262//------------------------------------------------------------------------------
1263bool vtkGLTFDocumentLoaderInternals::LoadTextureInfo(

Callers 1

LoadModelMetaDataMethod · 0.95

Calls 3

GetIntValueFunction · 0.70
GetStringValueFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected