Add a mechanism for caching textures loaded by the JSON loader

Since it looks like support for configurable texture loading (issue #3412) will take some time, I am proposing here a simple addition that caches loaded textures in loaders. The mechanism is optional and for now, it requires setting `jsonLoader.textureCache = {}` to enable it. Feel free to refactor this code to change the interface.

Use case: I have lots of models loaded from JSON files which all share the same texture atlas. The models are uploaded by users, so I can't create the materials manually. Without caching the textures, the loader would load the same image multiple times and waste bandwidth and GPU memory.