Thank you for the Bones Collada importer. Its a godsend! =)
Now, hopefully you can help me. I'm trying to load some pretty big models (DAZ Victoria) that I exported in Wavefront Collada format. The models import just fine through Bones; however, I can't get the textures...
I've tried
ColladaImporter colladaImporter = new ColladaImporter().loadTextures(true);
which results in:
WARNING: Unable to read image of type: .jpg
Feb 3, 2011 7:38:08 PM com.ardor3d.image.util.ImageLoaderUtil loadImage
WARNING: loadImage(String, InputStream, boolean): no imageData found. defaultTexture used.
The textures are in .jpg format, and it seems that the Ardor3d loader can only support TGA and DGA texture formats...
So I guess I have to load the textures manually, so in my code:
AnimatedGroup skinnedGroup;
try {
ColladaImporter colladaImporter = new ColladaImporter().loadTextures(false);
ColladaStorage colladaStorage = colladaImporter.load(uri.toString());
skinnedGroup = BonesImporter.importCollada(colladaStorage, 1f, new Quaternion().rotateX((float)Math.PI));
} finally {
ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocater);
}
TextureManager tm = TextureManager.getInstance();
tm.addTexture("tex2_SkinHipf_1_Diff", new Texture("/temp/victoria.images/V4SmplTorsoM_NG.jpg"));
tm.addTexture("tex2_SkinTorsof_1_Diff", new Texture("/temp/victoria.images/V4SmplTorsoM_NG.jpg"));
// .... load a bunch more textures here ...
for (Animated3D o : skinnedGroup) {
o.setTexture(o.getName()); // HOW CAN I GET THE NAME OF THE OBJECT TO ASSOCIATE WITH THE TEXTURE?? o.getName() does not match the texture name!
o.build();
o.compileAndStrip();
o.discardMeshData();
}
Now my problem above is, I've got a TextureManager object full of textures, how can I know which objects correctly associate with which texture? Unfortunately, the Animated3D object names are generic (ie. Object11), so I don't know which texture to assign to what object. I'm new to this whole 3d programming stuff, so maybe there is a simple way to solve this problem.
Thanks!