Commits

Frederic De Groef  committed 838f39e

remove utility rep from include dir. Client modules must use the relative path to it
removed output with stringstream, using utility::toString() in GeometryConverter

  • Participants
  • Parent commits e8c17b9

Comments (0)

Files changed (5)

File cologre-ng/cologre.vcproj

 				Name="VCCLCompilerTool"
 				AdditionalOptions="-Zm130"
 				Optimization="0"
-				AdditionalIncludeDirectories=".\include;.\utility;"$(OGRE14_HOME)\include";".\..\dependencies\collada-dom-2.2\include";".\..\dependencies\collada-dom-2.2\include\1.4";.\..\dependencies\boost;".\..\dependencies\uriparser-0.7.5\include""
+				AdditionalIncludeDirectories=".\include;"$(OGRE14_HOME)\include";".\..\dependencies\collada-dom-2.2\include";".\..\dependencies\collada-dom-2.2\include\1.4";.\..\dependencies\boost;".\..\dependencies\uriparser-0.7.5\include""
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;BOOST_ALL_NO_LIB;PCRE_STATIC;DOM_INCLUDE_LIBXML"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalOptions="-Zm130"
-				AdditionalIncludeDirectories=".\include;.\utility;&quot;$(OGRE14_HOME)\include&quot;;&quot;.\..\dependencies\collada-dom-2.2\include&quot;;&quot;.\..\dependencies\collada-dom-2.2\include\1.4&quot;;.\..\dependencies\boost;&quot;.\..\dependencies\uriparser-0.7.5\include&quot;"
+				AdditionalIncludeDirectories=".\include;&quot;$(OGRE14_HOME)\include&quot;;&quot;.\..\dependencies\collada-dom-2.2\include&quot;;&quot;.\..\dependencies\collada-dom-2.2\include\1.4&quot;;.\..\dependencies\boost;&quot;.\..\dependencies\uriparser-0.7.5\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;BOOST_ALL_NO_LIB;PCRE_STATIC;DOM_INCLUDE_LIBXML"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="2"

File cologre-ng/include/GeometryConverter.h

 #include "IntermediateMesh.h"
 #include "dom/domGeometry.h"
 
+#include <string>
+
 struct IntermediateVertexData
 {
   unsigned int vertexCount;
     */
     void copyData(domPRef pRef, const std::vector<domSource*> &vSource, IntermediateVertexData* pDest, Ogre::VertexDeclaration* pVertexDecl, Ogre::AxisAlignedBox* pAABB);
 
+    void _logMessage(const std::string &_msg){m_pLog->logMessage(_msg);};
+
+
+protected:
     ///for temporarily storing position, normal, txcoord, etc values 
     std::vector<float> m_vDataTmp;
     ///for temporarily storing offsets in the m_vDataTmp vector 

File cologre-ng/src/GeometryConverter.cpp

 #ifdef _DEBUG
 #include <cassert>
 #endif
-#include <sstream>
+
+#include "../Utility/Utility.h"
 
 //------------------------------------------------------------------------------
 CGeometryConverter::CGeometryConverter(Ogre::Log *_log) 
 //------------------------------------------------------------------------------
 int CGeometryConverter::convert(daeDatabase* pDatabase)
 {
-    m_pLog->logMessage("Converting geometry");
-    m_pLog->logMessage("-------------------------------------------------") ;
+    _logMessage("Converting geometry");
+    _logMessage("-------------------------------------------------") ;
 
     unsigned int numElements = pDatabase->getElementCount(NULL, "geometry", NULL);
 
-    {
-        std::stringstream s;
-        s << "Loading " << numElements << " meshes";
-        m_pLog->logMessage(s.str());
-    }
+    _logMessage(cologreng::utility::toString("Loading ", numElements, " meshes"));
 
     for(unsigned int i = 0; i < numElements; i++)
     {
             makeOgreMeshFromIntermediateMesh(&IM);
     }
 
-    m_pLog->logMessage("\n\n\n");
+    _logMessage("\n\n\n");
 
     return 0;
 }
 //------------------------------------------------------------------------------
 conversion_errors CGeometryConverter::loadGeometryToIntermediateMesh(domGeometry* pGeo, CIntermediateMesh* pIM)
 {
-    {
-        std::stringstream s;
-        s << "Loading mesh : " << pGeo->getName() << " to intermediate mesh";
-        m_pLog->logMessage(s.str());
-    }
+    _logMessage(cologreng::utility::toString("Loading mesh : ", pGeo->getName(), " to intermediate mesh"));
+
     domMeshRef colladaMesh = pGeo->getMesh();
 
     if(colladaMesh)
         domTriangles_Array triArray = (*colladaMesh).getTriangles_array();
         if(triArray.getCount() == 0)
         {
-            m_pLog->logMessage("No triangles found in mesh, other primitives currently not supported!");
+            _logMessage("No triangles found in mesh, other primitives currently not supported!");
             return ERROR_UNSUPPORTED;
         }
 
-        {
-            std::stringstream s;
-            s << "Loading " << triArray.getCount() << " triangle(s) ";
-            m_pLog->logMessage(s.str());
-        }
-
+        _logMessage(cologreng::utility::toString("Loading ", triArray.getCount(), " triangle(s)"));
+        
         for(unsigned int i = 0; i < triArray.getCount(); ++i)
         {
             pIM->m_subMeshCount++;
         }
     }
 
-    m_pLog->logMessage("");
+    _logMessage("");
 
     return ALL_OK;
 }
 //------------------------------------------------------------------------------
 void CGeometryConverter::makeOgreMeshFromIntermediateMesh(CIntermediateMesh *pIM)
 {
-    {
-        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());
-    }
-
+    cologreng::utility::toString("Making Ogre mesh from intermediate mesh : "
+                                , pIM->m_meshName
+                                , " [#submeshes : " , pIM->m_subMeshCount
+                                , " #vertices : " , pIM->m_positions.data.size()
+                                , " #normals : " , pIM->m_normals.data.size()
+                                ,  "]");
+    
     Ogre::MeshPtr pOgreMesh = Ogre::MeshManager::getSingleton().createManual(pIM->m_meshName, "DaeCustom");
     pOgreMesh->sharedVertexData = new Ogre::VertexData();
     Ogre::VertexDeclaration* pDecl = pOgreMesh->sharedVertexData->vertexDeclaration;
 
                 else
                 {
-                    {
-                    
-                    }
-
-                    std::cerr << "Unknown semantic " << strSem << std::endl;
+                    // TODO : should probabl throw an exception
+                    cologreng::utility::toString("[ERROR]", "Unknown semantic ", strSem);
                     return;
                 }
 
         }
     }
 }
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------

File cologre-ng/src/MaterialConverter.cpp

 #include <dom/domEffect.h>
 #include <dom/domMaterial.h>     
 
-#include "Utility.h"
+#include "../Utility/Utility.h"
 
 //-----------------------------------------------------------------------------
 CMaterialConverter::CMaterialConverter(Ogre::Log *_log, LocationsPtr _locations)  
     std::string uriPath = _uri.getPath();
     std::string uriScheme = _uri.getScheme();
 
-    std::string qualifiedName = convertUriToPath(makeFullUri(uriScheme, uriPath));
-
+    std::string fullURI = cologreng::utility::makeFullUri(uriScheme, uriPath); 
+    std::string qualifiedName = cologreng::utility::convertUriToPath(fullURI);
 
     std::string basename, path;
     Ogre::StringUtil::splitFilename(qualifiedName, basename, path);

File cologre-ng/utility/Utility.cpp

 
 #include <uriparser/Uri.h>
 
+namespace cologreng{
+namespace utility{
 
 //-----------------------------------------------------------------------------
 std::string makeFullUri(const std::string &_scheme, const std::string &_path)
 
     return s;
 }
-
+//-----------------------------------------------------------------------------
+}}