Intro | Features | Documentation | Screenshots | Downloads |
open (currently not implemented)
#include "OgreColladaManager.h" #include "OgreColladaScene.h" ... ColladaDocumentPtr daeDoc = ColladaManager::getSingleton().load("colladafile.dae", mSceneMgr); LogManager::getSingleton().logMessage("ColladaDocument - import started"); if (!daeDoc.isNull()) { // build up scene fully daeDoc->getScene()->createOgreInstance(NULL); /** * or * to import only a specific part of the scene graph * fetch the scene node by its unique node name * * ColladaSceneNode *box = mScene->getNode("Box2"); * if (box != NULL) box->createOgreInstance(NULL); */ } LogManager::getSingleton().logMessage("ColladaDocument - import finished"); // Note: ColladaDocumentPtr is a shared pointer and will release the resource when it goes out of scope ...
First of all a new collada document has to be created, it takes an Ogre::SceneManager. Everything of this document would be attached to the given scenemanager, which could not be changed for the current document.
Now an import with the filename as argument could be started. The plugin loads the full document and saves some xml nodes for fast importing. See the ColladaLibraryContainer for further details. It holds all collada libraries, currently: CAMERA, GEOMETRY, IMAGE, LIGHT, MATERIAL and TEXTURE. Each library entity has a unique identifier.
Afterwards the SCENE would be parsed and a collada scenegraph is built up, by linking the nodes to their corresponding entities. The transformations and boundingboxes are imported too.
If import was successful, a ColladaSceneNode can be traversed to an Ogre instance. In addition to import the complete scenegraph only a specific node can be instanced too (see example above). Now all collada specific items are attached to the Ogre::SceneNode passed through createOgreInstance(). Above the example takes NULL, which means the root scenenode of the scenemanager. In fact an import of only one entity (CAMERA, GEOMETRY or LIGHT) is possible. By importing the whole scene the light(s) would be attached automatically to the scenemanager, the camera(s) too, but to activate a camera it has to be set manually.
For development and requirements please see the README file enclosed to the download packages. For source documentation with doxygen click here
For feature requests, bugs and more please contact philipp.hartl[at]bkf.at or discuss at the Ogre platform. See thread "The Ogre COLLADA plugin".