29#include <vtk_nlohmannjson.h>
30#include VTK_NLOHMANN_JSON(json.hpp)
49bool ValidateGLBFile(
const std::string& magic, uint32_t version, uint32_t fileLength,
50 std::vector<vtkGLTFUtils::ChunkInfoType> chunkInfo);
56 uint32_t& fileLength, std::vector<vtkGLTFUtils::ChunkInfoType>& chunkInfo);
61bool GetIntValue(
const nlohmann::json& root,
const std::string& key,
int& value);
66bool GetUIntValue(
const nlohmann::json& root,
const std::string& key,
unsigned int& value);
71bool GetDoubleValue(
const nlohmann::json& root,
const std::string& key,
double& value);
76bool GetStringValue(
const nlohmann::json& root,
const std::string& key, std::string& value);
81bool GetBoolValue(
const nlohmann::json& root,
const std::string& key,
bool& value);
86bool GetIntArray(
const nlohmann::json& root,
const std::string& key, std::vector<int>& value);
92 const nlohmann::json& root,
const std::string& key, std::vector<unsigned int>& value);
97bool GetFloatArray(
const nlohmann::json& root,
const std::string& key, std::vector<float>& value);
102bool GetDoubleArray(
const nlohmann::json& root,
const std::string& key, std::vector<double>& value);
119 std::vector<char>& buffer,
size_t bufferSize);
Helper functions for glTF parsing and validation.
std::string GetDataUriMimeType(const std::string &uri)
Extract MIME-Type from data-uri.
const uint32_t GLBChunkHeaderSize
bool GetDoubleValue(const nlohmann::json &root, const std::string &key, double &value)
Get double value from Json variable, with existence and type checks.
bool GetUIntValue(const nlohmann::json &root, const std::string &key, unsigned int &value)
Get int value from Json variable, with existence and type checks.
const uint32_t GLBHeaderSize
bool GetIntArray(const nlohmann::json &root, const std::string &key, std::vector< int > &value)
Get int array from Json variable, with existence and type checks.
const uint32_t GLBVersion
bool CheckVersion(const nlohmann::json &glTFAsset)
Check document version.
const uint32_t GLBWordSize
bool ValidateGLBFile(const std::string &magic, uint32_t version, uint32_t fileLength, std::vector< vtkGLTFUtils::ChunkInfoType > chunkInfo)
Checks various binary glTF elements for validity.
bool GetUIntArray(const nlohmann::json &root, const std::string &key, std::vector< unsigned int > &value)
Get int array from Json variable, with existence and type checks.
bool GetFloatArray(const nlohmann::json &root, const std::string &key, std::vector< float > &value)
Get float array from Json variable, with existence and type checks.
bool GetDoubleArray(const nlohmann::json &root, const std::string &key, std::vector< double > &value)
Get double array from Json variable, with existence and type checks.
std::string GetResourceFullPath(const std::string &resourcePath, const std::string &glTFFilePath)
Compute the path to a resource from its path as specified in the glTF file, and the glTF file's path.
bool GetIntValue(const nlohmann::json &root, const std::string &key, int &value)
Get int value from Json variable, with existence and type checks.
bool ExtractGLBFileInformation(const std::string &fileName, std::string &magic, uint32_t &version, uint32_t &fileLength, std::vector< vtkGLTFUtils::ChunkInfoType > &chunkInfo)
Extract all header information from a binary glTF file.
bool GetBinaryBufferFromUri(const std::string &uri, const std::string &glTFFileName, std::vector< char > &buffer, size_t bufferSize)
Load binary buffer from uri information.
std::pair< std::string, uint32_t > ChunkInfoType
bool GetStringValue(const nlohmann::json &root, const std::string &key, std::string &value)
Get string value from Json variable, with existence and type checks.
bool GetBoolValue(const nlohmann::json &root, const std::string &key, bool &value)
Get bool value from Json variable, with existence and type checks.