I'm having some trouble setting up a scene with the collada loader.
I don't know if it's working properly and this is the correct behavior or something is wrong.
I'll describe my setup...
My .dae file was exported from 3d Max 2012 using the default FBX Exporter.
The whole scene is composed from one box without 3 sides called "walls", a sphere called "sphere", a omni light called "light" and a camera called (guess) "camera".
The "walls" and "sphere" were converted to an editable mesh and have an UVW map.
Now, my code is the following (I'm using the IrrLicht Lime .NET Wrapper by greenya, but the snippet is simple enough to follow):
Code: Select all
// create device ...
smgr.Attributes.SetValue(SceneParameters.COLLADA_CreateSceneInstances, true);
smgr.GetMesh("assets/scene.dae");
smgr.AddLightSceneNode(null, new Vector3Df(0, 15, -20));
smgr.AddCameraSceneNode(null, new Vector3Df(0, 30, -40));
// device.Run() loop ...
The "smgr.GetMesh()" returns a dummy mesh, and that's what I expect.
What I don't get is that it automagically puts the first (and only the first) mesh into the scene.
Adding nothing is something that I can expect and understand but adding everything is what I want.
To further complicate things the docs says that:
Created scene nodes will be named as the names of the nodes in the COLLADA file.
The "will be added into the scene manager" doesn't seems to work except for the first mesh in the .dae, and the "path/to/file/file.dea#meshname" is really, REALY unpredictable.Meshes included in the scene will be added into the scene manager with the following naming scheme: "path/to/file/file.dea#meshname".
After fiddling a lot with the scene I was able to retrieve the following name pattern:
"C:/.../assets/scene.dae35walls-lib" (where "C:/..." is a lot of nested folders that leads to my project)
The docs says that the pattern should have a # (sharp) after the extension, but in my case is a number, and I don't know if this number will change from time to time.
The name of the mesh is different from my .max file, as it have this suffix "-lib"...
And using the absolute path to the file is something impossible to use in production, as the file path will change from machine to machine and I can't predict it...
Is this right, the expected behavior?
Why it's adding the only the first mesh into the scene, or worse, why it's adding something that I didn't asked for?
Is there any way to collect and use the elements in a reasonable manner?
Can I force it to add everything or nothing instead of one arbitrary element to the scene?
Sorry for the long post and (probably) bad english...
Thank you all in advance.
ps: Thank you greenya for your wrapper... ;D
[EDIT]
No matter what, I can't find a way to get the camera and light. The meshes I can retrieve through the "smgr.MeshCache", but lights and cameras aren't meshes, so they don't get listed here...