VTK  9.3.20240424
Typedefs | Functions | Variables
vtkGLTFUtils Namespace Reference

Typedefs

using ChunkInfoType = std::pair< std::string, uint32_t >
 

Functions

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 ExtractGLBFileInformation (vtkResourceStream *stream, uint32_t &version, uint32_t &fileLength, uint32_t glbStart, std::vector< vtkGLTFUtils::ChunkInfoType > &chunkInfo)
 Extract all header information from a binary glTF file.
 
bool GetIntValue (const nlohmann::json &root, const std::string &key, int &value)
 Get int 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.
 
bool GetDoubleValue (const nlohmann::json &root, const std::string &key, double &value)
 Get double value from Json variable, with existence and type checks.
 
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.
 
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.
 
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.
 
bool CheckVersion (const nlohmann::json &glTFAsset)
 Check document version.
 
bool GetBinaryBufferFromUri (const std::string &uri, vtkURILoader *loader, std::vector< char > &buffer, size_t bufferSize)
 Load binary buffer from uri information.
 

Variables

static constexpr uint32_t GLBWordSize = 4
 
static constexpr uint32_t GLBHeaderSize = 12
 
static constexpr uint32_t GLBChunkHeaderSize = 8
 
static constexpr uint32_t GLBVersion = 2
 

Typedef Documentation

◆ ChunkInfoType

using vtkGLTFUtils::ChunkInfoType = typedef std::pair<std::string, uint32_t>

Definition at line 33 of file vtkGLTFUtils.h.

Function Documentation

◆ ValidateGLBFile()

bool vtkGLTFUtils::ValidateGLBFile ( const std::string &  magic,
uint32_t  version,
uint32_t  fileLength,
std::vector< vtkGLTFUtils::ChunkInfoType chunkInfo 
)

Checks various binary glTF elements for validity.

Checks: version, file length, JSON chunk presence as first chunk, chunk type name size, chunk data size

◆ ExtractGLBFileInformation()

bool vtkGLTFUtils::ExtractGLBFileInformation ( vtkResourceStream stream,
uint32_t &  version,
uint32_t &  fileLength,
uint32_t  glbStart,
std::vector< vtkGLTFUtils::ChunkInfoType > &  chunkInfo 
)

Extract all header information from a binary glTF file.

◆ GetIntValue()

bool vtkGLTFUtils::GetIntValue ( const nlohmann::json &  root,
const std::string &  key,
int &  value 
)

Get int value from Json variable, with existence and type checks.

◆ GetUIntValue()

bool vtkGLTFUtils::GetUIntValue ( const nlohmann::json &  root,
const std::string &  key,
unsigned int &  value 
)

Get int value from Json variable, with existence and type checks.

◆ GetDoubleValue()

bool vtkGLTFUtils::GetDoubleValue ( const nlohmann::json &  root,
const std::string &  key,
double &  value 
)

Get double value from Json variable, with existence and type checks.

◆ GetStringValue()

bool vtkGLTFUtils::GetStringValue ( const nlohmann::json &  root,
const std::string &  key,
std::string &  value 
)

Get string value from Json variable, with existence and type checks.

◆ GetBoolValue()

bool vtkGLTFUtils::GetBoolValue ( const nlohmann::json &  root,
const std::string &  key,
bool &  value 
)

Get bool value from Json variable, with existence and type checks.

◆ GetIntArray()

bool vtkGLTFUtils::GetIntArray ( const nlohmann::json &  root,
const std::string &  key,
std::vector< int > &  value 
)

Get int array from Json variable, with existence and type checks.

◆ GetUIntArray()

bool vtkGLTFUtils::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.

◆ GetFloatArray()

bool vtkGLTFUtils::GetFloatArray ( const nlohmann::json &  root,
const std::string &  key,
std::vector< float > &  value 
)

Get float array from Json variable, with existence and type checks.

◆ GetDoubleArray()

bool vtkGLTFUtils::GetDoubleArray ( const nlohmann::json &  root,
const std::string &  key,
std::vector< double > &  value 
)

Get double array from Json variable, with existence and type checks.

◆ CheckVersion()

bool vtkGLTFUtils::CheckVersion ( const nlohmann::json &  glTFAsset)

Check document version.

Currently supporting glTF 2.0 only.

◆ GetBinaryBufferFromUri()

bool vtkGLTFUtils::GetBinaryBufferFromUri ( const std::string &  uri,
vtkURILoader loader,
std::vector< char > &  buffer,
size_t  bufferSize 
)

Load binary buffer from uri information.

Uri can be a base 64 data-uri or file path.

Variable Documentation

◆ GLBWordSize

constexpr uint32_t vtkGLTFUtils::GLBWordSize = 4
staticconstexpr

Definition at line 35 of file vtkGLTFUtils.h.

◆ GLBHeaderSize

constexpr uint32_t vtkGLTFUtils::GLBHeaderSize = 12
staticconstexpr

Definition at line 36 of file vtkGLTFUtils.h.

◆ GLBChunkHeaderSize

constexpr uint32_t vtkGLTFUtils::GLBChunkHeaderSize = 8
staticconstexpr

Definition at line 37 of file vtkGLTFUtils.h.

◆ GLBVersion

constexpr uint32_t vtkGLTFUtils::GLBVersion = 2
staticconstexpr

Definition at line 38 of file vtkGLTFUtils.h.