Conscience Core
Public Member Functions | List of all members
tinygltf::TinyGLTF Class Reference

#include <tiny_gltf.h>

Public Member Functions

 TinyGLTF ()
 
 ~TinyGLTF ()=default
 
bool LoadASCIIFromFile (Model *model, std::string *err, std::string *warn, const std::string &filename, unsigned int check_sections=REQUIRE_VERSION)
 
bool LoadASCIIFromString (Model *model, std::string *err, std::string *warn, const char *str, const unsigned int length, const std::string &base_dir, unsigned int check_sections=REQUIRE_VERSION)
 
bool LoadBinaryFromFile (Model *model, std::string *err, std::string *warn, const std::string &filename, unsigned int check_sections=REQUIRE_VERSION)
 
bool LoadBinaryFromMemory (Model *model, std::string *err, std::string *warn, const unsigned char *bytes, const unsigned int length, const std::string &base_dir="", unsigned int check_sections=REQUIRE_VERSION)
 
bool WriteGltfSceneToStream (const Model *model, std::ostream &stream, bool prettyPrint, bool writeBinary)
 
bool WriteGltfSceneToFile (const Model *model, const std::string &filename, bool embedImages, bool embedBuffers, bool prettyPrint, bool writeBinary)
 
void SetParseStrictness (ParseStrictness strictness)
 
void SetImageLoader (LoadImageDataFunction LoadImageData, void *user_data)
 
void RemoveImageLoader ()
 
void SetImageWriter (WriteImageDataFunction WriteImageData, void *user_data)
 
void SetURICallbacks (URICallbacks callbacks)
 
void SetFsCallbacks (FsCallbacks callbacks)
 
void SetSerializeDefaultValues (const bool enabled)
 
bool GetSerializeDefaultValues () const
 
void SetStoreOriginalJSONForExtrasAndExtensions (const bool enabled)
 
bool GetStoreOriginalJSONForExtrasAndExtensions () const
 
void SetPreserveImageChannels (bool onoff)
 
void SetMaxExternalFileSize (size_t max_bytes)
 
size_t GetMaxExternalFileSize () const
 
bool GetPreserveImageChannels () const
 

Detailed Description

glTF Parser/Serializer context.

Constructor & Destructor Documentation

◆ TinyGLTF()

tinygltf::TinyGLTF::TinyGLTF ( )

◆ ~TinyGLTF()

tinygltf::TinyGLTF::~TinyGLTF ( )
default

Member Function Documentation

◆ GetMaxExternalFileSize()

size_t tinygltf::TinyGLTF::GetMaxExternalFileSize ( ) const
inline

◆ GetPreserveImageChannels()

bool tinygltf::TinyGLTF::GetPreserveImageChannels ( ) const
inline

◆ GetSerializeDefaultValues()

bool tinygltf::TinyGLTF::GetSerializeDefaultValues ( ) const
inline

◆ GetStoreOriginalJSONForExtrasAndExtensions()

bool tinygltf::TinyGLTF::GetStoreOriginalJSONForExtrasAndExtensions ( ) const
inline

◆ LoadASCIIFromFile()

bool tinygltf::TinyGLTF::LoadASCIIFromFile ( Model model,
std::string *  err,
std::string *  warn,
const std::string &  filename,
unsigned int  check_sections = REQUIRE_VERSION 
)

Loads glTF ASCII asset from a file. Set warning message to warn for example it fails to load asserts. Returns false and set error string to err if there's an error.

◆ LoadASCIIFromString()

bool tinygltf::TinyGLTF::LoadASCIIFromString ( Model model,
std::string *  err,
std::string *  warn,
const char *  str,
const unsigned int  length,
const std::string &  base_dir,
unsigned int  check_sections = REQUIRE_VERSION 
)

Loads glTF ASCII asset from string(memory). length = strlen(str); base_dir is a search path of glTF asset(e.g. images). Path Must be an expanded path (e.g. no tilde(~), no environment variables). Set warning message to warn for example it fails to load asserts. Returns false and set error string to err if there's an error.

◆ LoadBinaryFromFile()

bool tinygltf::TinyGLTF::LoadBinaryFromFile ( Model model,
std::string *  err,
std::string *  warn,
const std::string &  filename,
unsigned int  check_sections = REQUIRE_VERSION 
)

Loads glTF binary asset from a file. Set warning message to warn for example it fails to load asserts. Returns false and set error string to err if there's an error.

◆ LoadBinaryFromMemory()

bool tinygltf::TinyGLTF::LoadBinaryFromMemory ( Model model,
std::string *  err,
std::string *  warn,
const unsigned char *  bytes,
const unsigned int  length,
const std::string &  base_dir = "",
unsigned int  check_sections = REQUIRE_VERSION 
)

Loads glTF binary asset from memory. length = strlen(str); base_dir is a search path of glTF asset(e.g. images). Path Must be an expanded path (e.g. no tilde(~), no environment variables). Set warning message to warn for example it fails to load asserts. Returns false and set error string to err if there's an error.

◆ RemoveImageLoader()

void tinygltf::TinyGLTF::RemoveImageLoader ( )

Unset(remove) callback of loading image data

◆ SetFsCallbacks()

void tinygltf::TinyGLTF::SetFsCallbacks ( FsCallbacks  callbacks)

Set callbacks to use for filesystem (fs) access and their user data

◆ SetImageLoader()

void tinygltf::TinyGLTF::SetImageLoader ( LoadImageDataFunction  LoadImageData,
void *  user_data 
)

Set callback to use for loading image data

◆ SetImageWriter()

void tinygltf::TinyGLTF::SetImageWriter ( WriteImageDataFunction  WriteImageData,
void *  user_data 
)

Set callback to use for writing image data

◆ SetMaxExternalFileSize()

void tinygltf::TinyGLTF::SetMaxExternalFileSize ( size_t  max_bytes)
inline

Set maximum allowed external file size in bytes. Default: 2GB Only effective for built-in ReadWholeFileFunction FS function.

◆ SetParseStrictness()

void tinygltf::TinyGLTF::SetParseStrictness ( ParseStrictness  strictness)

Sets the parsing strictness.

◆ SetPreserveImageChannels()

void tinygltf::TinyGLTF::SetPreserveImageChannels ( bool  onoff)
inline

Specify whether preserve image channels when loading images or not. (Not effective when the user supplies their own LoadImageData callbacks)

◆ SetSerializeDefaultValues()

void tinygltf::TinyGLTF::SetSerializeDefaultValues ( const bool  enabled)
inline

Set serializing default values(default = false). When true, default values are force serialized to .glTF. This may be helpful if you want to serialize a full description of glTF data.

TODO(LTE): Supply parsing option as function arguments to LoadASCIIFromFile() and others, not by a class method

◆ SetStoreOriginalJSONForExtrasAndExtensions()

void tinygltf::TinyGLTF::SetStoreOriginalJSONForExtrasAndExtensions ( const bool  enabled)
inline

Store original JSON string for extras and extensions. This feature will be useful when the user want to reconstruct custom data structure from JSON string.

◆ SetURICallbacks()

void tinygltf::TinyGLTF::SetURICallbacks ( URICallbacks  callbacks)

Set callbacks to use for URI encoding and decoding and their user data

◆ WriteGltfSceneToFile()

bool tinygltf::TinyGLTF::WriteGltfSceneToFile ( const Model model,
const std::string &  filename,
bool  embedImages,
bool  embedBuffers,
bool  prettyPrint,
bool  writeBinary 
)

Write glTF to file.

◆ WriteGltfSceneToStream()

bool tinygltf::TinyGLTF::WriteGltfSceneToStream ( const Model model,
std::ostream &  stream,
bool  prettyPrint,
bool  writeBinary 
)

Write glTF to stream, buffers and images will be embedded


The documentation for this class was generated from the following file: