Changeset 114 for trunk/VUT/Ogre


Ignore:
Timestamp:
05/27/05 18:59:23 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/Ogre
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h

    r113 r114  
    5252        //writes out stats into the Ogre log file 
    5353        void WriteLog(); 
    54  
     54        /** Render a set of objects, see renderSingleObject for param definitions  
     55                Override so we can handle delayed rendering of transparent objects 
     56        */ 
     57        virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     58            bool doLightIteration, const LightList* manualLightList = 0); 
    5559protected: 
    5660         
     
    6064        bool mUseVisibilityCulling; 
    6165        bool mShowVisualization; 
     66        bool mRenderTransparentObjects; 
    6267        bool mVisualizeCulledNodes; 
    6368 
    64         int mRenderNodesForViz; 
     69        bool mRenderNodesForViz; 
     70        bool mRenderNodesContentForViz; 
    6571}; 
    6672 
  • trunk/VUT/Ogre/include/OgreVisibilityOptionsManager.h

    r75 r114  
    1010         
    1111/** 
    12         Helper class for setting and getting different visibility options. 
     12        Helper class for setting and getting different options directly 
     13        related to visibility culling. 
    1314*/ 
    1415class VisibilityOptionsManager 
  • trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h

    r113 r114  
    5151        GtpVisibility::VisibilityManager *getVisibilityManager(); 
    5252 
     53        /** Render a set of objects, see renderSingleObject for param definitions  
     54                Override so we can handle delayed rendering of transparent objects 
     55        */ 
     56        virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     57            bool doLightIteration, const LightList* manualLightList = 0); 
    5358protected: 
    5459         
     
    6267        bool mUseVisibilityCulling; 
    6368        bool mShowVisualization; 
     69        bool mRenderTransparentObjects; 
     70        bool mVisualizeCulledNodes; 
     71 
    6472        bool mRenderNodesForViz; 
    6573        bool mRenderNodesContentForViz; 
    66         bool mVisualizeCulledNodes; 
    6774}; 
    6875 
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r113 r114  
    1717mShowVisualization(false), 
    1818mRenderNodesForViz(false), 
    19 mVisualizeCulledNodes(false) 
     19mVisualizeCulledNodes(false), 
     20mRenderTransparentObjects(false) 
    2021{ 
    2122        mHierarchyInterface =  
     
    9293void VisibilityOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    9394{ 
    94         // if shadow pass => render only shadow casters 
     95        // only shadow casters will be rendered in shadow texture pass 
    9596        mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
    9697 
    9798        // does nothing if hierarchical culling is used => 
    9899        // we interleave identification and rendering of objects  
    99         // in _renderVisibibleObjects  
     100        // in _renderVisibibleObjects 
    100101        if (!mUseVisibilityCulling) 
    101102        { 
     
    103104                return;  
    104105        } 
    105          
     106 
     107        //-- show visibile scene nodes and octree bounding boxes from last frame 
    106108        if (mShowVisualization) 
    107109    { 
     110                // add player camera for visualization purpose 
     111                try { 
     112                        Camera *c; 
     113                        if ((c = getCamera("PlayerCam")) != NULL) 
     114                        { 
     115                                getRenderQueue()->addRenderable(c); 
     116                        }    
     117        } 
     118        catch(...) 
     119        { 
     120            // ignore 
     121        } 
    108122                 
    109                 for ( BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it ) 
     123                if (mRenderNodesForViz || mRenderNodesContentForViz) 
     124                { 
     125                        // change node material so it is better suited for visualization 
     126                /*      MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 
     127                        nodeMat->setAmbient(1, 1, 0); 
     128                        nodeMat->setLightingEnabled(true); 
     129                        nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();*/ 
     130 
     131                        for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
     132                        { 
     133                                if (mRenderNodesForViz) 
     134                                { 
     135                                        getRenderQueue()->addRenderable(*it); 
     136                                } 
     137                                if (mRenderNodesContentForViz)  
     138                                { 
     139                                        (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 
     140                                } 
     141                        } 
     142                } 
     143                for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    110144                { 
    111145                        getRenderQueue()->addRenderable(*it); 
    112146                } 
    113147        } 
    114  
    115         mBoxes.clear(); 
    116     mVisible.clear(); 
     148         
     149        mVisible.clear(); 
     150    mBoxes.clear(); 
    117151} 
    118152//----------------------------------------------------------------------- 
     
    142176        if (key == "RenderNodesForViz") 
    143177        { 
    144                 mRenderNodesForViz = (*static_cast<const int *>(val)); 
     178                mRenderNodesForViz = (*static_cast<const bool *>(val)); 
    145179                return true; 
    146180        } 
     
    165199                return true; 
    166200        } 
     201 
    167202        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    168203                setOption(key, val) || OctreeSceneManager::setOption(key, val); 
     
    200235{ 
    201236        return mVisibilityManager; 
     237} 
     238//----------------------------------------------------------------------- 
     239void VisibilityOctreeSceneManager::renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     240            bool doLightIteration, const LightList* manualLightList) 
     241{ 
     242        if (mRenderTransparentObjects) 
     243        { 
     244                OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     245        } 
    202246} 
    203247//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r113 r114  
    2121mRenderNodesForViz(false), 
    2222mRenderNodesContentForViz(false), 
    23 mVisualizeCulledNodes(false) 
     23mVisualizeCulledNodes(false), 
     24mRenderTransparentObjects(false) 
    2425{ 
    2526        mHierarchyInterface =  
    2627                new OctreeHierarchyInterface(this, mDestRenderSystem); 
    2728 
    28         //mDisplayNodes = true; 
     29    //mDisplayNodes = true; 
    2930        //mShowBoundingBoxes = true; 
    3031 
     
    7172                { 
    7273                        // change node material so it is better suited for visualization 
    73                         MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 
     74                        /*MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 
    7475                        nodeMat->setAmbient(1, 1, 0); 
    7576                        nodeMat->setLightingEnabled(true); 
    76                         nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     77                        nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();*/ 
    7778 
    7879                        for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
     
    113114        if (!mUseVisibilityCulling || mShowVisualization) 
    114115        {        
    115                 //mDestRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM); 
    116                 //mDestRenderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM); 
    117116                TerrainSceneManager::_renderVisibleObjects(); 
    118117         
     
    248247        return mVisibilityManager; 
    249248} 
    250  
    251249//----------------------------------------------------------------------- 
    252250void VisibilityTerrainSceneManager::WriteLog() 
     
    264262        LogManager::getSingleton().logMessage(d.str()); 
    265263} 
    266  
     264//----------------------------------------------------------------------- 
     265void VisibilityTerrainSceneManager::renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     266            bool doLightIteration, const LightList* manualLightList) 
     267{ 
     268        if (mRenderTransparentObjects) 
     269        { 
     270                OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     271        } 
     272} 
    267273 
    268274} // namespace Ogre 
Note: See TracChangeset for help on using the changeset viewer.