I think the basic loading method should accept InputStream (maybe DataInput because of it is interface and then app can provide custom DataInput impl), or probably Reader for text-based formats, probably alone with some resource-inclusion interface to obtain data for included files/textures/etc. Then File/URL/Resource/ByteArray methods are trivial.
In some cases (especially binary formats), it is sometimes not possible to parse model sequentially. One option is to read everything to memory and the work from there - but this is quite heavy solution. Having RandomAccessFile/MemoryMappedBuffer can be beneficial IMHO. Please also think about possibility of having internal format which is directly usable from disk - just pass pointer to part of memory mapped file to opengl call.
I think it would be great to separate model loader for 2 parts: a) engine-neutral file parser, that loads model to a kind of internal loader-specific format as fast as possible; b) scenegraph generator that will generate BranchGroup (or basically Node) from this internal format.
Trick is, that in most cases scenegraph classes are just perfect containers for geometry/appearance data. Having extra step in between requires duplication of classes, plus creates some overhead in loading if you just want to display something.
Please note that with Model/ModelPrototype, loader author is free to split it into two phases - it is just not required.
For me, this is becoming a layer on top of just rendering engine - this is more related to rendering/behavior loop. I see loader as just a loader, and animation mechanisms are much more format- and application specific. I think that multiple of animation mechanisms may co-exist and should be optional.
And this is I think the main difference between how we see the loaders. I suppose you want to have just geometry/appearance loading, with all the rest being loader specific (thus requiring application to know exact details of loader implementation). I would like to stretch common ground to basics of animation/particle effects/sounds. I think about some kind of model browser, in which you can plug ANY ModelLoader, browse model actions, execute them and hear them - instead of just looking at non-moving textured shape.
Please remember that any way, for specific application, everybody is free to use any interface/model loading/details/etc they want. We are just talking about lowest denominator, common interface, here.
So, for animations, I see something like this:
1 2 3 4 5 6
| AnimatedShape3D extends Shape3D { long getDuration(); void rewind(long pos); long play(long from, long to, boolean loop); void pause(); } |
With just one kind of animation per object ? Or do you plan to put all animations in one long sequence and control it by giving the correct time bounds ?