Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store base directory in Model #500

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,9 @@ class Model {

bool operator==(const Model &) const;

// The base directory of the glTF model file
std::string baseDir;

std::vector<Accessor> accessors;
std::vector<Animation> animations;
std::vector<Buffer> buffers;
Expand Down Expand Up @@ -2068,7 +2071,8 @@ bool Mesh::operator==(const Mesh &other) const {
this->primitives == other.primitives;
}
bool Model::operator==(const Model &other) const {
return this->accessors == other.accessors &&
return this->baseDir == other.baseDir &&
this->accessors == other.accessors &&
this->animations == other.animations && this->asset == other.asset &&
this->buffers == other.buffers &&
this->bufferViews == other.bufferViews &&
Expand Down Expand Up @@ -6119,6 +6123,9 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn,
// Reset the model
(*model) = Model();

// Store the base directory from which the model is loaded
model->baseDir = base_dir;

// 1. Parse Asset
{
detail::json_const_iterator it;
Expand Down
Loading