Changeset 2122


Ignore:
Timestamp:
02/15/07 19:09:13 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
10 edited

Legend:

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

    r2119 r2122  
    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_MODULE1" 
     75                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2119 r2122  
    600600void OcclusionCullingSceneManager::_renderVisibleObjects() 
    601601{ 
     602        // $$matt temp: Remove this!! 
     603        if (1)  
     604        { 
     605                getDestinationRenderSystem()->_setCullingMode(CULL_NONE); 
     606                LogManager::getSingleton().logMessage("warning: culling mode"); 
     607        } 
     608 
    602609        if (mNormalExecution) 
    603610        { 
     
    800807        if (key == "DelayRenderTransparents") 
    801808        { 
     809                //LoadScene(mFilename, mViewCellsFilename); 
    802810                mDelayRenderTransparents = (*static_cast<const bool *>(val)); 
    803811                return true; 
     
    17091717        } 
    17101718 
    1711         SceneNode *node = root->createChildSceneNode("ObjSceneNode"); 
    1712  
    17131719        std::stringstream d;  
    17141720        d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs"; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp

    r1621 r2122  
    6767                GtpVisibilityPreprocessor::VertexIndexContainer::const_iterator  
    6868                        iit, iit_end = face->mVertexIndices.end(); 
    69                 //GtpVisibilityPreprocessor::VertexIndexContainer::const_reverse_iterator  
    70                 //      iit, iit_end = face->mVertexIndices.rend(); 
    7169 
    7270                for (iit = face->mVertexIndices.begin(); iit != iit_end; ++ iit) 
     
    7876 
    7977        manual->end(); 
    80         //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual); 
    8178 
    8279        return manual; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r2119 r2122  
    9090                                OptimizeForWindowsApplication="TRUE" 
    9191                                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" 
     92                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 
    9393                                StringPooling="TRUE" 
    9494                                RuntimeLibrary="2" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h

    r2119 r2122  
    2020        Ogre::Entity *CreateEntity(const std::string &name, 
    2121                                                           GtpVisibilityPreprocessor::Intersectable *object); 
    22  
     22        Ogre::ManualObject *CreateManualObject(const std::string &name, 
     23                                                           GtpVisibilityPreprocessor::Intersectable *object); 
    2324protected: 
    2425 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp

    r2119 r2122  
    5252 
    5353        std::stringstream d;  
    54         d << "successfully loaded " << pvsObjects.size() << " objects"; 
     54        d << "successfully loaded " << pvsObjects.size() << " objects from " << preprocessor->mObjects.size() << " preprocessor objects"; 
    5555 
    5656        Ogre::LogManager::getSingleton().logMessage(d.str()); 
     
    6060        int i = 0; 
    6161        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); 
     62        { 
     63                Ogre::LogManager::getSingleton().logMessage("r"); 
     64                const Ogre::String entname = "Object" + Ogre::StringConverter::toString(i); 
     65 
     66                Ogre::ManualObject *ent = CreateEntity(entname, *oit); 
     67 
     68                const Ogre::String nodeName = entname + "Node"; 
     69                Ogre::SceneNode* node = root->createChildSceneNode(nodeName); 
     70                node->attachObject(ent); 
     71 
     72                if (i > 100) 
     73                        break; 
    6974        } 
    7075 
    7176        delete preprocessor; 
    7277 
    73         return false; 
     78        return true; 
     79} 
     80 
     81 
     82Ogre::ManualObject *ObjReader::CreateManualObject(const std::string &name, 
     83                                                                                                  GtpVisibilityPreprocessor::Intersectable *object) 
     84{ 
     85        using namespace Ogre; 
     86        //using namespace GtpVisibilityPreprocessor; 
     87 
     88        std::string meshName = name + ".mesh"; 
     89        std::string entityName = name + "Entity"; 
     90 
     91GtpVisibilityPreprocessor::BvhLeaf *bvhObj =  
     92                static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object); 
     93        const int vertexCount = (int)bvhObj->mObjects.size() * 3; 
     94 
     95        ManualObject* manual = mSceneManager->createManualObject(entityName); 
     96        manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP); 
     97         
     98        // create vertices 
     99         
     100        GtpVisibilityPreprocessor::ObjectContainer::const_iterator oit, oit_end = bvhObj->mObjects.end(); 
     101         
     102        for (oit = bvhObj->mObjects.begin(); oit != oit_end; ++ oit) 
     103        { 
     104                GtpVisibilityPreprocessor::TriangleIntersectable *tObj =  
     105                        static_cast<GtpVisibilityPreprocessor::TriangleIntersectable *>(*oit); 
     106                 
     107                GtpVisibilityPreprocessor::Triangle3 tri = tObj->GetItem(); 
     108 
     109                for (int i = 0; i < 3; ++ i) 
     110                { 
     111                        const GtpVisibilityPreprocessor::Vector3 vtx = tri.mVertices[i]; 
     112                        manual->position(vtx.x, vtx.y, vtx.z); 
     113                        manual->colour(1.0f, 0.0f, 0.0f); 
     114                } 
     115        } 
     116 
     117        for (int i = 0; i < vertexCount; ++ i) 
     118        { 
     119                manual->index(i); 
     120        } 
     121 
     122        return manual; 
    74123} 
    75124 
     
    79128{ 
    80129        using namespace Ogre; 
    81         //using namespace GtpVisibilityPreprocessor; 
    82130 
    83131        Entity *entity; 
     
    86134                static_cast<GtpVisibilityPreprocessor::BvhLeaf *>(object); 
    87135 
    88         std::string meshName = name + "/Mesh"; 
    89         std::string entityName = name + "/Entity"; 
    90  
    91         MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "ObjGroup"); 
     136        std::string meshName = name + ".mesh"; 
     137        std::string entityName = name + "Entity"; 
     138 
     139        MeshPtr mesh = MeshManager::getSingleton().createManual(meshName, "Custom"); 
    92140        SubMesh* submesh = mesh->createSubMesh(); 
     141 
     142        const int vertexCount = (int)bvhObj->mObjects.size() * 3; 
    93143 
    94144        // We must create the vertex data, indicating how many vertices there will be 
     
    96146        submesh->vertexData = new VertexData(); 
    97147        submesh->vertexData->vertexStart = 0; 
    98         submesh->vertexData->vertexCount = (int)bvhObj->mObjects.size() * 3; 
     148        submesh->vertexData->vertexCount = vertexCount; 
     149 
     150        std::stringstream d; d << "objects: " << bvhObj->mObjects.size() << " vtx: " << submesh->vertexData->vertexCount << endl; 
     151        Ogre::LogManager::getSingleton().logMessage(d.str()); 
    99152 
    100153        static const unsigned short source = 0; 
     
    103156        VertexDeclaration* declaration = HardwareBufferManager::getSingleton().createVertexDeclaration(); 
    104157 
    105         offset += declaration->addElement(source, offset, VET_FLOAT3,VES_POSITION).getSize(); 
    106         //      offset += declaration->addElement(source,offset,VET_FLOAT3,VES_NORMAL).getSize(); 
    107         //      offset += declaration->addElement(source,offset,VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize(); 
     158        offset += declaration->addElement(source, offset, VET_FLOAT3, VES_POSITION).getSize(); 
     159        //offset += declaration->addElement(source, offset, VET_FLOAT3,VES_NORMAL).getSize(); 
     160        //offset += declaration->addElement(source, offset, VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize(); 
    108161 
    109162 
     
    113166                createVertexBuffer(declaration->getVertexSize(source), 
    114167                                                   submesh->vertexData->vertexCount, 
    115                                                    HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
    116                                                    false); 
     168                                                   HardwareBuffer::HBU_STATIC_WRITE_ONLY); 
    117169 
    118170    // No we get access to the buffer to fill it.  During so we record the bounding box. 
     
    132184                for (int i = 0; i < 3; ++ i) 
    133185                { 
    134                         Vector3 vtx(tri.mVertices[i]); 
     186                        Vector3 vtx = Vector3(tri.mVertices[i]); 
    135187 
    136188                        *vdata ++ = vtx.x; 
     
    138190                        *vdata ++ = vtx.z; 
    139191 
     192                        //std::stringstream d; d << vtx; 
     193                        //Ogre::LogManager::getSingleton().logMessage(d.str()); 
    140194                        aabox.merge(vtx); 
    141195                } 
    142196        } 
    143  
     197        //Ogre::LogManager::getSingleton().logMessage("***"); 
    144198        vbuffer->unlock(); 
     199         
     200        /*Ogre::RenderOperation rop; 
     201        submesh->_getRenderOperation(rop); 
     202        rop.useIndexes = false; 
     203*/ 
     204        ////// 
     205        //-- Creates the index data 
     206 
     207    submesh->vertexData->vertexBufferBinding->setBinding(source, vbuffer); 
     208 
     209        submesh->indexData->indexStart = 0; 
     210        // we use an index for every vertex 
     211        submesh->indexData->indexCount = vertexCount; 
     212        submesh->indexData->indexBuffer = 
     213            HardwareBufferManager::getSingleton(). 
     214                        createIndexBuffer(HardwareIndexBuffer::IT_16BIT, 
     215                                                          submesh->indexData->indexCount, 
     216                                                          HardwareBuffer::HBU_STATIC_WRITE_ONLY); 
     217        submesh->operationType = RenderOperation::OT_LINE_STRIP; 
     218        //uint16* idata = static_cast<uint16*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); 
     219    unsigned short* idata = static_cast<unsigned short*>(submesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); 
     220 
     221        for (int j = 0; j < vertexCount; ++ j) 
     222    { 
     223                *idata = j; 
     224                ++ idata; 
     225    } 
     226     
     227        submesh->indexData->indexBuffer->unlock(); 
     228 
     229        submesh->setMaterialName("BaseWhiteNoLighting");  
    145230 
    146231        // We must indicate the bounding box 
    147232        mesh->_setBounds(aabox);  
    148  
    149         mesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0);  
     233        mesh->_setBoundingSphereRadius((aabox.getMaximum() - aabox.getMinimum()).length() / 2.0);  
    150234        mesh->load(); 
    151          
     235        mesh->touch(); 
     236 
    152237        // Create an entity with the mesh 
    153         entity = mSceneManager->createEntity(meshName, entityName); 
     238        entity = mSceneManager->createEntity(entityName, meshName); 
     239 
     240        //entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAIN); 
    154241 
    155242        return entity; 
     243#endif 
    156244} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj

    r2119 r2122  
    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_MODULE1" 
     75                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE1;USE_VERBOSE_PVS" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2119 r2122  
    16471647{ 
    16481648        ObjectsParser parser; 
    1649 Debug << "here322 " << filename << endl; 
     1649 
    16501650        const bool success = parser.ParseObjects(filename,  
    16511651                                                                                         pvsObjects,  
     
    16581658 
    16591659        // hack: no bvh object could be found => take preprocessor objects 
    1660         if (!pvsObjects.empty()) 
    1661         { 
     1660        if (pvsObjects.empty()) 
     1661        { 
     1662                Debug << "here81 no objects" << endl; 
    16621663                pvsObjects = preprocessorObjects; 
    16631664        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h

    r2117 r2122  
    1010#ifdef USE_HASH_PVS 
    1111 
    12 #include "HashPvs.h" 
     12        #include "HashPvs.h" 
    1313 
    14 #define PVS_TYPE 0 
     14        #define PVS_TYPE 0 
    1515 
    16 namespace GtpVisibilityPreprocessor { 
    17 typedef HashPvs<Intersectable *, PvsData> DefaultPvs; 
    18 typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
    19 } 
     16        namespace GtpVisibilityPreprocessor { 
     17                typedef HashPvs<Intersectable *, PvsData> DefaultPvs; 
     18                typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
     19        } 
     20#else 
     21        #ifdef USE_BIT_PVS 
    2022 
    21 #endif 
     23                #include "BitVectorPvs.h" 
    2224 
    23 #ifdef USE_VERBOSE_PVS 
     25                #define PVS_TYPE 2 
    2426 
    25 #include "Pvs.h" 
     27                namespace GtpVisibilityPreprocessor { 
     28                        typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs; 
     29                        typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
     30                } 
    2631 
    27 #define PVS_TYPE 1 
     32        #else 
    2833 
    29 namespace GtpVisibilityPreprocessor { 
    30 typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs; 
    31 typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
    32 } 
    33 #endif 
     34                //#ifdef USE_VERBOSE_PVS 
     35                #include "Pvs.h" 
    3436 
     37                #define PVS_TYPE 1 
    3538 
    36 #ifdef USE_BIT_PVS 
    37  
    38 #include "BitVectorPvs.h" 
    39  
    40 #define PVS_TYPE 2 
    41  
    42 namespace GtpVisibilityPreprocessor { 
    43 typedef BitVectorPvs<Intersectable *, PvsData> DefaultPvs; 
    44 typedef BitVectorPvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
    45 } 
    46  
     39                namespace GtpVisibilityPreprocessor { 
     40                        typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs; 
     41                        typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
     42                } 
     43        #endif 
    4744#endif 
    4845 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2120 r2122  
    10181018 
    10191019 
     1020ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename,  
     1021                                                                                                  ObjectContainer &pvsObjects, 
     1022                                                                                                  bool finalizeViewCells, 
     1023                                                                                                  BoundingBoxConverter *bconverter) 
     1024                                                                                                  
     1025{ 
     1026        ObjectContainer preprocessorObjects; 
     1027 
     1028        return LoadViewCells(filename,  
     1029                                                 pvsObjects, 
     1030                                                 preprocessorObjects, 
     1031                                                 finalizeViewCells, 
     1032                                                 bconverter); 
     1033} 
    10201034 
    10211035 
Note: See TracChangeset for help on using the changeset viewer.