As I said this option is fast and simple. The only real advantage would be offered by option (1), where you can mix and match different Producers (or Builders ) without the user knowing anything about different model/texture/sound types. This would also prevent different inconsistent Loader classes, since the usage pattern is given by the API (the actual XXXFactory) and all concrete implementations are forced to use the interface offered by the SPI.
Yes, it’s possible to use getResource() to retrieve an URL and pass it to TextureStreamLocatorURL, but this won’t deal with the structure of the classpath (multiple jars/directories).Since it is easy to write an own TextureStreamLocatorClasspath, that overcomes this, I think it would be beneficial to adapt that scheme with other loaders, too.
And org.xith3d.loaders.base.Loader has six methods to load. three to load the file as a Model and three to load it as a Scene. One of each three takes an InputStream, which enables you to easily load from classpath. It is up to the loader implementer to corretly implement these methods.
At this point a general ResourceLocator could tighten the interface, since the InputStream retrieval is shifted to the ResourceLocator, so only resource names are needed to load a resource. Also it would allow for further optimization of the name<->stream mapping and resource access would be generalized for all kind of Loaders.
btw. I don’t like the naming of Factory or Producer or things like that for Loaders. They don’t produce a model, but load it
Yeah Producer is wrong, Builder would be better, since it would be an (simplistic) incarnation of the builder pattern. For me however everything that creates an Object is a Factory…
Anyway Loader is fine. They should just all behave the same and share as most base functionality as possible.
Mathias