I need a model format to use for a test game, so I hunted around and found naj's Milkshape loader for LWJGL (posted on this board a while back).
Now its quite a nice piece of code, it loads and animates everything great but its a little too rigid. It'll load materials and their textures automagically, and animate it in a continuous loop. But this means that for a programmer trying to use it then they've got no control of the actual animation or of how the textures are loaded. Realistically I need to be able to pick and choose the animation frame, play subsections of the animation, reverse etc. This basically means I'm going to pull the timing section out of the model and have it set externally. Something like
model.setTime( currentAnimationTime );
model.draw();
Which seems the best way of doing it. But what about materials? Materials are automatically set in the .draw, but these might not always be needed (or wanted). I think the best way would be to just allow the programmer to tinker with the materials themselves after loading, and add a flag to the draw to enable/disable their usage.
Textures are slightly more tricky, as the actual texture loader only supports regular .bmp's and practically everyone here will have their own texture loader that they'd rather use. My first guess would be to define a TextureLoader interface, with callbacks for use while loading (basically converting a texture filename into a GL texture id). By converting the basic loader into using this (and having used by default) you can choose between the two.
So,
1. Anyone interested in using this when I get it finished?
2. Anyone have any ideas or suggestions of how to make it better/more usable?
Thanks
I'm very interested... especially in a more flexible API. What's the license on the original code, lgpl or somesuch? A sub-project to LWJGL would be good.
Now, if I can just get the kitchen finished and move all the new appliances out of my computer studio:(
Bill
why dont you try jme http://www.mojomonkeycoding.com, we have MilkshapeASCII loading, Md2, and ASE. Md3 is coming along, and so is 3DS.
Matierals and texturing are all done by the programmer (using an interface specifyed by jME). Il show you a typical Texture loading:
TextureState ts = display.getRenderer().getTextureState();
ts.setTexture(
TextureManager.loadTexture(
"data/texture/star.png",
Texture.MM_LINEAR,
Texture.FM_LINEAR,
true));
ts.setEnabled(true);
model = new Md2Model();
model.load("data/drfreak.md2") //Going to use URL instead of String later
model.setRenderState(ts);
Checkout my site http://www.volatile7.tk to see Dr. Freak!
Hope that helps
absolutely
whatever happened with this?
I'm am interested because I will need something exactly along the lines of this for JGLMark....