MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / LoadBinaryFromFile

Method LoadBinaryFromFile

external/tinygltf/tiny_gltf.h:6928–6962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6926}
6927
6928bool TinyGLTF::LoadBinaryFromFile(Model *model, std::string *err,
6929 std::string *warn,
6930 const std::string &filename,
6931 unsigned int check_sections) {
6932 std::stringstream ss;
6933
6934 if (fs.ReadWholeFile == nullptr) {
6935 // Programmer error, assert() ?
6936 ss << "Failed to read file: " << filename
6937 << ": one or more FS callback not set" << std::endl;
6938 if (err) {
6939 (*err) = ss.str();
6940 }
6941 return false;
6942 }
6943
6944 std::vector<unsigned char> data;
6945 std::string fileerr;
6946 bool fileread = fs.ReadWholeFile(&data, &fileerr, filename, fs.user_data);
6947 if (!fileread) {
6948 ss << "Failed to read file: " << filename << ": " << fileerr << std::endl;
6949 if (err) {
6950 (*err) = ss.str();
6951 }
6952 return false;
6953 }
6954
6955 std::string basedir = GetBaseDir(filename);
6956
6957 bool ret = LoadBinaryFromMemory(model, err, warn, &data.at(0),
6958 static_cast<unsigned int>(data.size()),
6959 basedir, check_sections);
6960
6961 return ret;
6962}
6963
6964///////////////////////
6965// GLTF Serialization

Callers 1

load_modelFunction · 0.80

Calls 3

GetBaseDirFunction · 0.85
atMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected