Changeset 2119


Ignore:
Timestamp:
02/15/07 14:45:30 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj

    r2100 r2119  
    7373                                Name="VCCLCompilerTool" 
    7474                                AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include" 
    75                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 
     75                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r1823 r2119  
    142142        void VisualizeViewCells(const bool visualize); 
    143143 
     144        /** Load an iv scene. 
     145        */ 
    144146        bool LoadSceneIV(const String &filename,  
    145147                                         SceneNode *root,  
    146148                                         const int index); 
    147149 
    148         bool LoadScene(const String &filename); 
     150        /** Load obj scene. 
     151        */ 
     152        bool LoadSceneObj(const String &filename, 
     153                                          const String &viewCellsFile, 
     154                                          SceneNode *root); 
     155 
     156        /** Load a scene. 
     157        */ 
     158        bool LoadScene(const String &filename, const String &viewCellsFilename); 
    149159 
    150160        void loadConfig(DataStreamPtr& stream); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2115 r2119  
    2323#include "IntersectableWrapper.h" 
    2424#include "IVReader.h" 
     25#include "ObjReader.h" 
     26 
    2527 
    2628 
     
    154156 
    155157        // load the scene 
    156         LoadScene(mFilename); 
    157          
    158         // load view cells 
    159         //mViewCellsLoaded = LoadViewCells(mViewCellsFilename); 
     158        LoadScene(mFilename, mViewCellsFilename); 
     159         
     160        // load view cells: load later ... 
     161        if (0) mViewCellsLoaded = LoadViewCells(mViewCellsFilename); 
    160162 
    161163        if (mShowTerrain) 
     
    15921594} 
    15931595//----------------------------------------------------------------------- 
    1594 bool OcclusionCullingSceneManager::LoadScene(const String &filename) 
     1596bool OcclusionCullingSceneManager::LoadScene(const String &filename,  
     1597                                                                                         const String &viewCellsFilename) 
    15951598{ 
    15961599        using namespace std; 
     
    16201623                const string fn = *fit; 
    16211624 
    1622                 if (strstr(fn.c_str(), ".iv") || strstr(fn.c_str(), ".wrl")) 
     1625                if (strstr(fn.c_str(), ".obj")) 
     1626                { 
     1627                        // load iv files 
     1628                        if (!LoadSceneObj(filename, viewCellsFilename, getRootSceneNode())) 
     1629                        { 
     1630                                LogManager::getSingleton().logMessage("error loading file"); 
     1631                                return false; 
     1632            } 
     1633                } 
     1634                else if (strstr(fn.c_str(), ".iv") || strstr(fn.c_str(), ".wrl")) 
    16231635                { 
    16241636                        // load iv files 
     
    16821694} 
    16831695//----------------------------------------------------------------------- 
     1696bool OcclusionCullingSceneManager::LoadSceneObj(const String &filename, 
     1697                                                                                                const String &viewCellsFile, 
     1698                                                                                                SceneNode *root) 
     1699{ 
     1700        ObjReader objReader(this); 
     1701 
     1702        Timer *timer = PlatformManager::getSingleton().createTimer(); 
     1703        timer->reset(); 
     1704 
     1705        if (!objReader.LoadFile(filename.c_str(), viewCellsFile, root)) 
     1706        { 
     1707                PlatformManager::getSingleton().destroyTimer(timer); 
     1708                return false; 
     1709        } 
     1710 
     1711        SceneNode *node = root->createChildSceneNode("ObjSceneNode"); 
     1712 
     1713        std::stringstream d;  
     1714        d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs"; 
     1715        LogManager::getSingleton().logMessage(d.str()); 
     1716                 
     1717        PlatformManager::getSingleton().destroyTimer(timer); 
     1718 
     1719        return true; 
     1720} 
     1721//----------------------------------------------------------------------- 
    16841722const String OcclusionCullingSceneManagerFactory::FACTORY_TYPE_NAME = "OcclusionCullingSceneManager"; 
    16851723//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r2111 r2119  
    8989                                OptimizeForProcessor="3" 
    9090                                OptimizeForWindowsApplication="TRUE" 
    91                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer" 
    92                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 
     91                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 
     92                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1" 
    9393                                StringPooling="TRUE" 
    9494                                RuntimeLibrary="2" 
     
    105105                                Name="VCLinkerTool" 
    106106                                IgnoreImportLibrary="TRUE" 
    107                                 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib IVReader.lib" 
     107                                AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib IVReader.lib ObjReader.lib" 
    108108                                OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 
    109109                                Version="0.99" 
    110110                                LinkIncremental="1" 
    111111                                SuppressStartupBanner="TRUE" 
    112                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)&quot;" 
     112                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\lib\$(ConfigurationName)&quot;" 
    113113                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    114114                                GenerateDebugInformation="FALSE" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h

    r2115 r2119  
    22#define __ObjReader_H__ 
    33 
    4 //#include <stdlib> 
    54#include <string> 
    65#include <vector> 
    76#include <Ogre.h> 
    87#include "Containers.h" 
    9 /*#include "ObjNode.h" 
    10 #include "ObjMeshData.h" 
    11 #include "ObjManualMeshLoader.h" 
    12 */ 
    138 
    14  
    15 namespace GtpVisibilityPreprocessor { 
    16  
    17 struct Triangle3; 
    18  
    19 } 
    20  
    21 //typedef std::vector<GtpVisibilityPreprocessor::Triangle3 *> TriangleContainer; 
    229 
    2310class __declspec(dllexport) ObjReader 
    2411{ 
    2512public: 
    26         ObjReader(); 
     13        ObjReader(Ogre::SceneManager *sceneManager); 
    2714        ~ObjReader(); 
    2815 
    29         bool LoadFile(const std::string &filename, 
    30                                   GtpVisibilityPreprocessor::ObjectContainer &objects) const; 
     16        bool LoadFile(const string &sceneName,  
     17                                  const string &visibilitySolution, 
     18                                  Ogre::SceneNode *root); 
    3119         
    32         const std::vector<Ogre::Entity *> &GetObjects() const; 
    33          
    34         Ogre::Entity *CreateEntity(const std::string &name); 
     20        Ogre::Entity *CreateEntity(const std::string &name, 
     21                                                           GtpVisibilityPreprocessor::Intersectable *object); 
    3522 
    3623protected: 
    3724 
    38         std::vector<Ogre::Entity *> mObjects; 
     25        Ogre::SceneManager *mSceneManager; 
    3926}; 
    4027 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp

    r2115 r2119  
    33#include "Triangle3.h" 
    44#include "IntersectableWrapper.h" 
     5#include "BvHierarchy.h" 
     6#include "Preprocessor.h" 
     7#include "OgreEntity.h" 
     8#include "PreprocessorFactory.h" 
     9#include "OgreLogManager.h" 
    510 
    611 
    7 ObjReader::ObjReader() 
     12 
     13ObjReader::ObjReader(Ogre::SceneManager *sceneManager): 
     14mSceneManager(sceneManager) 
    815{} 
    916 
     
    1320 
    1421 
    15 bool ObjReader::LoadFile(const string &filename, 
    16                                                  GtpVisibilityPreprocessor::ObjectContainer &objects) const 
     22bool ObjReader::LoadFile(const string &sceneName,  
     23                                                 const string &visibilitySolution, 
     24                                                 Ogre::SceneNode *root) 
    1725{ 
    18         igzstream samplesIn(filename.c_str()); 
    19          
    20         if (!samplesIn.is_open()) 
     26        GtpVisibilityPreprocessor::Debug.open("debug.log"); 
     27        // HACK: get any preprocessor to load file 
     28        GtpVisibilityPreprocessor::Preprocessor *preprocessor =  
     29                GtpVisibilityPreprocessor::PreprocessorFactory::CreatePreprocessor("vss"); 
     30 
     31        // hack 
     32        preprocessor->mLoadMeshes = false; 
     33        GtpVisibilityPreprocessor::ObjectContainer pvsObjects; 
     34 
     35        Ogre::LogManager::getSingleton().logMessage("loading obj scene!!"); 
     36 
     37        if (preprocessor->LoadScene(sceneName)) 
     38        { 
     39                Ogre::LogManager::getSingleton().logMessage("scene loaded, loading objects"); 
     40                // form objects from the scene triangles 
     41                if (!preprocessor->LoadObjects(visibilitySolution, pvsObjects, preprocessor->mObjects)) 
     42                { 
     43                        Ogre::LogManager::getSingleton().logMessage("objects cannot be loaded"); 
     44                        return false; 
     45                } 
     46        } 
     47        else 
     48        { 
     49                Ogre::LogManager::getSingleton().logMessage("scene cannot be loaded"); 
    2150                return false; 
    22          
    23         // read in triangle size 
    24         int numTriangles; 
     51        } 
    2552 
    26         samplesIn.read(reinterpret_cast<char *>(&numTriangles), sizeof(int)); 
    27         objects.reserve(numTriangles); 
    28          
    29         while (1) 
    30         { 
    31                 GtpVisibilityPreprocessor::Triangle3 tri; 
    32                  
    33                 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 0),  
    34                                            sizeof(GtpVisibilityPreprocessor::Vector3)); 
    35                 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 1),  
    36                                            sizeof(GtpVisibilityPreprocessor::Vector3)); 
    37                 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 2),  
    38                                            sizeof(GtpVisibilityPreprocessor::Vector3)); 
     53        std::stringstream d;  
     54        d << "successfully loaded " << pvsObjects.size() << " objects"; 
    3955 
    40                 // end of file reached 
    41                 if (samplesIn.eof()) 
    42                         break; 
     56        Ogre::LogManager::getSingleton().logMessage(d.str()); 
    4357 
    44                 GtpVisibilityPreprocessor::TriangleIntersectable *obj =  
    45                         new GtpVisibilityPreprocessor::TriangleIntersectable(tri); 
    46                 objects.push_back(obj); 
     58        GtpVisibilityPreprocessor::ObjectContainer::const_iterator oit, oit_end = pvsObjects.end(); 
     59 
     60        int i = 0; 
     61        for (oit = pvsObjects.begin(); oit != oit_end; ++ oit, ++ i) 
     62        {Ogre::LogManager::getSingleton().logMessage("r"); 
     63                const Ogre::String entname = "Object" + i; 
     64 
     65                Ogre::Entity *ent = CreateEntity(entname, *oit); 
     66 
     67                const Ogre::String nodeName = entname + "/Node"; 
     68                root->createChildSceneNode(nodeName); 
    4769        } 
    48          
    49         return true; 
     70 
     71        delete preprocessor; 
     72 
     73        return false; 
    5074} 
    5175 
    5276 
    53 const std::vector<Ogre::Entity *> &ObjReader::GetObjects() const 
    54 { 
    55         return mObjects; 
    56 } 
    57  
    58  
    59 Ogre::Entity *ObjReader::CreateEntity(const std::string &name) 
    60 //                                                                        ObjMeshData *mData,  
    61 //                                                                        Ogre::Vector3 *translation) 
     77Ogre::Entity *ObjReader::CreateEntity(const std::string &name, 
     78                                                                          GtpVisibilityPreprocessor::Intersectable *object) 
    6279{ 
    6380        using namespace Ogre; 
     81        //using namespace GtpVisibilityPreprocessor; 
     82 
    6483        Entity *entity; 
    6584 
    66          
    67         std::string meshName = name.substr(name.find('/',0), name.length()) + "/Mesh"; 
     85        GtpVisibilityPreprocessor::BvhLeaf *bvhObj =  
     86                static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object); 
     87 
     88        std::string meshName = name + "/Mesh"; 
    6889        std::string entityName = name + "/Entity"; 
    6990 
    7091        MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "ObjGroup"); 
    7192        SubMesh* submesh = mesh->createSubMesh(); 
    72 int nbVertices = 99992; 
     93 
    7394        // We must create the vertex data, indicating how many vertices there will be 
    7495        submesh->useSharedVertices = false; 
    7596        submesh->vertexData = new VertexData(); 
    7697        submesh->vertexData->vertexStart = 0; 
    77         submesh->vertexData->vertexCount = nbVertices; 
     98        submesh->vertexData->vertexCount = (int)bvhObj->mObjects.size() * 3; 
    7899 
    79100        static const unsigned short source = 0; 
     
    82103        VertexDeclaration* declaration = HardwareBufferManager::getSingleton().createVertexDeclaration(); 
    83104 
    84         offset += declaration->addElement(source,offset,VET_FLOAT3,VES_POSITION).getSize(); 
     105        offset += declaration->addElement(source, offset, VET_FLOAT3,VES_POSITION).getSize(); 
    85106        //      offset += declaration->addElement(source,offset,VET_FLOAT3,VES_NORMAL).getSize(); 
    86107        //      offset += declaration->addElement(source,offset,VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize(); 
     
    89110        int numVertices = 0; 
    90111 
    91         HardwareVertexBufferSharedPtr vbuffer =  
    92                 HardwareBufferManager::getSingleton().createVertexBuffer(declaration->getVertexSize(source), // size of one whole vertex 
    93                 submesh->vertexData->vertexCount, // number of vertices 
    94                 HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage 
    95                 false); // no shadow buffer 
     112        HardwareVertexBufferSharedPtr vbuffer = HardwareBufferManager::getSingleton(). 
     113                createVertexBuffer(declaration->getVertexSize(source), 
     114                                                   submesh->vertexData->vertexCount, 
     115                                                   HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
     116                                                   false); 
    96117 
    97  
    98         // No we get access to the buffer to fill it.  During so we record the bounding box. 
     118    // No we get access to the buffer to fill it.  During so we record the bounding box. 
    99119        AxisAlignedBox aabox; 
    100120 
    101121        float* vdata = static_cast<float*>(vbuffer->lock(HardwareBuffer::HBL_DISCARD)); 
    102122 
    103         for (size_t i = 0; i < nbVertices; ++ i) 
     123        GtpVisibilityPreprocessor::ObjectContainer::const_iterator oit, oit_end = bvhObj->mObjects.end(); 
     124 
     125        for (oit = bvhObj->mObjects.begin(); oit != oit_end; ++ oit) 
    104126        { 
    105                 // Position 
    106                 Vector3 position;// = 20.0f*positions[i]; 
    107                 *vdata++ = position.x; 
    108                 *vdata++ = position.y; 
    109                 *vdata++ = position.z; 
    110                 aabox.merge(position); 
    111                 // Normal 
    112                 Vector3 normal = position.normalisedCopy(); 
    113                 *vdata++ = normal.x; 
    114                 *vdata++ = normal.y; 
    115                 *vdata++ = normal.z; 
     127                GtpVisibilityPreprocessor::TriangleIntersectable *tObj =  
     128                        static_cast<GtpVisibilityPreprocessor::TriangleIntersectable *>(*oit); 
     129                 
     130                GtpVisibilityPreprocessor::Triangle3 tri = tObj->GetItem(); 
    116131 
    117                 // Texture coordinate 
    118                 Vector2 tcoordinate;// = tcoordinates[i]; 
    119                 *vdata ++ = tcoordinate.x; 
     132                for (int i = 0; i < 3; ++ i) 
     133                { 
     134                        Vector3 vtx(tri.mVertices[i]); 
    120135 
    121                 *vdata ++ = tcoordinate.y; 
     136                        *vdata ++ = vtx.x; 
     137                        *vdata ++ = vtx.y; 
     138                        *vdata ++ = vtx.z; 
    122139 
     140                        aabox.merge(vtx); 
     141                } 
    123142        } 
    124143 
     
    126145 
    127146        // We must indicate the bounding box 
    128         //mesh->_setBounds(aabox);  
     147        mesh->_setBounds(aabox);  
    129148 
    130         //mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0);  
    131  
     149        mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0);  
    132150        mesh->load(); 
    133151         
    134152        // Create an entity with the mesh 
    135         //entity = mSceneManager->createEntity(meshName, entityName); 
     153        entity = mSceneManager->createEntity(meshName, entityName); 
    136154 
    137155        return entity; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj

    r2112 r2119  
    7373                                Name="VCCLCompilerTool" 
    7474                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;..\include;..\..\..\Preprocessing\src" 
    75                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 
     75                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r2115 r2119  
    365365{ 
    366366        friend class ViewCellsParseHandlers; 
     367        friend class ObjectsParseHandlers; 
    367368        friend class HierarchyManager; 
    368369 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp

    r2042 r2119  
    236236 
    237237        while (fgets(str, 1000, file) != NULL) 
    238         {++ line; 
     238        { 
     239                ++ line; 
    239240          switch (str[0])  
    240241                { 
    241242                case 'v': // vertex  or normal 
    242243                  { 
    243                         switch (str[1]) { 
     244                        switch (str[1])  
     245                        { 
    244246                        case 'n' : 
    245                           // normal do nothing 
    246                           break; 
     247                                // normal do nothing 
     248                                break; 
    247249                        default: 
    248                           float x, y, z; //cout << "v";  
    249                           sscanf(str + 1, "%f %f %f", &x, &y, &z); 
    250                           vertices.push_back(Vector3(x,y,z)); 
    251                           //cout << "vertex: " << vertices.back() << endl; 
     250                                float x, y, z; //cout << "v";    
     251                                sscanf(str + 1, "%f %f %f", &x, &y, &z); 
     252                                vertices.push_back(Vector3(x,y,z)); 
     253                          
    252254                        } 
    253255                        break; 
     
    258260                                { 
    259261                                        Face *face = LoadFace(str, vertices, hashTable); 
     262 
    260263                                        if (!face) break; 
    261264         
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.cpp

    r2115 r2119  
    8888        //if (!is_sorted(mPvsObjects.begin(), mPvsObjects.end(), ilt)) 
    8989                sort(mPvsObjects.begin(), mPvsObjects.end(), ilt); 
    90  
     90Debug << "here333"; 
    9191        //if (!is_sorted(mPreprocessorObjects.begin(), mPreprocessorObjects.end(), ilt)) 
    9292                //sort(mPreprocessorObjects.begin(), mPreprocessorObjects.end(), ilt); 
     
    133133        if (element == "Leaf")  
    134134        { 
    135                 //cout << "l"; 
    136135                StartBvhLeaf(attributes); 
    137136        } 
     
    196195} 
    197196 
     197 
    198198void ObjectsParseHandlers::StartBvhLeaf(AttributeList& attributes) 
    199199{ 
     
    217217                        sscanf(ptr, "%f %f %f", &maxBox.x, &maxBox.y, &maxBox.z); 
    218218                } 
    219                 /*if (attrName == "objects") 
     219                if (attrName == "objects") 
    220220                { 
    221221                        StartBvhLeafObjects(objects, ptr); 
    222                 }*/ 
     222                } 
    223223        } 
    224224 
     
    227227        BvhLeaf *leaf = new BvhLeaf(box, NULL, (int)objects.size()); 
    228228 
    229         //leaf->mObjects = objects; 
    230         //BvHierarchy::AssociateObjectsWithLeaf(leaf); 
     229        leaf->mObjects = objects; 
     230        BvHierarchy::AssociateObjectsWithLeaf(leaf); 
    231231 
    232232        // new pvs object 
     
    370370 
    371371                        GzFileInputSource isource(myFilePath); 
     372                        Debug<<"here93" << endl; 
    372373                        parser->parse(isource); 
    373374#else 
     
    375376 
    376377#endif 
    377  
     378Debug<<"here932" << endl; 
    378379                        const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis(); 
    379380                        duration = endMillis - startMillis; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.h

    r2115 r2119  
    1515{ 
    1616public: 
    17   ObjectsParser(): Parser() {} 
     17         
     18        ObjectsParser(): Parser() {} 
    1819   
    19   bool ParseObjects(const string &filename,  
    20                                         ObjectContainer &pvsObjects, 
    21                                         const ObjectContainer &preprocessorObjects); 
     20        bool ParseObjects(const string &filename,  
     21                                          ObjectContainer &pvsObjects, 
     22                                          const ObjectContainer &preprocessorObjects); 
    2223}; 
    2324 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h

    r2115 r2119  
    2525{ 
    2626public: 
     27 
     28        friend class BvHierarchy; 
    2729 
    2830        // ----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2117 r2119  
    479479        const int files = SplitFilenames(filename, filenames); 
    480480        cout << "number of input files: " << files << endl; 
     481 
    481482        bool result = false; 
    482483        bool isObj = false; 
     
    533534                 
    534535                                result = parser->ParseFile(filename,  
    535                                                                    mSceneGraph->GetRoot(), 
    536                                                                    mLoadMeshes, 
    537                                                                    fi); 
    538                                                  
     536                                                                                   mSceneGraph->GetRoot(), 
     537                                                                                   mLoadMeshes, 
     538                                                                                   fi); 
     539 
    539540                                cout << "loaded " << (int)mSceneGraph->GetRoot()->mGeometry.size() << " entities" << endl; 
     541 
    540542                                // only works for triangles 
    541543                                if (result && !mLoadMeshes) 
    542544                                { 
    543545                                        cout << "exporting binary obj to " << bnFile << "... " << endl; 
     546 
    544547                                        ExportBinaryObj(bnFile, mSceneGraph->GetRoot()); 
     548                                 
    545549                                        cout << "finished" << endl; 
    546550                                } 
    547551 
    548552                                delete parser; 
    549                         } 
    550                         else if (0) 
    551                         { 
    552                                 ExportBinaryObj("../data/test.bn", mSceneGraph->GetRoot()); 
    553553                        } 
    554554                } 
     
    741741 
    742742        Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
    743                  
    744743                cout << "loading objects from " << buf << endl; 
    745744 
    746745                // load objects which will be used as pvs entries 
    747746                ObjectContainer pvsObjects; 
    748  
    749                 LoadObjects(buf, pvsObjects, mObjects); 
     747                if (0) LoadObjects(buf, pvsObjects, mObjects); 
    750748 
    751749                cout << "loading view cells from " << buf << endl; 
     
    16491647{ 
    16501648        ObjectsParser parser; 
    1651  
     1649Debug << "here322 " << filename << endl; 
    16521650        const bool success = parser.ParseObjects(filename,  
    16531651                                                                                         pvsObjects,  
  • GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorFactory.cpp

    r1942 r2119  
    1414Preprocessor *PreprocessorFactory::CreatePreprocessor(const string &preprocessorType) 
    1515{ 
     16        Debug << "here9191" << endl; 
    1617        if (preprocessorType == "vss") 
    17         { 
     18        {Debug << "here21112" << endl; 
    1819                return new VssPreprocessor(); 
    1920        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp

    r2105 r2119  
    22642264   
    22652265  int startIndex = (int)rays.size(); 
    2266   //  Debug<<"B"<<flush; 
    2267    
     2266     
    22682267  AxisAlignedBox3 box = GetBBox(leaf); 
    22692268  AxisAlignedBox3 dirBox = GetDirBBox(leaf); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2117 r2119  
    26092609        } 
    26102610#else 
    2611         cout<<"b"; 
    26122611        pvs.AddSample(obj, pdf); 
    26132612#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r2115 r2119  
    464464        if (element == "BoundingBox") 
    465465        { 
    466                 // cout << "b"; 
    467466                StartBoundingBox(attributes); 
    468467        } 
Note: See TracChangeset for help on using the changeset viewer.