Changeset 103


Ignore:
Timestamp:
05/18/05 02:06:32 (20 years ago)
Author:
mattausch
Message:

fixed bug with shadow maps

Location:
trunk/VUT
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp

    r100 r103  
    2727                else 
    2828                { 
    29                         //if intersects near plane => skip occlusion query because wrong results possible 
     29                        // if intersects near plane => skip occlusion query because wrong results possible 
    3030                        if (intersects) 
    3131                        { 
     
    3939                        unsigned int visiblePixels = 0; 
    4040 
    41                         mHierarchyInterface->IssueOcclusionQuery(node)-> 
    42                                 GetQueryResult(visiblePixels, true); 
     41                        mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult(visiblePixels, true); 
    4342                         
    4443                        // node visible 
  • trunk/VUT/GtpVisibility/src/VisibilityManager.cpp

    r102 r103  
    1616{ 
    1717        //SetCullingManager(VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING); 
    18         SetCullingManager(VisibilityEnvironment::STOP_AND_WAIT_CULLING); 
    19         //SetCullingManager(VisibilityEnvironment::FRUSTUM_CULLING); 
     18        //SetCullingManager(VisibilityEnvironment::STOP_AND_WAIT_CULLING); 
     19        SetCullingManager(VisibilityEnvironment::FRUSTUM_CULLING); 
    2020} 
    2121//----------------------------------------------------------------------- 
     
    3333                // delete old culling manager 
    3434                if (mCullingManager) 
     35                { 
    3536                        delete mCullingManager; 
    36  
     37                } 
    3738                mCullingManagerType = ocmType; 
    3839                 
  • trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h

    r94 r103  
    4444        void SetCullCamera(Camera *cullCam); 
    4545        /** Initialises this scene traverser for the current frame. 
    46         @param root root of the hierarchy 
    47                 @param cam current camera 
    48                 @param cullCam the camera used for culling. If null, the current camera is used 
    49                 @remark convenience method wich calls VisibilitySceneTraverser::initFrame, 
    50                 sets the current camera, and initialises the distance queue. 
     46                @remark This is a convenience method which resets the stats,  
     47                                sets the current camera, and initialises the distance queue. 
     48                @param root root of the hierarchy 
     49                @param cam the actual camera definding the view frustum 
     50                @param cullCam the camera used for culling.  
     51                @remark If null, the actual camera is used for both viewing and culling          
    5152        */ 
    5253        void InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam = NULL); 
     
    6061        */ 
    6162        void SetSceneManager(SceneManager *sm); 
    62         /** Sets pointer to the current render system  
     63        /** Sets pointer to the current render system . 
    6364                @param rsys the rendersystem  
    6465        */ 
     
    7778                GtpVisibility::HierarchyNode *node, const bool wasVisible); 
    7879 
     80        /** If true, the interface finds and renders only objects which are marked as shadow casters. 
     81                @remark This is important for the shadow texture pass 
     82        */ 
     83        void SetOnlyShadowCasters(bool onlyShadowCasters); 
     84 
    7985protected: 
     86        /** A pass that prepares an occlusion query. 
     87                @remark disables depth write, colour write, lighting, 
     88                vertex and fragment program. 
     89        */ 
     90        void SetOcclusionPass(); 
     91 
    8092        /** Deletes all occlusion queries. 
    8193        */ 
     
    8597        */ 
    8698        void RenderBoundingBox(AxisAlignedBox *box); 
    87         /** Returns pointer to current renderable half bounding box geometry 
    88         */ 
    89         //SolidHalfBoundingBox *GetSolidHalfBoundingBox(); 
     99 
    90100        /** Returns pointer to current renderable bounding box geometry 
    91101        */ 
    92102        SolidBoundingBox *GetSolidBoundingBox(); 
    93103 
    94         /** one renderable half of an aabb.  
     104        /** Returns pointer to current renderable half bounding box geometry 
     105        */ 
     106        //SolidHalfBoundingBox *GetSolidHalfBoundingBox(); 
     107 
     108        /** Renderable of an aabb 
    95109        */ 
    96110        SolidBoundingBox *mSolidBoundingBox; 
     
    105119         
    106120        std::vector<PlatformOcclusionQuery *> mOcclusionQueries; 
     121 
     122        bool mOnlyShadowCasters; 
    107123}; 
    108124 
  • trunk/VUT/Ogre/include/OgreVisibilitySceneManager.h

    r99 r103  
    5656        SceneNodeHierarchyInterface *mHierarchyInterface; 
    5757        GtpVisibility::VisibilityManager *mVisibilityManager; 
     58 
    5859        bool mUseVisibilityCulling; 
     60        bool mShowVisualization; 
    5961}; 
    6062} // namespace Ogre 
  • trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h

    r100 r103  
    3030 
    3131        /** Sets the given option for the SceneManager 
    32                             @remarks 
    33                 Options are: 
    34                 "Algorithm", int *;                      
     32                @remarks Options are: "Algorithm", int *;                        
    3533        */ 
    3634         
     
    4543        bool getOptionKeys( StringVector &refKeys ); 
    4644 
    47         /** Sets the visibility manager. 
     45        /** Sets the visibility manager 
    4846                @param visManager the visibility manager 
    4947        */ 
    5048        void setVisibilityManager(GtpVisibility::VisibilityManager *visManager); 
    51         /** See set. 
     49        /** See set 
    5250        */ 
    5351        GtpVisibility::VisibilityManager *getVisibilityManager(); 
    5452         
    55         //writes out stats into the Ogre log file 
    56         void WriteLog(); 
    57         void SetShowVisualization(bool showViz); 
    58  
    59 /*      void SetSkyBoxEnabled(bool enabled); 
    60         void SetSkyPlaneEnabled(bool enabled); 
    61         void SetSkyDomeEnabled(bool enabled);*/ 
    62  
    6353protected: 
    6454         
     55        /** Writes out stats into the Ogre log file 
     56        */ 
     57        void WriteLog(); 
     58 
    6559        OctreeHierarchyInterface *mHierarchyInterface; 
    6660        GtpVisibility::VisibilityManager *mVisibilityManager; 
     
    6862        bool mUseVisibilityCulling; 
    6963        bool mShowVisualization; 
     64        bool mRenderNodesForViz; 
    7065}; 
    7166 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r101 r103  
    106106                octant->setLastRendered(mFrameId); 
    107107 
    108                 static_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera, octant); 
     108                static_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera,  
     109                        octant, mOnlyShadowCasters); 
    109110 
    110111                mNumRenderedNodes ++; 
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r100 r103  
    11#include <OgreCamera.h> 
    22#include <OgreLogManager.h> 
    3 //#include "OgreSolidHalfBoundingBox.h" 
    43#include "OgreSolidBoundingBox.h" 
    54#include "OgrePlatformHierarchyInterface.h" 
    65#include "OgrePlatformOcclusionQuery.h" 
    7 #include <windows.h> 
    86 
    97namespace Ogre { 
     
    1210PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 
    1311mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL), 
    14 mCamera(NULL), mCullCamera(NULL) 
     12mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false) 
    1513{ 
    1614} 
     
    3634        static RenderOperation ro; 
    3735 
    38         //TODO: this should be the full bounding box 
    3936        SolidBoundingBox *solidBox = GetSolidBoundingBox(); 
    4037         
    4138        mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 
    4239        mSceneManager->useRenderableViewProjMode(solidBox); 
    43     mSceneManager->setPass(solidBox->getTechnique()->getPass(0)); 
     40        //mSceneManager->setOcclusionPass(solidBox->getTechnique()->getPass(0)); 
     41        SetOcclusionPass(); 
    4442 
    4543        solidBox->SetupBoundingBoxVertices(*box); 
     
    8078} 
    8179//----------------------------------------------------------------------- 
    82 void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam) 
     80void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root,  
     81                                                                                   Camera *cam, Camera *cullCam) 
    8382{ 
    8483        GtpVisibility::HierarchyInterface::InitFrame(root); 
     
    8887 
    8988        if (cullCam) 
     89        { 
    9090                SetCullCamera(cullCam); 
     91        } 
    9192        else 
     93        { 
    9294                SetCullCamera(cam); 
     95        } 
    9396} 
    9497//----------------------------------------------------------------------- 
     
    141144} 
    142145//----------------------------------------------------------------------- 
     146void PlatformHierarchyInterface::SetOcclusionPass() 
     147{ 
     148    // disable vertex and fragment program 
     149        mRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM); 
     150        mRenderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM); 
     151         
     152        // disable lighting 
     153        mRenderSystem->setLightingEnabled(false); 
     154 
     155    // Disable remaining texture units 
     156    mRenderSystem->_disableTextureUnitsFrom(0); 
     157 
     158    //--Set up non-texture related material settings 
     159    
     160        // Depth buffer settings 
     161        mRenderSystem->_setDepthBufferParams(true, false, CMPF_LESS_EQUAL); 
     162        // Set colour write mode off 
     163        mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 
     164        // Set colour write mode pff 
     165    mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 
     166} 
     167//----------------------------------------------------------------------- 
    143168SolidBoundingBox *PlatformHierarchyInterface::GetSolidBoundingBox() 
    144169{ 
     
    148173        return mSolidBoundingBox; 
    149174} 
    150  
     175//----------------------------------------------------------------------- 
     176void PlatformHierarchyInterface::SetOnlyShadowCasters(bool onlyShadowCasters) 
     177{ 
     178        mOnlyShadowCasters = onlyShadowCasters; 
     179} 
    151180} // namespace Ogre 
  • trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp

    r100 r103  
    115115AxisAlignedBox *SceneNodeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 
    116116{ 
     117        // only create renderable bounding box for new node 
    117118        if (node != mPreviousNode) 
    118119        { 
  • trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp

    r100 r103  
    7474         //setMaterial("BaseWhiteNoLighting"); 
    7575} 
     76//----------------------------------------------------------------------- 
    7677SolidBoundingBox::~SolidBoundingBox()  
    7778{ 
  • trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp

    r100 r103  
    66#include "OgreCamera.h" 
    77#include "OgreMaterialManager.h" 
    8 //#include <windows.h> 
     8 
    99 
    1010namespace Ogre { 
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r100 r103  
    3636        mHierarchyInterface->InitFrame(mOctree, mCameraInProgress,  
    3737                                                        mCullCamera ? getCamera("CullCamera") : NULL); 
    38         //mVisibilityManager->GetCullingManager()->InitFrame(); 
    3938 
    40         // standard scenemanager rendering without hierarchical culling 
    41         if(!mUseVisibilityCulling) 
     39        // call initframe to reset culling manager stats 
     40        mVisibilityManager->GetCullingManager()->InitFrame(); 
     41 
     42        // standard terrain scenemanager rendering without hierarchical culling 
     43        if (!mUseVisibilityCulling || mShowVisualization) 
    4244        {        
    4345                OctreeSceneManager::_renderVisibleObjects(); 
    4446                return; 
    4547        }  
    46      
     48         
    4749        //-- hierarchical culling 
    4850        // the objects of different layers (e.g., background, scene,  
     
    7779#endif 
    7880 
    79         //-- render remaining objects, e.g., overlay 
     81        //-- render overlay 
    8082        clearSpecialCaseRenderQueues(); 
    8183        SceneManager::_renderVisibleObjects(); 
     
    8688void VisibilityOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    8789{ 
     90        // if shadow pass => render only shadow casters 
     91        mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
     92 
    8893        // does nothing if hierarchical culling is used => 
    8994        // we interleave identification and rendering of objects  
     
    104109        } 
    105110 
    106         getRenderQueue()->clear(); 
    107     mBoxes.clear(); 
     111        mBoxes.clear(); 
    108112    mVisible.clear(); 
    109113} 
     
    156160{ 
    157161        return  VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    158                 getOptionKeys ( refKeys ) || OctreeSceneManager::getOptionKeys(refKeys); 
     162                getOptionKeys (refKeys) || OctreeSceneManager::getOptionKeys(refKeys); 
    159163} 
    160164//----------------------------------------------------------------------- 
     
    174178 
    175179        d << "Algorithm: " << mVisibilityManager->GetCullingManagerType() << ", " 
    176           << "Hierarchy nodes: " << mNumOctreeNodes << ", " << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 
     180          << "Hierarchy nodes: " << mNumOctreeNodes << ", " << "Traversed nodes: " 
     181          << mHierarchyInterface->GetNumTraversedNodes() << ", " 
    177182          << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " 
    178183          << "Query culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes() << ", " 
  • trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp

    r100 r103  
    1212//----------------------------------------------------------------------- 
    1313VisibilitySceneManager::VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager) 
    14 :mVisibilityManager(visManager), mUseVisibilityCulling(true) 
     14:mVisibilityManager(visManager), mUseVisibilityCulling(true), mShowVisualization(false) 
    1515{ 
    16         mHierarchyInterface = new SceneNodeHierarchyInterface(this, mDestRenderSystem); 
     16        mHierarchyInterface =  
     17                new SceneNodeHierarchyInterface(this, mDestRenderSystem); 
    1718} 
    1819//----------------------------------------------------------------------- 
     
    2425void VisibilitySceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    2526{ 
    26         // empty if hierarchical culling is used => 
     27        // does nothing if hierarchical culling is used => 
    2728        // we interleave identification and rendering of objects  
    28         // in _renderVisibibleObjects  
     29        // in _renderVisibibleObjects 
    2930        if (!mUseVisibilityCulling) 
    3031        { 
    3132                SceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
     33                return;  
    3234        } 
    3335} 
     
    3537void VisibilitySceneManager::_renderVisibleObjects() 
    3638{ 
     39        // two cameras (one for culling, one for rendering) 
    3740        mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
     41 
     42        // call initframe to reset culling manager stats 
    3843        mVisibilityManager->GetCullingManager()->InitFrame(); 
    3944 
    40         if (!mUseVisibilityCulling) 
     45        // standard terrain scenemanager rendering without hierarchical culling 
     46        if (!mUseVisibilityCulling || mShowVisualization) 
    4147        {        
    4248                SceneManager::_renderVisibleObjects(); 
     
    5561        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE); 
    5662        SceneManager::_renderVisibleObjects(); 
     63 
    5764#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    5865        _deleteRenderedQueueGroups(); 
     
    6471        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
    6572 
    66         //-- the hierarchical culling algorithm 
     73 
     74        /**  
     75        * the hierarchical culling algorithm 
     76        **/ 
    6777        mVisibilityManager->ApplyVisibilityCulling(); 
     78 
    6879 
    6980#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    7485        clearSpecialCaseRenderQueues(); 
    7586        SceneManager::_renderVisibleObjects(); 
     87 
     88        //WriteLog(); // write out stats 
    7689} 
    7790//----------------------------------------------------------------------- 
     
    123136} 
    124137 
    125 //} // namespace GtpVisibility 
    126138} // namespace Ogre 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r101 r103  
    1616VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 
    1717        GtpVisibility::VisibilityManager *visManager) 
    18 : mVisibilityManager(visManager), mUseVisibilityCulling(true), 
    19 mShowVisualization(false) 
     18: mVisibilityManager(visManager),  
     19mUseVisibilityCulling(true), 
     20mShowVisualization(false), 
     21mRenderNodesForViz(false) 
    2022{ 
    2123        mHierarchyInterface =  
     
    2426        //mDisplayNodes = true; 
    2527        //mShowBoundingBoxes = true; 
     28 
     29        // TODO: set maxdepth to reasonable value 
    2630        mMaxDepth = 50; 
    2731} 
     
    3236} 
    3337//----------------------------------------------------------------------- 
     38void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
     39{ 
     40        mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
     41        // does nothing if hierarchical culling is used => 
     42        // we interleave identification and rendering of objects  
     43        // in _renderVisibibleObjects 
     44        if (!mUseVisibilityCulling) 
     45        { 
     46                OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
     47                return;  
     48        } 
     49 
     50        //-- show visibile scene nodes and octree bounding boxes from last frame 
     51        if (mShowVisualization) 
     52    { 
     53                // add player camera for visualization purpose 
     54                Camera *c; 
     55                if ((c = getCamera("PlayerCam")) != NULL) 
     56                { 
     57                        getRenderQueue()->addRenderable(c); 
     58                } 
     59                 
     60                for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
     61                { 
     62                        getRenderQueue()->addRenderable(*it); 
     63 
     64                        if (mRenderNodesForViz) 
     65                        { 
     66                                (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 
     67                        } 
     68                } 
     69                for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
     70                { 
     71                        getRenderQueue()->addRenderable(*it); 
     72                } 
     73        } 
     74         
     75        mVisible.clear(); 
     76    mBoxes.clear(); 
     77} 
     78//----------------------------------------------------------------------- 
    3479void VisibilityTerrainSceneManager::_renderVisibleObjects() 
    3580{ 
    36         // two cameras (one for culling, one for rendering) 
    37         mHierarchyInterface->InitFrame(mOctree, mCameraInProgress,  
    38                                                         mCullCamera ? getCamera("CullCamera") : NULL); 
    39         //mVisibilityManager->GetCullingManager()->InitFrame(); 
    40          
     81        if (!mShowVisualization) 
     82        { 
     83                // two cameras (one for culling, one for rendering) 
     84                mHierarchyInterface->InitFrame(mOctree, mCameraInProgress,  
     85                                                                mCullCamera ? getCamera("CullCamera") : NULL); 
     86 
     87                // call initframe to reset culling manager stats 
     88                mVisibilityManager->GetCullingManager()->InitFrame(); 
     89        } 
     90 
    4191        // standard terrain scenemanager rendering without hierarchical culling 
    42         if(!mUseVisibilityCulling || mShowVisualization) 
     92        if (!mUseVisibilityCulling || mShowVisualization) 
    4393        {        
    4494                TerrainSceneManager::_renderVisibleObjects(); 
     
    85135} 
    86136//----------------------------------------------------------------------- 
    87 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    88 { 
    89         // does nothing if hierarchical culling is used => 
    90         // we interleave identification and rendering of objects  
    91         // in _renderVisibibleObjects 
    92         getRenderQueue()->clear(); 
    93          
    94         if (!mUseVisibilityCulling) 
    95         { 
    96                 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
    97                 return;  
    98         } 
    99          
    100         //-- show visibile scene nodes and octree bounding boxes from last frame 
    101         if (mShowVisualization) 
    102     { 
    103                 // add cull camera for visualization purpose 
    104                 if (mCullCamera) 
    105                 { 
    106                         Camera *c; 
    107                         if ((c = getCamera("CullCamera")) != NULL) 
    108                         { 
    109                                 getRenderQueue()->addRenderable(c); 
    110                         } 
    111                 } 
    112  
    113                 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
    114                 { 
    115                         getRenderQueue()->addRenderable(*it); 
    116                 } 
    117                 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    118                 { 
    119                         getRenderQueue()->addRenderable(*it); 
    120                 } 
    121         } 
    122          
    123         mVisible.clear(); 
    124     mBoxes.clear(); 
    125 } 
    126 //----------------------------------------------------------------------- 
    127137void VisibilityTerrainSceneManager::_updateSceneGraph(Camera* cam) 
    128138{ 
    129         // mHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size()); 
    130139        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 
    131140        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
     
    149158                return true; 
    150159        } 
     160        if (key == "RenderNodesForViz") 
     161        { 
     162                mRenderNodesForViz = (*static_cast<const bool *>(val)); 
     163                return true; 
     164        } 
    151165        if (key == "SkyBoxEnabled") 
    152166        { 
     
    180194} 
    181195//----------------------------------------------------------------------- 
    182 bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector  &refValueList) 
     196bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector &refValueList) 
    183197{ 
    184198        return TerrainSceneManager::getOptionValues( key, refValueList); 
     
    200214        return mVisibilityManager; 
    201215} 
    202 //----------------------------------------------------------------------- 
    203 void VisibilityTerrainSceneManager::SetShowVisualization(bool showViz) 
    204 { 
    205         mShowVisualization = showViz; 
    206 } 
    207 /* 
    208 //----------------------------------------------------------------------- 
    209 void SetSkyBoxEnabled(bool enabled) 
    210 { 
    211         mSkyBoxEnabled = enabled; 
    212 } 
    213 //----------------------------------------------------------------------- 
    214 void SetSkyPlaneEnabled(bool enabled) 
    215 { 
    216         mSkyPlaneEnabled = enabled; 
    217 } 
    218 //----------------------------------------------------------------------- 
    219 void SetSkyDomeEnabled(bool enabled) 
    220 { 
    221         mSkyDomeEnabled = enabled; 
    222 } */ 
     216 
    223217//----------------------------------------------------------------------- 
    224218void VisibilityTerrainSceneManager::WriteLog() 
     
    236230        LogManager::getSingleton().logMessage(d.str()); 
    237231} 
     232 
     233 
    238234} // namespace Ogre 
  • trunk/VUT/work/TestCulling/TestCullingApplication.cpp

    r100 r103  
    5757 
    5858        // Create a skybox 
    59     //mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 1000, false); 
     59    //mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 2000, false); 
    6060    ColourValue fadeColour(0.1, 0.1, 0.6); 
    6161        mWindow->getViewport(0)->setBackgroundColour(fadeColour); 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp

    r100 r103  
    3838{ 
    3939        // create the camera 
    40         mCamera = mSceneMgr->createCamera("CullCamera"); 
     40        mCamera = mSceneMgr->createCamera("PlayerCam"); 
    4141         
    4242        /** set a nice viewpoint 
     
    108108         
    109109        // Create a skybox 
    110         mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 7000, false); 
    111         //mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8, 500, false ); 
    112  
     110        mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000, false); 
     111         
    113112        std::string terrain_cfg("terrain.cfg"); 
    114113#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 
     
    127126 
    128127        mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 
     128        mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 5000.0f, 3000.0f)); 
     129 
     130        mTerrainContentGenerator->GenerateScene(1500, "robot.mesh"); 
    129131//      mTerrainContentGenerator->GenerateScene(500, "ninja.mesh"); 
    130         mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 5000.0f, 3000.0f)); 
    131         mTerrainContentGenerator->GenerateScene(1500, "robot.mesh"); 
    132132 
    133133        // no limitations needed anymore: the user can set  
     
    188188mVizCamera(vizCamera), 
    189189mShowVisualization(false), 
     190mRenderNodesForViz(false), 
    190191mVizCameraHeight(Real(2500.0)), 
    191192mCamNode(camNode), 
    192 mCullCamera(true) 
     193mCullCamera(false) 
    193194{ 
    194195        // Reduce move speed 
     
    235236        mSceneMgr->setOption("ShowOctree", &mShowOctree); 
    236237        mSceneMgr->setOption("CullCamera", &mCullCamera); 
    237          
    238     pOver->show(); 
     238        mSceneMgr->setOption("ShowVisualization", &mShowVisualization); 
     239        mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 
     240 
     241        pOver->show(); 
    239242}  
    240243//----------------------------------------------------------------------- 
     
    327330                // important for visualization => draw octree bounding boxes 
    328331                mSceneMgr->setOption("ShowOctree", &mShowVisualization); 
     332                // also render geometry? 
     333                mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 
    329334 
    330335                // -- setup visualization camera 
     
    370375 
    371376        KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 
    372         KEY_PRESSED(KC_E, 0.3, toggleShowOctree()); 
     377        KEY_PRESSED(KC_T, 0.3, toggleShowOctree()); 
    373378        KEY_PRESSED(KC_C, 0.3, toggleUseVisibilityCulling()); 
    374         KEY_PRESSED(KC_V, 0.3, toggleShowViz()); 
     379        KEY_PRESSED(KC_1, 0.3, toggleShowViz()); 
     380        KEY_PRESSED(KC_2, 0.3, toggleRenderNodesForViz()); 
    375381 
    376382        if (!mShowVisualization) 
     
    505511        {        
    506512                Viewport *vizvp = mWindow->addViewport(mVizCamera,  
    507                         VIZ_VIEWPORT_Z_ORDER, 0.6, 0, 0.4, 0.4); 
     513                        VIZ_VIEWPORT_Z_ORDER, 0.6, 0.6, 0.4, 0.4);  
    508514                                 
    509515                vizvp->setBackgroundColour(ColourValue(0.0, 0.3, 0.2, 1)); 
     
    513519        mVizCamera->setAspectRatio(Real(vizvp->getActualWidth()) /  
    514520                        Real(vizvp->getActualHeight())); 
    515  
    516521                //vizvp->setClearEveryFrame(false); 
    517522 
     
    520525                plane.d = 1000; 
    521526                plane.normal = Vector3::UNIT_Y; 
    522                 mSceneMgr->setSkyPlane( true, plane, "Examples/MyTransparentTest", 4000, 75, true);*/ 
    523                  
     527                mSceneMgr->setSkyPlane( true, plane, "Examples/Rockwall", 4000, 75, false); 
     528                */ 
    524529        } 
    525530        else 
     
    529534                mSceneMgr->setOption("ShowOctree", &mShowOctree); 
    530535        } 
     536} 
     537//----------------------------------------------------------------------- 
     538void MouseQueryListener::toggleRenderNodesForViz() 
     539{ 
     540        mRenderNodesForViz = !mRenderNodesForViz; 
     541 
     542        mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 
    531543} 
    532544//----------------------------------------------------------------------- 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h

    r100 r103  
    8484        void toggleUseVisibilityCulling(); 
    8585        void toggleShowViz(); 
     86        void toggleRenderNodesForViz(); 
    8687        void zoomVizCamera(int zoom); 
    8788        void moveCamera(); 
     
    120121        bool mUseVisibilityCulling; 
    121122        bool mShowVisualization; 
     123        bool mRenderNodesForViz; 
    122124        bool mCullCamera; 
    123125 
  • trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h

    r61 r103  
    110110                @param cam current camera 
    111111        */ 
    112         void _renderOctant(Camera* cam, Octree *octree); 
     112        void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters); 
    113113#endif // GTP_VISIBILITY_MODIFIED_OGRE 
    114114 
  • trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp

    r99 r103  
    11681168#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    11691169//----------------------------------------------------------------------- 
    1170 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant) 
     1170void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant, bool onlyShadowCasters) 
    11711171{ 
    11721172        //Add stuff to be rendered; 
     
    11821182                if (cam->isVisible(sn->_getWorldAABB())) 
    11831183                { 
    1184                         sn->_addToRenderQueue(cam, getRenderQueue(), false); 
     1184                        sn->_addToRenderQueue(cam, getRenderQueue(), onlyShadowCasters); 
    11851185                        //node->_findVisibleObjects(cam, getRenderQueue(), false, mDisplayNodes, false); 
    11861186                        mVisible.push_back(sn); 
     
    12031203        { 
    12041204                getRenderQueue()->addRenderable(octant->getWireBoundingBox()); 
    1205                 ++mNumObjects; 
     1205                mBoxes.push_back(octant->getWireBoundingBox()); 
    12061206        } 
    12071207 
Note: See TracChangeset for help on using the changeset viewer.