I am expanding my read ahead to include textures in addition to .js files with in-line geometry. It is going to split the fetch of the file from the creation of the texture. When a TOB generated .js file is dynamically loaded, it will call a function matReadAhead() in the file. It will create a QI.TextureBuffer's for each texture. When the scene asks for the materials, the applyWhenReady() will be called. Hopefully, the fetch of the image file has already been performed when the .js was being fetched in advance as well.
Once the fetch is complete, I will be executing a BABYLON.Texture constructor() passing the buffer QI.TextureBuffer got. Texture passes the buffer to Engine.createTexture(), but it looks like it is only actually used when fromData is an Array. Isn't this test wrong?