Properly clear the model before loading#493
Conversation
|
I have no idea why I coded manually initialize each members there. I think it is better to use default constructor to initialize Model. How do you think? |
|
Maybe that was the original intention here? |
|
I just followed the existing code and completed it. But I can simply default construct a new model, that makes the entire block into a one-liner. |
1cc6477 to
fb58f88
Compare
|
Done |
Memory efficiency was not considered. TinyGLTF was first written for C++03, and I think at that time I don't trust myself I put all initializations in the constructor. Now, in C++11, we can initialize member variable in member declaration, so its safe to assume a default constructor initializes all members correctly. |
|
Thanks! Merged! |
Not all, but only some, model fields were cleared before parsing.
As one can pass an existing model to the load functions, we should make sure to completely wipe the model before parsing.