GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
tinygltf::TinyGLTF Class Reference

#include <tiny_gltf.h>

Public Member Functions

 TinyGLTF ()
 ~TinyGLTF ()
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 (Model *model, std::ostream &stream, bool prettyPrint, bool writeBinary)
bool WriteGltfSceneToFile (Model *model, const std::string &filename, bool embedImages, bool embedBuffers, bool prettyPrint, bool writeBinary)
void SetImageLoader (LoadImageDataFunction LoadImageData, void *user_data)
void RemoveImageLoader ()
void SetImageWriter (WriteImageDataFunction WriteImageData, void *user_data)
void SetFsCallbacks (FsCallbacks callbacks)
void SetSerializeDefaultValues (const bool enabled)
bool GetSerializeDefaultValues () const
void SetStoreOriginalJSONForExtrasAndExtensions (const bool enabled)
bool GetStoreOriginalJSONForExtrasAndExtensions () const
void SetPreserveImageChannels (bool onoff)
bool GetPreserveImageChannels () const

Detailed Description

glTF Parser/Serialier context.

Constructor & Destructor Documentation

◆ TinyGLTF()

tinygltf::TinyGLTF::TinyGLTF ( )
inline

◆ ~TinyGLTF()

tinygltf::TinyGLTF::~TinyGLTF ( )
inline

Member Function Documentation

◆ 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); 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.

Here is the caller graph for this function:

◆ 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); 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.

Here is the caller graph for this function:

◆ 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

◆ SetPreserveImageChannels()

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

Specify whether preserve image channales when loading images or not. (Not effective when the user suppy 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 helpfull 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.

◆ WriteGltfSceneToFile()

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

Write glTF to file.

Here is the caller graph for this function:

◆ WriteGltfSceneToStream()

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

Write glTF to stream, buffers and images will be embeded

Here is the caller graph for this function:

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