Optimize: Improved startup performance with a lot of models
Restructured model skin registration to avoid unnecessary repeat memory (re)allocations when a skin file path is defined using a path in the model definition (rather than in the model itself). Which, unlike the rest of the model setup, must be done for each definition referencing a given model.
Previously this worked as follows: 1) Append a new skin path the model's skin index. 2) Search the file system for the resource file. 3) Register the texture.
If after all this work, the texture is found to have already been assigned to the model - the existing texture is returned and the model's skin index restored to the previous state.
This process was inverted whereby the search occurs first and only when we are sure we've found a new texture is the model skin index modified.
Optimize: Improved startup performance with a lot of models
Restructured model skin registration to avoid unnecessary repeat
memory (re)allocations when a skin file path is defined using a
path in the model definition (rather than in the model itself).
Which, unlike the rest of the model setup, must be done for each
definition referencing a given model.
Previously this worked as follows:
1) Append a new skin path the model's skin index.
2) Search the file system for the resource file.
3) Register the texture.
If after all this work, the texture is found to have already been
assigned to the model - the existing texture is returned and the
model's skin index restored to the previous state.
This process was inverted whereby the search occurs first and only
when we are sure we've found a new texture is the model skin index
modified.