Commits

Frederic De Groef committed f045043

added logging in CGeometryConverter
some reindent

Comments (0)

Files changed (8)

cologre-ng/include/GeometryConverter.h

 class CGeometryConverter : public CResourceConverter
 {
 public:
-  ///Contructor
-  CGeometryConverter(void);
-  ///Destructor
-  virtual ~CGeometryConverter(void);
+    ///Contructor
+    CGeometryConverter(Ogre::Log *_log);
+    ///Destructor
+    virtual ~CGeometryConverter(void);
 
-  /**Reads collada "<geometry>s" and creates Ogre::Meshes accordingly. It creates vertex buffers and copies all vertex, normal and texture
-    data to the buffer. Created meshes are stored in Ogres global MeshManager. 
-    An Ogre root object has to have been created BEFORE calling this function.
-    @param pDatabase daeDatabse to convert the geometry elements from
-    @return 0 if succeeded, 1 upon error, prints error message to stderr
-  */
-  int convert(daeDatabase* pDatabase);
+    /**Reads collada "<geometry>s" and creates Ogre::Meshes accordingly. It creates vertex buffers and copies all vertex, normal and texture
+      data to the buffer. Created meshes are stored in Ogres global MeshManager. 
+      An Ogre root object has to have been created BEFORE calling this function.
+      @param pDatabase daeDatabse to convert the geometry elements from
+      @return 0 if succeeded, 1 upon error, prints error message to stderr
+    */
+    int convert(daeDatabase* pDatabase);
 
 protected:
-  ///parses the input array of a "<triangle>" tag to create an Ogre vertex declaration
-  void buildVertexDeclFromInputArray(const daeElementRef elemRef, Ogre::MeshPtr pOgreMesh);
-  /**reads the "<p>" values of a "<triangle>" section, reindexes all values and then copies all vertex, normal and texture coordinate values
-    to the right location in the vertex buffer, according tpo their new index, fills index buffer with new indices.
-  */
-  void copyData(domPRef pRef, const std::vector<domSource*> &vSource, IntermediateVertexData* pDest, Ogre::VertexDeclaration* pVertexDecl, Ogre::AxisAlignedBox* pAABB);
+    ///parses the input array of a "<triangle>" tag to create an Ogre vertex declaration
+    void buildVertexDeclFromInputArray(const daeElementRef elemRef, Ogre::MeshPtr pOgreMesh);
+    /**reads the "<p>" values of a "<triangle>" section, reindexes all values and then copies all vertex, normal and texture coordinate values
+      to the right location in the vertex buffer, according tpo their new index, fills index buffer with new indices.
+    */
+    void copyData(domPRef pRef, const std::vector<domSource*> &vSource, IntermediateVertexData* pDest, Ogre::VertexDeclaration* pVertexDecl, Ogre::AxisAlignedBox* pAABB);
 
-  ///for temporarily storing position, normal, txcoord, etc values 
-  std::vector<float> m_vDataTmp;
-  ///for temporarily storing offsets in the m_vDataTmp vector 
-  std::vector<int> m_vDataTmpOffsets;
-  ///vertexCount for a single submesh
-  unsigned int m_vertexCount;
-  ///the dominant vertex element (the one with the highest count). Needed to create enough entries in the ogre vertex buffer.
-  unsigned int m_dominantElementIndex;
-  ///keep atrack of all vertex declarations
-  std::vector<Ogre::VertexDeclaration*> m_vDeclarations;
-  std::vector<IntermediateVertexData> m_vIVD;
+    ///for temporarily storing position, normal, txcoord, etc values 
+    std::vector<float> m_vDataTmp;
+    ///for temporarily storing offsets in the m_vDataTmp vector 
+    std::vector<int> m_vDataTmpOffsets;
+    ///vertexCount for a single submesh
+    unsigned int m_vertexCount;
+    ///the dominant vertex element (the one with the highest count). Needed to create enough entries in the ogre vertex buffer.
+    unsigned int m_dominantElementIndex;
+    ///keep atrack of all vertex declarations
+    std::vector<Ogre::VertexDeclaration*> m_vDeclarations;
+    std::vector<IntermediateVertexData> m_vIVD;
 
-  ///temporary storage place for vertex-bone-assignments
-  std::vector<vertexWeight> m_vVBAssignments;
+    ///temporary storage place for vertex-bone-assignments
+    std::vector<vertexWeight> m_vVBAssignments;
 
-  conversion_errors loadGeometryToIntermediateMesh(domGeometry* pGeo, CIntermediateMesh* pIM);
-  void addVertexWeights(domSkin* pSkin);
-  void makeOgreMeshFromIntermediateMesh(CIntermediateMesh* pIM);
+    conversion_errors loadGeometryToIntermediateMesh(domGeometry* pGeo, CIntermediateMesh* pIM);
+    void addVertexWeights(domSkin* pSkin);
+    void makeOgreMeshFromIntermediateMesh(CIntermediateMesh* pIM);
+
+    Ogre::Log *m_pLog;
 
 };
 

cologre-ng/include/cologre_ng_precompiled.h

 #include <vector>
 #include <numeric>
 #include <sstream>
+#ifdef _DEBUG
 #include <cassert>
+#endif
+
 
 #include <Ogre.h>
 

cologre-ng/src/ColladaDatabase.cpp

     m_pLog = NULL;
     m_spLocations = LocationsPtr(new Locations);
 }
-
+//------------------------------------------------------------------------------
 CColladaDatabase::~CColladaDatabase()
 {
     if(m_pDae)
         m_pDae = NULL;
     }
 }
-
+//------------------------------------------------------------------------------
 int CColladaDatabase::load(std::string filename)
 {
     _initLogger();
     parseAsset();
     return 0;
 }
-
+//------------------------------------------------------------------------------
 void CColladaDatabase::convertResources()
 {
     CResourceConverter* pResConv = NULL;
-    pResConv = new CGeometryConverter();
+    pResConv = new CGeometryConverter(m_pLog);
     pResConv->convert(m_pDatabase);
     delete pResConv;
 
     pResConv->convert(m_pDatabase);
     delete pResConv;
 }
-
+//------------------------------------------------------------------------------
 void CColladaDatabase::convertScene(Ogre::SceneManager* pOgreSceneManager)
 {
   daeElement* pElement = NULL;
   pSceneConv->convert(pElement, pOgreSceneManager);
   delete pSceneConv;
 }
-
+//------------------------------------------------------------------------------
 void CColladaDatabase::parseAsset()
 {
   daeElement* pElement = NULL;

cologre-ng/src/GeometryConverter.cpp

 #include "cologre_ng_precompiled.h"
 #include "GeometryConverter.h"
-#include "dom/domController.h"
+#include <dom/domController.h>
 
-CGeometryConverter::CGeometryConverter() : CResourceConverter()
+#ifdef _DEBUG
+#include <cassert>
+#endif
+#include <sstream>
+
+//------------------------------------------------------------------------------
+CGeometryConverter::CGeometryConverter(Ogre::Log *_log) 
+    :CResourceConverter()
+    ,m_pLog(_log)
 {
-  m_vertexCount = 0;
-  m_dominantElementIndex = 0;
+#ifdef _DEBUG
+    assert(m_pLog);
+#endif  
+    m_vertexCount = 0;
+    m_dominantElementIndex = 0;
 }
-
+//------------------------------------------------------------------------------
 CGeometryConverter::~CGeometryConverter()
 {
 }
-
+//------------------------------------------------------------------------------
 int CGeometryConverter::convert(daeDatabase* pDatabase)
 {
-  unsigned int numElements = pDatabase->getElementCount(NULL, "geometry", NULL);
-  for(unsigned int i = 0; i < numElements; i++)
-  {
-    daeElement* pElement = NULL;
-    pDatabase->getElement(&pElement, i, NULL, "geometry", NULL);
-    domGeometry* pGeo = (domGeometry*)pElement;
-    CIntermediateMesh IM;
-    IM.m_meshName = pGeo->getID();
-    //see if this mesh is a skin
-    unsigned int numControllerElements = pDatabase->getElementCount(NULL, "controller", NULL);
-    for(unsigned int i = 0; i < numControllerElements; i++)
+    m_pLog->logMessage("Converting geometry");
+    m_pLog->logMessage("-------------------------------------------------") ;
+
+    unsigned int numElements = pDatabase->getElementCount(NULL, "geometry", NULL);
+
     {
-      pDatabase->getElement(&pElement, i, NULL, "controller", NULL);
-      domController* pCont = (domController*)pElement;
-      domSkinRef skinRef = pCont->getSkin();
-      if(IM.m_meshName == skinRef->getSource().getElement()->getID())
-        addVertexWeights(skinRef.cast());
+        std::stringstream s;
+        s << "Loading " << numElements << " meshes";
+        m_pLog->logMessage(s.str());
     }
+
+    for(unsigned int i = 0; i < numElements; i++)
+    {
+        daeElement* pElement = NULL;
+        pDatabase->getElement(&pElement, i, NULL, "geometry", NULL);
+        domGeometry* pGeo = (domGeometry*)pElement;
+        CIntermediateMesh IM;
+        IM.m_meshName = pGeo->getID();
+        //see if this mesh is a skin
+        unsigned int numControllerElements = pDatabase->getElementCount(NULL, "controller", NULL);
+        for(unsigned int i = 0; i < numControllerElements; i++)
+        {
+            pDatabase->getElement(&pElement, i, NULL, "controller", NULL);
+            domController* pCont = (domController*)pElement;
+            domSkinRef skinRef = pCont->getSkin();
+            if(IM.m_meshName == skinRef->getSource().getElement()->getID())
+                addVertexWeights(skinRef.cast());
+        }
     
-    if(loadGeometryToIntermediateMesh(pGeo, &IM) == ALL_OK)
-      makeOgreMeshFromIntermediateMesh(&IM);
-  }
-  return 0;
+        if(loadGeometryToIntermediateMesh(pGeo, &IM) == ALL_OK)
+            makeOgreMeshFromIntermediateMesh(&IM);
+    }
+
+    m_pLog->logMessage("\n\n\n");
+
+    return 0;
 }
-
+//------------------------------------------------------------------------------
 conversion_errors CGeometryConverter::loadGeometryToIntermediateMesh(domGeometry* pGeo, CIntermediateMesh* pIM)
 {
-  domMeshRef colladaMesh = pGeo->getMesh();
-  if(colladaMesh)
-  {
-    domTriangles_Array triArray = (*colladaMesh).getTriangles_array();
-    if(triArray.getCount() == 0)
     {
-      std::cerr << "No triangles found in mesh, other primitives currently not supported!" << std::endl;
-      return ERROR_UNSUPPORTED;
+        std::stringstream s;
+        s << "Loading mesh : " << pGeo->getName() << " to intermediate mesh";
+        m_pLog->logMessage(s.str());
     }
-    for(unsigned int i = 0; i < triArray.getCount(); ++i)
+    domMeshRef colladaMesh = pGeo->getMesh();
+
+    if(colladaMesh)
     {
-      pIM->m_subMeshCount++;
-      domTrianglesRef trisRef = triArray.get(i);
-      pIM->m_vSubMeshVertexCount.push_back(trisRef->getCount() * 3);
-      pIM->m_vSubMeshNames.push_back(trisRef->getMaterial());
-      domInputLocalOffset_Array inputArray = trisRef->getInput_array();
-      for(unsigned int i = 0; i < inputArray.getCount(); i++)
-      {
-        domInputLocalOffsetRef inputRef = inputArray.get(i);
-        domURIFragmentType source = ((*inputRef).getSource());
-        daeElementRef sourceElementRef = source.getElement();
-        std::string strSem((*inputRef).getSemantic());
-
-        //VERTICES will always appear first, change sourceElementRef to point to the vertex source
-        if((*sourceElementRef).getElementType() == COLLADA_TYPE::VERTICES)
+        domTriangles_Array triArray = (*colladaMesh).getTriangles_array();
+        if(triArray.getCount() == 0)
         {
-          domVertices* pVert = (domVertices*)(&(*sourceElementRef));
-          domInputLocal_Array inputArray = pVert->getInput_array();
-          domInputLocalRef inputRef = inputArray.get(i);
-          strSem = (*inputRef).getSemantic();
-          domURIFragmentType source = ((*inputRef).getSource());
-          sourceElementRef = source.getElement();
+            m_pLog->logMessage("No triangles found in mesh, other primitives currently not supported!");
+            return ERROR_UNSUPPORTED;
         }
 
-        if((*sourceElementRef).getElementType() == COLLADA_TYPE::SOURCE)
         {
-          domSource* pSource = (domSource*)(&(*sourceElementRef));
-          domSource::domTechnique_commonRef techCommonRef = pSource->getTechnique_common();
-          domAccessorRef accessorRef = (*techCommonRef).getAccessor();
-          unsigned int stride = (*accessorRef).getStride();
+            std::stringstream s;
+            s << "Loading " << triArray.getCount() << " triangle(s) ";
+            m_pLog->logMessage(s.str());
+        }
 
-          domListOfFloats dataList = pSource->getFloat_array()->getValue();
-          domListOfUInts indexList = trisRef->getP()->getValue();
-          if(strSem == "POSITION")
-          {  
-            pIM->m_positions.stride = stride;
-            std::vector<Ogre::VertexBoneAssignment> vVBATemp;
-            for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
+        for(unsigned int i = 0; i < triArray.getCount(); ++i)
+        {
+            pIM->m_subMeshCount++;
+            domTrianglesRef trisRef = triArray.get(i);
+            pIM->m_vSubMeshVertexCount.push_back(trisRef->getCount() * 3);
+            pIM->m_vSubMeshNames.push_back(trisRef->getMaterial());
+            domInputLocalOffset_Array inputArray = trisRef->getInput_array();
+            for(unsigned int i = 0; i < inputArray.getCount(); i++)
             {
-              for(unsigned int k = 0; k < stride; ++k)
-                pIM->m_positions.data.push_back(dataList[indexList[j] * stride + k]);
-              if(m_vVBAssignments.size())
-              {
-                vertexWeight vW;
-                vW.boneIndices = m_vVBAssignments[indexList[j]].boneIndices;
-                vW.weights = m_vVBAssignments[indexList[j]].weights;
-                pIM->m_vertexWeights.push_back(vW);
-              }
+                domInputLocalOffsetRef inputRef = inputArray.get(i);
+                domURIFragmentType source = ((*inputRef).getSource());
+                daeElementRef sourceElementRef = source.getElement();
+                std::string strSem((*inputRef).getSemantic());
+
+                //VERTICES will always appear first, change sourceElementRef to point to the vertex source
+                if((*sourceElementRef).getElementType() == COLLADA_TYPE::VERTICES)
+                {
+                    domVertices* pVert = (domVertices*)(&(*sourceElementRef));
+                    domInputLocal_Array inputArray = pVert->getInput_array();
+                    domInputLocalRef inputRef = inputArray.get(i);
+                    strSem = (*inputRef).getSemantic();
+                    domURIFragmentType source = ((*inputRef).getSource());
+                    sourceElementRef = source.getElement();
+                }
+
+                if((*sourceElementRef).getElementType() == COLLADA_TYPE::SOURCE)
+                {
+                    domSource* pSource = (domSource*)(&(*sourceElementRef));
+                    domSource::domTechnique_commonRef techCommonRef = pSource->getTechnique_common();
+                    domAccessorRef accessorRef = (*techCommonRef).getAccessor();
+                    unsigned int stride = (*accessorRef).getStride();
+
+                    domListOfFloats dataList = pSource->getFloat_array()->getValue();
+                    domListOfUInts indexList = trisRef->getP()->getValue();
+                    if(strSem == "POSITION")
+                    {  
+                        pIM->m_positions.stride = stride;
+                        std::vector<Ogre::VertexBoneAssignment> vVBATemp;
+                        for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
+                        {
+                            for(unsigned int k = 0; k < stride; ++k)
+                                pIM->m_positions.data.push_back(dataList[indexList[j] * stride + k]);
+                            if(m_vVBAssignments.size())
+                            {
+                                vertexWeight vW;
+                                vW.boneIndices = m_vVBAssignments[indexList[j]].boneIndices;
+                                vW.weights = m_vVBAssignments[indexList[j]].weights;
+                                pIM->m_vertexWeights.push_back(vW);
+                            }
+                        }
+                    }
+                    else if(strSem == "NORMAL")
+                    {  
+                        pIM->m_normals.stride = stride;
+                        for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
+                        {
+                            for(unsigned int k = 0; k < stride; ++k)
+                                pIM->m_normals.data.push_back(dataList[indexList[j] * stride + k]);
+                        }
+                    }
+                    else if(strSem == "TEXCOORD")
+                    {  
+                        pIM->m_texCoords.stride = stride;
+                        for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
+                        {
+                            for(unsigned int k = 0; k < stride; ++k)
+                                pIM->m_texCoords.data.push_back(dataList[indexList[j] * stride + k]);
+                        }
+                    }
+                }
             }
-          }
-          else if(strSem == "NORMAL")
-          {  
-            pIM->m_normals.stride = stride;
-            for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
-            {
-              for(unsigned int k = 0; k < stride; ++k)
-                pIM->m_normals.data.push_back(dataList[indexList[j] * stride + k]);
-            }
-          }
-          else if(strSem == "TEXCOORD")
-          {  
-            pIM->m_texCoords.stride = stride;
-            for(unsigned int j = i; j < indexList.getCount(); j += inputArray.getCount())
-            {
-              for(unsigned int k = 0; k < stride; ++k)
-                pIM->m_texCoords.data.push_back(dataList[indexList[j] * stride + k]);
-            }
-          }
         }
-      }
     }
-  }
-  return ALL_OK;
+
+    m_pLog->logMessage("");
+
+    return ALL_OK;
 }
-
+//------------------------------------------------------------------------------
 void CGeometryConverter::addVertexWeights(domSkin *pSkin)
 { 
-  m_vVBAssignments.clear();
-  for(unsigned int i = 0; i < pSkin->getVertex_weights()->getInput_array().getCount(); ++i)
-  {
-    domInputLocalOffsetRef inputRef = pSkin->getVertex_weights()->getInput_array().get(i);
-    domURIFragmentType source = inputRef->getSource();
-    daeElementRef sourceElementRef = source.getElement();
-    std::string strSem = inputRef->getSemantic();
-    domName_arrayRef nameArrayRef;
-    if(strSem == "WEIGHT")
+    m_vVBAssignments.clear();
+    for(unsigned int i = 0; i < pSkin->getVertex_weights()->getInput_array().getCount(); ++i)
     {
-      domSource* pSource = (domSource*)(&(*sourceElementRef));
-      domListOfFloats weightList = pSource->getFloat_array()->getValue();
-      domListOfInts vList = pSkin->getVertex_weights()->getV()->getValue();
-      domListOfUInts vCountList = pSkin->getVertex_weights()->getVcount()->getValue();
-      unsigned int valuesCopied = 0;
-      for(unsigned int j = 0; j < vCountList.getCount(); ++j)
-      {
-        vertexWeight VW;
-        for(unsigned int k = 0; k < vCountList.get(j); ++k)
+        domInputLocalOffsetRef inputRef = pSkin->getVertex_weights()->getInput_array().get(i);
+        domURIFragmentType source = inputRef->getSource();
+        daeElementRef sourceElementRef = source.getElement();
+        std::string strSem = inputRef->getSemantic();
+        domName_arrayRef nameArrayRef;
+        if(strSem == "WEIGHT")
         {
-          VW.boneIndices.push_back(vList.get(valuesCopied + (k * 2)));
-          VW.weights.push_back(weightList.get(vList.get(valuesCopied + (k * 2 + 1))));
+            domSource* pSource = (domSource*)(&(*sourceElementRef));
+            domListOfFloats weightList = pSource->getFloat_array()->getValue();
+            domListOfInts vList = pSkin->getVertex_weights()->getV()->getValue();
+            domListOfUInts vCountList = pSkin->getVertex_weights()->getVcount()->getValue();
+            unsigned int valuesCopied = 0;
+            for(unsigned int j = 0; j < vCountList.getCount(); ++j)
+            {
+                vertexWeight VW;
+                for(unsigned int k = 0; k < vCountList.get(j); ++k)
+                {
+                    VW.boneIndices.push_back(vList.get(valuesCopied + (k * 2)));
+                    VW.weights.push_back(weightList.get(vList.get(valuesCopied + (k * 2 + 1))));
+                }
+                m_vVBAssignments.push_back(VW);
+                valuesCopied += vCountList.get(j) * 2;
+            }
         }
-        m_vVBAssignments.push_back(VW);
-        valuesCopied += vCountList.get(j) * 2;
-      }
     }
-  }
 }
-
+//------------------------------------------------------------------------------
 void CGeometryConverter::makeOgreMeshFromIntermediateMesh(CIntermediateMesh *pIM)
 {
-  Ogre::MeshPtr pOgreMesh = Ogre::MeshManager::getSingleton().createManual(pIM->m_meshName, "DaeCustom");
-  pOgreMesh->sharedVertexData = new Ogre::VertexData();
-  Ogre::VertexDeclaration* pDecl = pOgreMesh->sharedVertexData->vertexDeclaration;
-  Ogre::AxisAlignedBox aaBB;
+    {
+        std::stringstream s;
+        s << "Making Ogre mesh from intermediate mesh : " << pIM->m_meshName;
+        s << " [#submeshes:" << pIM->m_subMeshCount << "   #vertices:" << pIM->m_positions.data.size();
+        s << "   #normals:" << pIM->m_normals.data.size() << "]";
+        m_pLog->logMessage(s.str());
+    }
 
-  if(pIM->m_positions.data.size())
-  {
-    size_t offset = pDecl->getVertexSize(0);
-    pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_positions.stride - 1), Ogre::VES_POSITION);
-  }
-  if(pIM->m_normals.data.size())
-  {
-    size_t offset = pDecl->getVertexSize(0);
-    pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_normals.stride - 1), Ogre::VES_NORMAL);
-  }
-  if(pIM->m_texCoords.data.size())
-  {
-    size_t offset = pDecl->getVertexSize(0);
-    pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_texCoords.stride - 1), Ogre::VES_TEXTURE_COORDINATES);
-  }
-  Ogre::HardwareVertexBufferSharedPtr vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(pDecl->getVertexSize(0),
-                                                                                                                    pIM->m_positions.data.size() / pIM->m_positions.stride,
-                                                                                                                    Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
-  float* pData = static_cast<float*>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));
+    Ogre::MeshPtr pOgreMesh = Ogre::MeshManager::getSingleton().createManual(pIM->m_meshName, "DaeCustom");
+    pOgreMesh->sharedVertexData = new Ogre::VertexData();
+    Ogre::VertexDeclaration* pDecl = pOgreMesh->sharedVertexData->vertexDeclaration;
+    Ogre::AxisAlignedBox aaBB;
 
-  //at this point, there should be an equal number of data for each element if devided by stride
-  unsigned int vertexCount = pIM->m_positions.data.size() / pIM->m_positions.stride;
-  Ogre::Vector3 vec3;
-  for(unsigned int i = 0; i < vertexCount; ++i)
-  {
-    //assuming for now that position data is always vec3
-    vec3.x = pIM->m_positions.data[i * pIM->m_positions.stride];
-    vec3.y = pIM->m_positions.data[i * pIM->m_positions.stride + 1];
-    vec3.z = pIM->m_positions.data[i * pIM->m_positions.stride + 2];
-    if(m_zUp)
-      vec3 = flipAxes(&vec3);
-    aaBB.merge(vec3);
-    
-    *pData = vec3.x;
-    ++pData;
-    *pData = vec3.y;
-    ++pData;
-    *pData = vec3.z;
-    ++pData;
-
+    if(pIM->m_positions.data.size())
+    {
+        size_t offset = pDecl->getVertexSize(0);
+        pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_positions.stride - 1), Ogre::VES_POSITION);
+    }
     if(pIM->m_normals.data.size())
     {
-      vec3.x = pIM->m_normals.data[i * pIM->m_normals.stride];
-      vec3.y = pIM->m_normals.data[i * pIM->m_normals.stride + 1];
-      vec3.z = pIM->m_normals.data[i * pIM->m_normals.stride + 2];
-      if(m_zUp)
-        vec3 = flipAxes(&vec3);
-      
-      *pData = vec3.x;
-      ++pData;
-      *pData = vec3.y;
-      ++pData;
-      *pData = vec3.z;
-      ++pData;
+        size_t offset = pDecl->getVertexSize(0);
+        pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_normals.stride - 1), Ogre::VES_NORMAL);
+    }
+    if(pIM->m_texCoords.data.size())
+    {
+        size_t offset = pDecl->getVertexSize(0);
+        pDecl->addElement(0, offset, static_cast<Ogre::VertexElementType>(pIM->m_texCoords.stride - 1), Ogre::VES_TEXTURE_COORDINATES);
+    }
+    Ogre::HardwareVertexBufferSharedPtr vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(pDecl->getVertexSize(0),
+        pIM->m_positions.data.size() / pIM->m_positions.stride,
+        Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+    float* pData = static_cast<float*>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));
+
+    //at this point, there should be an equal number of data for each element if devided by stride
+    unsigned int vertexCount = pIM->m_positions.data.size() / pIM->m_positions.stride;
+    Ogre::Vector3 vec3;
+    for(unsigned int i = 0; i < vertexCount; ++i)
+    {
+        //assuming for now that position data is always vec3
+        vec3.x = pIM->m_positions.data[i * pIM->m_positions.stride];
+        vec3.y = pIM->m_positions.data[i * pIM->m_positions.stride + 1];
+        vec3.z = pIM->m_positions.data[i * pIM->m_positions.stride + 2];
+        if(m_zUp)
+            vec3 = flipAxes(&vec3);
+        aaBB.merge(vec3);
+
+        *pData = vec3.x;
+        ++pData;
+        *pData = vec3.y;
+        ++pData;
+        *pData = vec3.z;
+        ++pData;
+
+        if(pIM->m_normals.data.size())
+        {
+            vec3.x = pIM->m_normals.data[i * pIM->m_normals.stride];
+            vec3.y = pIM->m_normals.data[i * pIM->m_normals.stride + 1];
+            vec3.z = pIM->m_normals.data[i * pIM->m_normals.stride + 2];
+            if(m_zUp)
+                vec3 = flipAxes(&vec3);
+
+            *pData = vec3.x;
+            ++pData;
+            *pData = vec3.y;
+            ++pData;
+            *pData = vec3.z;
+            ++pData;
+        }
+
+        if(pIM->m_texCoords.data.size())
+        {
+            vec3.x = pIM->m_texCoords.data[i * pIM->m_texCoords.stride];
+            vec3.y = pIM->m_texCoords.data[i * pIM->m_texCoords.stride + 1];
+            if(pIM->m_texCoords.stride > 2)
+                vec3.z = pIM->m_texCoords.data[i * pIM->m_texCoords.stride + 2];
+
+            if(m_convOptions.flipTextureH == true)
+                vec3.y *= -1.0;
+            else if(m_convOptions.flipTextureV == true)
+                vec3.x *= -1.0;
+
+            *pData = vec3.x;
+            ++pData;
+            *pData = vec3.y;
+            ++pData;
+            if(pIM->m_texCoords.stride > 2)
+            {
+                *pData = vec3.z;
+                ++pData;
+            }
+        }
+    }
+    vertexBuffer->unlock();
+    pOgreMesh->sharedVertexData->vertexBufferBinding->setBinding(0, vertexBuffer);
+    pOgreMesh->sharedVertexData->vertexCount = pIM->m_positions.data.size() / pIM->m_positions.stride;
+    aaBB.scale(Ogre::Vector3(2.0f, 2.0f, 2.0f));
+    pOgreMesh->_setBounds(aaBB);
+
+    int totalIndexCount = 0;
+    for(unsigned int i = 0; i < pIM->m_subMeshCount; ++i)
+    {
+        Ogre::SubMesh* pSubMesh = pOgreMesh->createSubMesh(pIM->m_vSubMeshNames[i]);
+        pSubMesh->indexData->indexCount = pIM->m_vSubMeshVertexCount[i];
+        pSubMesh->indexData->indexStart = 0;
+        pSubMesh->useSharedVertices = true;
+        pSubMesh->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, 
+            pSubMesh->indexData->indexCount, 
+            Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY); 
+        Ogre::uint16* idata = static_cast<Ogre::uint16*>(pSubMesh->indexData->indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD)); 
+        for(unsigned int j = 0; j < pSubMesh->indexData->indexCount; ++j)
+        {
+            *idata = j + totalIndexCount;
+            ++idata;
+        }
+        totalIndexCount += pIM->m_vSubMeshVertexCount[i];
+        pSubMesh->indexData->indexBuffer->unlock();
     }
 
-    if(pIM->m_texCoords.data.size())
+    if(pIM->m_vertexWeights.size())
     {
-      vec3.x = pIM->m_texCoords.data[i * pIM->m_texCoords.stride];
-      vec3.y = pIM->m_texCoords.data[i * pIM->m_texCoords.stride + 1];
-      if(pIM->m_texCoords.stride > 2)
-        vec3.z = pIM->m_texCoords.data[i * pIM->m_texCoords.stride + 2];
-      
-      if(m_convOptions.flipTextureH == true)
-        vec3.y *= -1.0;
-      else if(m_convOptions.flipTextureV == true)
-        vec3.x *= -1.0;
-      
-      *pData = vec3.x;
-      ++pData;
-      *pData = vec3.y;
-      ++pData;
-      if(pIM->m_texCoords.stride > 2)
-      {
-        *pData = vec3.z;
-        ++pData;
-      }
+        //reorganize buffers for skeletal animation
+        Ogre::VertexDeclaration* pOrganizedVD = pOgreMesh->sharedVertexData->vertexDeclaration->getAutoOrganisedDeclaration(true, false);
+        int maxSource = pOrganizedVD->getMaxSource();
+        Ogre::BufferUsageList bul;
+        for(int i = 0; i < maxSource + 1; ++i)
+            bul.push_back(Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+        pOgreMesh->sharedVertexData->reorganiseBuffers(pOrganizedVD, bul); 
+
+        for(unsigned int i = 0; i < pIM->m_vertexWeights.size(); ++i)
+        {
+            for(unsigned int j = 0; j < pIM->m_vertexWeights[i].boneIndices.size(); ++j)
+            {
+                Ogre::VertexBoneAssignment VBA;
+                VBA.vertexIndex = i;
+                VBA.boneIndex = pIM->m_vertexWeights[i].boneIndices[j];
+                VBA.weight = pIM->m_vertexWeights[i].weights[j];
+                pOgreMesh->addBoneAssignment(VBA);
+            }
+        }
     }
-  }
-  vertexBuffer->unlock();
-  pOgreMesh->sharedVertexData->vertexBufferBinding->setBinding(0, vertexBuffer);
-  pOgreMesh->sharedVertexData->vertexCount = pIM->m_positions.data.size() / pIM->m_positions.stride;
-  aaBB.scale(Ogre::Vector3(2.0f, 2.0f, 2.0f));
-  pOgreMesh->_setBounds(aaBB);
-
-  int totalIndexCount = 0;
-  for(unsigned int i = 0; i < pIM->m_subMeshCount; ++i)
-  {
-    Ogre::SubMesh* pSubMesh = pOgreMesh->createSubMesh(pIM->m_vSubMeshNames[i]);
-    pSubMesh->indexData->indexCount = pIM->m_vSubMeshVertexCount[i];
-    pSubMesh->indexData->indexStart = 0;
-    pSubMesh->useSharedVertices = true;
-    pSubMesh->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, 
-                                                                                                     pSubMesh->indexData->indexCount, 
-                                                                                                     Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY); 
-    Ogre::uint16* idata = static_cast<Ogre::uint16*>(pSubMesh->indexData->indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD)); 
-    for(unsigned int j = 0; j < pSubMesh->indexData->indexCount; ++j)
-    {
-      *idata = j + totalIndexCount;
-      ++idata;
-    }
-    totalIndexCount += pIM->m_vSubMeshVertexCount[i];
-    pSubMesh->indexData->indexBuffer->unlock();
-  }
-
-  if(pIM->m_vertexWeights.size())
-  {
-    //reorganize buffers for skeletal animation
-    Ogre::VertexDeclaration* pOrganizedVD = pOgreMesh->sharedVertexData->vertexDeclaration->getAutoOrganisedDeclaration(true, false);
-    int maxSource = pOrganizedVD->getMaxSource();
-    Ogre::BufferUsageList bul;
-    for(int i = 0; i < maxSource + 1; ++i)
-      bul.push_back(Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
-    pOgreMesh->sharedVertexData->reorganiseBuffers(pOrganizedVD, bul); 
-
-    for(unsigned int i = 0; i < pIM->m_vertexWeights.size(); ++i)
-    {
-      for(unsigned int j = 0; j < pIM->m_vertexWeights[i].boneIndices.size(); ++j)
-      {
-        Ogre::VertexBoneAssignment VBA;
-        VBA.vertexIndex = i;
-        VBA.boneIndex = pIM->m_vertexWeights[i].boneIndices[j];
-        VBA.weight = pIM->m_vertexWeights[i].weights[j];
-        pOgreMesh->addBoneAssignment(VBA);
-      }
-    }
-  }
-  pOgreMesh->load();
-  return;
+    pOgreMesh->load();
+    return;
 }
-
-
+//------------------------------------------------------------------------------
 void CGeometryConverter::buildVertexDeclFromInputArray(const daeElementRef elemRef, Ogre::MeshPtr pOgreMesh)
 {
-  pOgreMesh->sharedVertexData = new Ogre::VertexData();
-  if((*elemRef).getElementType() == COLLADA_TYPE::TRIANGLES)
-  {
-    domTriangles* pTris = daeSafeCast<domTriangles>(&(*elemRef));
-    domInputLocalOffset_Array inputArray = pTris->getInput_array();
+    pOgreMesh->sharedVertexData = new Ogre::VertexData();
+    if((*elemRef).getElementType() == COLLADA_TYPE::TRIANGLES)
+    {
+        domTriangles* pTris = daeSafeCast<domTriangles>(&(*elemRef));
+        domInputLocalOffset_Array inputArray = pTris->getInput_array();
 
-    Ogre::SubMesh* pSubMesh = pOgreMesh->createSubMesh(pTris->getMaterial());
-    Ogre::VertexDeclaration* pDecl = Ogre::HardwareBufferManager::getSingleton().createVertexDeclaration();
-    pSubMesh->useSharedVertices = true;
+        Ogre::SubMesh* pSubMesh = pOgreMesh->createSubMesh(pTris->getMaterial());
+        Ogre::VertexDeclaration* pDecl = Ogre::HardwareBufferManager::getSingleton().createVertexDeclaration();
+        pSubMesh->useSharedVertices = true;
 
-    //store data source references for later copying the data to the right spots
-    std::vector<domSource*> vTmpSource;
+        //store data source references for later copying the data to the right spots
+        std::vector<domSource*> vTmpSource;
 
-    for(unsigned int i = 0; i < inputArray.getCount(); i++)
-    {
-      domInputLocalOffsetRef inputRef = inputArray.get(i);
-      domURIFragmentType source = ((*inputRef).getSource());
-      daeElementRef sourceElementRef = source.getElement();
-      std::string strSem((*inputRef).getSemantic());
+        for(unsigned int i = 0; i < inputArray.getCount(); i++)
+        {
+            domInputLocalOffsetRef inputRef = inputArray.get(i);
+            domURIFragmentType source = ((*inputRef).getSource());
+            daeElementRef sourceElementRef = source.getElement();
+            std::string strSem((*inputRef).getSemantic());
 
-      //VERTICES will always appear first, if so, change sourceElementRef to point to the vertex source
-      if((*sourceElementRef).getElementType() == COLLADA_TYPE::VERTICES)
-      {
-        domVertices* pVert = (domVertices*)(&(*sourceElementRef));
-        domInputLocal_Array inputArray = pVert->getInput_array();
-        domInputLocalRef inputRef = inputArray.get(i);
-        strSem = (*inputRef).getSemantic();
-        domURIFragmentType source = ((*inputRef).getSource());
-        sourceElementRef = source.getElement();
-      }
+            //VERTICES will always appear first, if so, change sourceElementRef to point to the vertex source
+            if((*sourceElementRef).getElementType() == COLLADA_TYPE::VERTICES)
+            {
+                domVertices* pVert = (domVertices*)(&(*sourceElementRef));
+                domInputLocal_Array inputArray = pVert->getInput_array();
+                domInputLocalRef inputRef = inputArray.get(i);
+                strSem = (*inputRef).getSemantic();
+                domURIFragmentType source = ((*inputRef).getSource());
+                sourceElementRef = source.getElement();
+            }
 
-      if((*sourceElementRef).getElementType() == COLLADA_TYPE::SOURCE)
-      {
-        domSource* pSource = (domSource*)(&(*sourceElementRef));
-        vTmpSource.push_back(pSource);
-        domSource::domTechnique_commonRef techCommonRef = pSource->getTechnique_common();
-        domAccessorRef accessorRef = (*techCommonRef).getAccessor();
-        unsigned int stride = (*accessorRef).getStride();
+            if((*sourceElementRef).getElementType() == COLLADA_TYPE::SOURCE)
+            {
+                domSource* pSource = (domSource*)(&(*sourceElementRef));
+                vTmpSource.push_back(pSource);
+                domSource::domTechnique_commonRef techCommonRef = pSource->getTechnique_common();
+                domAccessorRef accessorRef = (*techCommonRef).getAccessor();
+                unsigned int stride = (*accessorRef).getStride();
 
-        Ogre::VertexElementType type = Ogre::VET_FLOAT2;
-        if(stride == 3)
-          type = Ogre::VET_FLOAT3;
-        else if(stride == 4)
-          type = Ogre::VET_FLOAT4;
+                Ogre::VertexElementType type = Ogre::VET_FLOAT2;
+                if(stride == 3)
+                    type = Ogre::VET_FLOAT3;
+                else if(stride == 4)
+                    type = Ogre::VET_FLOAT4;
 
-        Ogre::VertexElementSemantic sem;
-        if(strSem == "POSITION")
-          sem = Ogre::VES_POSITION;
-        else if(strSem == "NORMAL")
-          sem = Ogre::VES_NORMAL;
-        else if(strSem == "TEXCOORD")
-          sem = Ogre::VES_TEXTURE_COORDINATES;
-   
-        else
+                Ogre::VertexElementSemantic sem;
+                if(strSem == "POSITION")
+                    sem = Ogre::VES_POSITION;
+                else if(strSem == "NORMAL")
+                    sem = Ogre::VES_NORMAL;
+                else if(strSem == "TEXCOORD")
+                    sem = Ogre::VES_TEXTURE_COORDINATES;
+
+                else
+                {
+                    {
+                    
+                    }
+
+                    std::cerr << "Unknown semantic " << strSem << std::endl;
+                    return;
+                }
+
+                size_t offset = pDecl->getVertexSize(0);
+                pDecl->addElement(0, offset, type, sem);
+            }
+        }
+        //is this a declaration that is already there?
+        bool bFound = false;
+        for(unsigned int i = 0; i < m_vDeclarations.size(); ++i)
         {
-          std::cerr << "Unknown semantic " << strSem << std::endl;
-          return;
+            if(*(m_vDeclarations[i]) == (*pDecl))
+            {
+                pSubMesh->indexData->indexStart = m_vIVD[i].vertexCount;
+                m_vIVD[i].vertexCount += pTris->getCount() * 3;
+                pSubMesh->indexData->indexCount = pTris->getCount() * 3;
+                copyData(pTris->getP(), vTmpSource, &(m_vIVD[i]), m_vDeclarations[i], &(const_cast<Ogre::AxisAlignedBox&>(pOgreMesh->getBounds())));
+                bFound = true;    
+                break;
+            }
         }
-
-        size_t offset = pDecl->getVertexSize(0);
-        pDecl->addElement(0, offset, type, sem);
-      }
+        if(!bFound)
+        {
+            m_vDeclarations.push_back(pDecl);
+            IntermediateVertexData IVD;
+            IVD.vertexCount = pTris->getCount() * 3;
+            pSubMesh->indexData->indexCount = IVD.vertexCount;
+            m_vIVD.push_back(IVD);
+            copyData(pTris->getP(), vTmpSource, &(m_vIVD[m_vIVD.size() - 1]), m_vDeclarations[m_vDeclarations.size() - 1], &(const_cast<Ogre::AxisAlignedBox&>(pOgreMesh->getBounds())));
+        }
     }
-    //is this a declaration that is already there?
-    bool bFound = false;
-    for(unsigned int i = 0; i < m_vDeclarations.size(); ++i)
-    {
-      if(*(m_vDeclarations[i]) == (*pDecl))
-      {
-        pSubMesh->indexData->indexStart = m_vIVD[i].vertexCount;
-        m_vIVD[i].vertexCount += pTris->getCount() * 3;
-        pSubMesh->indexData->indexCount = pTris->getCount() * 3;
-        copyData(pTris->getP(), vTmpSource, &(m_vIVD[i]), m_vDeclarations[i], &(const_cast<Ogre::AxisAlignedBox&>(pOgreMesh->getBounds())));
-        bFound = true;    
-        break;
-      }
-    }
-    if(!bFound)
-    {
-      m_vDeclarations.push_back(pDecl);
-      IntermediateVertexData IVD;
-      IVD.vertexCount = pTris->getCount() * 3;
-      pSubMesh->indexData->indexCount = IVD.vertexCount;
-      m_vIVD.push_back(IVD);
-      copyData(pTris->getP(), vTmpSource, &(m_vIVD[m_vIVD.size() - 1]), m_vDeclarations[m_vDeclarations.size() - 1], &(const_cast<Ogre::AxisAlignedBox&>(pOgreMesh->getBounds())));
-    }
-  }
-  pOgreMesh->sharedVertexData->vertexDeclaration = m_vDeclarations[0];
+    pOgreMesh->sharedVertexData->vertexDeclaration = m_vDeclarations[0];
 }
-
+//------------------------------------------------------------------------------
 void CGeometryConverter::copyData(domPRef pRef, const std::vector<domSource*> &vSource, IntermediateVertexData* pDest, Ogre::VertexDeclaration* pVertexDecl, Ogre::AxisAlignedBox* pAABB)
 {
-  domListOfUInts indexList = (*pRef).getValue();
-  //cache some values to save time in the copy loop
-  domAccessorRef* dAR = new domAccessorRef[pVertexDecl->getElementCount()];
-  for(unsigned int i = 0; i < pVertexDecl->getElementCount(); ++i)
-    dAR[i] = vSource[i]->getTechnique_common()->getAccessor();
+    domListOfUInts indexList = (*pRef).getValue();
+    //cache some values to save time in the copy loop
+    domAccessorRef* dAR = new domAccessorRef[pVertexDecl->getElementCount()];
+    for(unsigned int i = 0; i < pVertexDecl->getElementCount(); ++i)
+        dAR[i] = vSource[i]->getTechnique_common()->getAccessor();
 
-  for(unsigned int j = 0; j < indexList.getCount(); ++j)
-  {
-    unsigned int index = indexList[j];
-    switch(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getType())
+    for(unsigned int j = 0; j < indexList.getCount(); ++j)
     {
-    case Ogre::VET_FLOAT2:
-      {
-        Ogre::Vector2 vec2;
-        vec2.x = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 2);
-        vec2.y = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 2 + 1);
-        if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_TEXTURE_COORDINATES)
+        unsigned int index = indexList[j];
+        switch(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getType())
         {
-          if(m_convOptions.flipTextureH == true)
-            vec2.y *= -1.0;
-          else if(m_convOptions.flipTextureV == true)
-            vec2.x *= -1.0;
+        case Ogre::VET_FLOAT2:
+            {
+                Ogre::Vector2 vec2;
+                vec2.x = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 2);
+                vec2.y = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 2 + 1);
+                if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_TEXTURE_COORDINATES)
+                {
+                    if(m_convOptions.flipTextureH == true)
+                        vec2.y *= -1.0;
+                    else if(m_convOptions.flipTextureV == true)
+                        vec2.x *= -1.0;
+                }
+                pDest->data.push_back(vec2.x);
+                pDest->data.push_back(vec2.y);
+            }
+        case Ogre::VET_FLOAT3:
+            {
+                Ogre::Vector3 vec3;
+                vec3.x = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3);
+                vec3.y = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3 + 1);
+                vec3.z = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3 + 2);
+                if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_TEXTURE_COORDINATES)
+                {
+                    if(m_convOptions.flipTextureH == true)
+                        vec3.y *= -1.0;
+                    else if(m_convOptions.flipTextureV == true)
+                        vec3.x *= -1.0;
+                }
+                else
+                {
+                    if(m_zUp)
+                        vec3 = flipAxes(&vec3);
+                    if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_POSITION)
+                        pAABB->merge(vec3);
+                }
+                pDest->data.push_back(vec3.x);
+                pDest->data.push_back(vec3.y);
+                pDest->data.push_back(vec3.z);
+            }
         }
-        pDest->data.push_back(vec2.x);
-        pDest->data.push_back(vec2.y);
-      }
-    case Ogre::VET_FLOAT3:
-      {
-        Ogre::Vector3 vec3;
-        vec3.x = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3);
-        vec3.y = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3 + 1);
-        vec3.z = vSource[j % pVertexDecl->getElementCount()]->getFloat_array()->getValue().get(index * 3 + 2);
-        if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_TEXTURE_COORDINATES)
-        {
-          if(m_convOptions.flipTextureH == true)
-            vec3.y *= -1.0;
-          else if(m_convOptions.flipTextureV == true)
-            vec3.x *= -1.0;
-        }
-        else
-        {
-          if(m_zUp)
-            vec3 = flipAxes(&vec3);
-          if(pVertexDecl->getElement(j % pVertexDecl->getElementCount())->getSemantic() == Ogre::VES_POSITION)
-            pAABB->merge(vec3);
-        }
-        pDest->data.push_back(vec3.x);
-        pDest->data.push_back(vec3.y);
-        pDest->data.push_back(vec3.z);
-      }
     }
-  }
 }
+//------------------------------------------------------------------------------

cologre-ng/src/MaterialConverter.cpp

 //-----------------------------------------------------------------------------
 int CMaterialConverter::convert(daeDatabase* pDatabase)
 {
+    m_pLog->logMessage("Converting materials");
+    m_pLog->logMessage("-------------------------------------------------");
+
+
     unsigned int numElements = pDatabase->getElementCount(NULL, "material", NULL);
     for(unsigned int i = 0; i < numElements; i++)
     {
             }
         }
     }
+
+    m_pLog->logMessage("\n\n\n");
+
     return 0;
 }
 //-----------------------------------------------------------------------------
                 if(m_spLocations->find(pathBasename.first) == m_spLocations->end())
                 {
                     std::stringstream s;
-                    s << "Adding location " << pathBasename.first << " resource manager";
+                    s << "Adding location " << pathBasename.first << " to global resource manager";
                     m_pLog->logMessage(s.str());
 
                     Ogre::ResourceGroupManager::getSingleton().addResourceLocation(pathBasename.first, "FileSystem", "DaeCustom");

ogre-cologre-test/ColladaLoaderApp.cpp

     //
     //if(ret = db.load("../../../media/indochine.DAE"))
     //exit(-1);
-    ret = db.load("../../media/indochine.DAE");
-    //ret = db.load("../../media/cube.dae");
-    //assert(ret != 0);              
+    //ret = db.load("../../media/indochine_tris.DAE");
+
+    ret = db.load("../../media/cube.dae");
+    assert(ret == 0);              
 
     db.convertResources();
     _dumpResourceList();

ogre-cologre-test/ColladaLoaderApp.h

 #include "cologre.h"           
 
 
-
-
 class ColladaLoaderApp : public ExampleApplication
 {
 public:

ogre-cologre-test/ExampleApplication.h

         Light *light = mSceneMgr->createLight("light");
         //light->setPosition(0, 300, 0);
         mcameraNode->attachObject(light);
-
     }
     virtual void createFrameListener(void)
     {