SGI Image Format File

While playing around with AC3D models I came across the SGI image file format (typically with .rgb extension) so I added an SGILoader used for the TextureManager.

This does not allow plugins which might be an idea, so I had to test with a texture loader outside the usual FormatConverters (I took the AC3D loader so don't wonder why there is special code for .rgb textures).



Adding that to jME would help me a lot of course :slight_smile:



http://cvs.world-of-mystery.de/cgi-bin/cvsweb.cgi/wom/src/de/worldofmystery/common/ac3d/SGILoader.java



Edit: Here is a test image to play with: http://www.world-of-mystery.de/download/slate.rgb

Out of curiousity, is there anything special about the SGI format?

For me the only special thing about this format is that AC3D likes to use it and there was no support in TextureManager.

This is a format documentation: http://astronomy.swin.edu.au/~pbourke/dataformats/sgirgb/sgiversion.html

What about adding graphic file format handlers to TextureManager in public static com.jme.image.Image loadImage(URL file, boolean flipped) ?



We could have an interface defining a loadImage() function and an addHandler(String extension, ImageLoaderInterface loader) which would add the handler to a HashMap of loaders. The loadImage function then could check this map whether there is a handler for this format.



That way I could get my SGILoader in and you don't have to care about formats you're not interested in.

Yes, that would make more sense than the current system. But for now you can open a feature request in the tracker if you want this added to CVS:

https://jme.dev.java.net/servlets/ProjectIssues

Ok, I'll create a patch for that. As it might go into post-0.10 should it be java 1.5 compliant already ?

Actually I meant an issue for putting the SGI loader in… (and your AC3D loader if you'd like to get that in CVS)



I wouldn't go randomly making big changes to TextureManager, expecting them to go right in, if it's not been discussed first. Just so we're clear on that… Of course, if you have some code to show what you mean, it might make discussion a lot easier, and it might be put in after that.



It certainly doesn't have to use 1.5. Looks more and more like it that we'll switch to that sooner or later, but we're not there yet (eg. nightly build system is still 1.4 afaik).

Let's start that, see http://www.jmonkeyengine.com/jmeforum/index.php?topic=3245.0