Ignore:
Timestamp:
04/29/06 19:11:23 (18 years ago)
Author:
mattausch
Message:

working on preprocessor integration
added iv stuff

Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r828 r863  
    1212#include "VisibilityManager.h" 
    1313#include "ViewCellsManager.h" 
     14 
     15//class GtpVisibilityPreprocessor::ViewCellsManager; 
    1416 
    1517 
     
    118120        void InitVisibilityCulling(Camera *cam); 
    119121 
     122        /** Finds object corresponding to this bounding box in the scene. 
     123        */ 
     124        MovableObject *FindCorrespondingObject(const AxisAlignedBox &box); 
     125 
     126        /** Identifies objects in the scene and gives them unique ids that 
     127                correspond to preprocessor ids. 
     128        */ 
     129        void IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects); 
     130 
    120131        /// the interface to the scene hierarchy. 
    121132        OctreeHierarchyInterface *mHierarchyInterface; 
     
    164175        /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer 
    165176        bool mExecuteVertexProgramForAllPasses; 
    166  
     177        /// if hierarchical culling is currently in use 
    167178        bool mIsHierarchicalCulling; 
    168179 
    169         ViewCellsManager *mViewCellsManager; 
     180        GtpVisibilityPreprocessor::ViewCellsManager *mViewCellsManager; 
    170181}; 
    171182 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreTypeConverter.h

    r860 r863  
    11#ifndef _OgreTypeConverter_H__ 
    22#define _OgreTypeConverter_H__ 
    3  
     3  
     4#include "OgreAxisAlignedBox.h" 
    45#include "AxisAlignedBox3.h" 
    5 #include "OgreAxisAlignedBox.h" 
    66#include "Vector3.h" 
    7 #include "OgreVector3.h" 
    87 
    98 
    109namespace Ogre { 
    11    
     10  
    1211/** 
    13         Class which converts our types to OGRE types 
     12        Class which converts preprocessor types to OGRE types 
    1413*/ 
    1514class __declspec(dllexport) OgreTypeConverter 
    1615{ 
    1716public: 
    18  
     17        /** Converts Ogre AABB to preprocessor AABB. 
     18        */ 
    1919        static GtpVisibilityPreprocessor::AxisAlignedBox3 ConvertFromOgre(const AxisAlignedBox &box); 
     20        /** Converts Ogre vector to preprocessor vector. 
     21        */ 
    2022        static GtpVisibilityPreprocessor::Vector3 ConvertFromOgre(const Vector3 &v); 
    21          
     23        /** Converts preprocessor AABB to Ogre AABB. 
     24        */ 
    2225        static AxisAlignedBox ConvertToOgre(const GtpVisibilityPreprocessor::AxisAlignedBox3 &box); 
     26        /** Converts preprocessor vector to Ogre vector. 
     27        */ 
    2328        static Vector3 ConvertToOgre(const GtpVisibilityPreprocessor::Vector3 &v); 
    2429}; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h

    r828 r863  
    104104        void InitVisibilityCulling(Camera *cam); 
    105105         
     106 
     107 
    106108        /// the interface to the scene hierarchy. 
    107109        OctreeHierarchyInterface *mHierarchyInterface; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj

    r860 r863  
    8888                                EnableFiberSafeOptimizations="TRUE" 
    8989                                OptimizeForProcessor="2" 
    90                                 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\include" 
     90                                AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src" 
    9191                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE" 
    9292                                StringPooling="TRUE" 
     
    198198                                </File> 
    199199                                <File 
     200                                        RelativePath="..\include\OgreMeshInstance.h"> 
     201                                </File> 
     202                                <File 
    200203                                        RelativePath="..\include\OgreOcclusionQueriesQueryManager.h"> 
    201204                                </File> 
     
    234237                                Name="Source Files" 
    235238                                Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 
     239                                <File 
     240                                        RelativePath="..\src\OgreMeshInstance.cpp"> 
     241                                </File> 
    236242                                <File 
    237243                                        RelativePath="..\src\OgreOcclusionQueriesQueryManager.cpp"> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r860 r863  
    11#include "OgreOcclusionCullingSceneManager.h" 
    22#include "OgreVisibilityOptionsManager.h" 
     3#include "OgreTypeConverter.h" 
    34#include <OgreMath.h> 
    45#include <OgreIteratorWrappers.h> 
     
    910#include <OgreEntity.h> 
    1011#include <OgreSubEntity.h> 
     12#include <OgreIteratorWrappers.h> 
    1113#include "VspBspTree.h" 
    12 #include <OgreIteratorWrappers.h> 
     14#include "Containers.h" 
     15#include "ViewCellsManager.h" 
    1316 
    1417namespace Ogre { 
     
    3841        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
    3942         
    40         //mDisplayNodes = true; 
    41         //mShowBoundingBoxes = true; 
    42         //mShowBoxes = true; 
    43 //std::stringstream d; d << "here555"; 
    44 //mDummyLog.open(""); 
    45  
     43#if 0 
     44        mDisplayNodes = true; 
     45        mShowBoundingBoxes = true; 
     46        mShowBoxes = true; 
     47#endif 
    4648        // TODO: set maxdepth to reasonable value 
    4749        mMaxDepth = 50; 
     
    836838} 
    837839 
    838 /*bool OcclusionCullingSceneManager::CompareBoundingBoxes(const AxisAlignedBox &boxa,  
    839                                                                                                                 const AxisAlignedBox &boxb) 
    840 { 
    841 } 
    842 */ 
    843 void OcclusionCullingSceneManager::LoadViewCells(string filename) 
    844 { 
    845         ObjectContainer objects; 
    846         mViewCellsManager->LoadViewCells(filename, &objects); 
    847  
    848         AxisAlignedBox box; 
     840 
     841MovableObject *OcclusionCullingSceneManager::FindCorrespondingObject(const AxisAlignedBox &box) 
     842{ 
    849843        list<SceneNode *> sceneNodeList; 
    850844 
     
    853847        list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 
    854848 
    855         for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 
     849        bool overlap = false; 
     850 
     851        MovableObject *bestFittingObj = NULL; 
     852        float bestFit = 0.0; 
     853         
     854        // find the bbox which is closest to the current bbox 
     855        for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(), !overlap; ++ sit) 
    856856        { 
    857857                SceneNode *sn = *sit; 
    858858                SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator(); 
    859859 
    860                 while (oit.hasMoreElements()) 
    861                  { 
     860        while (oit.hasMoreElements()) 
     861                { 
    862862                         MovableObject *mo = oit.getNext(); 
    863                          AxisAlignedBox bbox = mo->getWorldBoundingBox(); 
    864 //              CompareBoundingBoxes(*oit, box); 
    865                  } 
     863                         const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 
     864                          
     865                         const float overlap = GtpVisibilityPreprocessor::FactorOfOverlap( 
     866                                 OgreTypeConverter::ConvertFromOgre(bbox),  
     867                                 OgreTypeConverter::ConvertFromOgre(box)); 
     868 
     869                         if (overlap > bestFit) 
     870                         { 
     871                                 bestFit = overlap; 
     872                                 bestFittingObj = mo; 
     873 
     874                                 // perfect fit => object found 
     875                                 if (overlap > (1.0 - GtpVisibilityPreprocessor::Limits::Small)) 
     876                                        break; 
     877                         } 
     878                } 
     879        } 
     880 
     881        return bestFittingObj; 
     882} 
     883 
     884 
     885void OcclusionCullingSceneManager::LoadViewCells(string filename) 
     886{ 
     887        GtpVisibilityPreprocessor::ObjectContainer objects; 
     888        // identify the corresponding Ogre meshes using the bounding boxes 
     889        IdentifyObjects(objects); 
     890 
     891        // load the view cells assigning the found objects to the pvss 
     892        mViewCellsManager->LoadViewCells(filename, &objects); 
     893} 
     894 
     895 
     896void OcclusionCullingSceneManager::IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects) 
     897{ 
     898        const string bboxesFilename = "boxes.out"; 
     899 
     900        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 
     901        mViewCellsManager->LoadBoundingBoxes(bboxesFilename, iboxes); 
     902 
     903        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 
     904                const_iterator iit, iit_end = iboxes.end(); 
     905 
     906        for (iit = iboxes.begin(); iit != iit_end; ++ iit) 
     907        { 
     908                  const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 
     909                  const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 
     910                   
     911                  MovableObject *mo = FindCorrespondingObject(currentBox); 
     912 
     913                  //objects.push_back(mi); 
    866914        } 
    867915} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp

    r860 r863  
    22 
    33 
    4 GtpVisibilityPreprocessor::AxisAlignedBox3 Ogre::OgreTypeConverter::ConvertFromOgre(const Ogre::AxisAlignedBox &box) 
     4namespace Ogre 
    55{ 
     6 
     7GtpVisibilityPreprocessor::AxisAlignedBox3 OgreTypeConverter::ConvertFromOgre(const AxisAlignedBox &box) 
     8{ 
     9        const GtpVisibilityPreprocessor::Vector3 bmin = ConvertFromOgre(box.getMinimum()); 
     10        const GtpVisibilityPreprocessor::Vector3 bmax = ConvertFromOgre(box.getMaximum()); 
     11 
     12        return GtpVisibilityPreprocessor::AxisAlignedBox3(bmin, bmax); 
    613} 
    714 
    8 GtpVisibilityPreprocessor::Vector3 Ogre::OgreTypeConverter::ConvertFromOgre(const Ogre::Vector3 &v) 
     15GtpVisibilityPreprocessor::Vector3 OgreTypeConverter::ConvertFromOgre(const Vector3 &v) 
    916{ 
     17    return GtpVisibilityPreprocessor::Vector3(v.x, v.y, v.z); 
    1018} 
    1119         
    12 Ogre::AxisAlignedBox Ogre::OgreTypeConverter::ConvertToOgre(const GtpVibilityPreprocessor::AxisAlignedBox3 &box) 
     20AxisAlignedBox OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::AxisAlignedBox3 &box) 
    1321{ 
     22        const Vector3 bmin = ConvertToOgre(box.Min()); 
     23        const Vector3 bmax = ConvertToOgre(box.Max()); 
     24 
     25        return AxisAlignedBox(bmin, bmax); 
    1426} 
    1527 
    16 Ogre::Vector3 Ogre::OgreTypeConverter::ConvertToOgre(const GtpVibilityPreprocessor::Vector3 &v) 
     28Vector3 OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::Vector3 &v) 
    1729{ 
     30        return Vector3(v.getX(), v.getY(), v.getZ()); 
    1831} 
     32} 
Note: See TracChangeset for help on using the changeset viewer.