Ogre COLLADA Plugin        
See also OgreCollada

Collada.jpg
Author: Nfz
Project: OGRE Add-on Project (ColladaPlugin)
Type: OGRE Library
Sources: OGRE Addons SVN
Supported Platforms: Mac, Unix, Windows


COLLADA - An open Digital Asset Exchange Schema for the interactive 3D industry. COLLADA (COLLAborative Design Activity) is the XML based next generation open source 3D scene interchange format used by Sony for Playstation 3 development (and many more), which is supported by all major 3D vendors (Maya, 3DSMax, XSI, ...). With this plugin it should be possible to load collada xml files (*.dae) into your Ogre application.

Features

Implemented

  • uses the Ogre::SceneManager of your application for attaching entities
  • imports only a part of the DAG collada scene graph or the full scene
  • available geometry types: triangles and polygons (last one would be triangulated simply)
  • uses Ogre triangle list with vertex buffer objects
  • materials with multipass support and textures*
  • lights (ambient, directional, point and spot)
  • camera support (orthographic and perspective)

Currently not implemented

  • Ogre::ManualResourceLoader
  • update to Collada 1.4
  • animation
  • GPU shader materials
  • skinning
  • Physics
  • and more ...

Using the plugin with your application

  • first of all setup an Ogre application (maybe found on the Ogre wiki help sites)
  • prepare for requirements of the plugin
    • place folling in plugins.cfg file

Plugin=Plugin_Collada

  • paste following code
#include "OgreColladaManager.h"
 #include "OgreColladaScene.h"
 ...
    Ogre::LogManager::getSingleton().logMessage("ColladaDocument - import started");
    try
    {
        Ogre::ColladaDocumentPtr daeDoc = Ogre::ColladaManager::getSingleton().load(daeFileName,
            mSceneMgr);
        // build up scene fully if document was loaded
        if (!daeDoc.isNull())
        {
            Ogre::ColladaSceneNode* node = daeDoc->getScene();
            if (node)
            {
                daeDoc->getScene()->createOgreInstance(NULL);
                Ogre::LogManager::getSingleton().logMessage("ColladaDocument - import finished");
            }
            else
            {
                Ogre::LogManager::getSingleton().logMessage("ColladaDocument - import failed");
            }
        }
    }
    catch(...)
    {
        Ogre::LogManager::getSingleton().logMessage("ColladaDocument - failed to load");
    }

    // 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 by asking the ColladaManager to load a document. ColladaManager is an Ogre Resource Manager that manages COLLADA document which are setup as Ogre Resources. Parameters passed on to the load method are the document file name and the scenemanger that will be used. Everything in the document will be attached to the given scenemanager.

If the document was successfully loaded (the shared pointer not being NULL) the COLLADA scene can be loaded into the Ogre Scene. 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.

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.

See also


Alias: Ogre_COLLADA_Plugin

Call to undefined function mb_split()Call to undefined function mb_split()Call to undefined function mb_split()Call to undefined function mb_split()