Changeset 112 for trunk/VUT/Ogre


Ignore:
Timestamp:
05/25/05 18:28:46 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/Ogre
Files:
13 edited

Legend:

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

    r87 r112  
    4343        unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const; 
    4444 
     45        void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
     46                                                         GtpVisibility::CullingType type); 
     47 
    4548protected: 
    4649        /** Returns pointer to the bounding box of the node. 
  • trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h

    r111 r112  
    8686 
    8787protected: 
     88        /** materials for visualizing frustum and query culled nodes */ 
     89        void CreateCulledNodeMaterials(); 
     90 
    8891        /** A pass that prepares an occlusion query. 
    8992                @remark disables depth write, colour write, lighting, 
  • trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h

    r87 r112  
    3535 
    3636        AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 
     37 
     38        void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
     39                                                        GtpVisibility::CullingType type); 
    3740}; 
    3841 
  • trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h

    r100 r112  
    6060        bool mUseVisibilityCulling; 
    6161        bool mShowVisualization; 
     62        bool mRenderNodesForViz; 
     63        bool mVisualizeCulledNodes; 
    6264}; 
    6365 
  • trunk/VUT/Ogre/include/OgreVisibilitySceneManager.h

    r103 r112  
    5959        bool mUseVisibilityCulling; 
    6060        bool mShowVisualization; 
     61 
     62        bool mVisualizeCulledNodes; 
    6163}; 
    6264} // namespace Ogre 
  • trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h

    r103 r112  
    6363        bool mShowVisualization; 
    6464        bool mRenderNodesForViz; 
     65        bool mVisualizeCulledNodes; 
    6566}; 
    6667 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r103 r112  
    142142        return &mBox; 
    143143} 
     144//----------------------------------------------------------------------- 
     145void OctreeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
     146                                                                                                   GtpVisibility::CullingType type) 
     147{ 
     148        WireBoundingBox *box = static_cast<Octree *>(node)->getWireBoundingBox(); 
    144149 
     150        if (type == GtpVisibility::FRUSTUM_CULLED) 
     151        { 
     152                box->setMaterial("FrustumCulledNodesMaterial"); 
     153        } 
     154        else // type == GtpVisibility::QUERY_CULLED 
     155        { 
     156                box->setMaterial("QueryCulledNodesMaterial"); 
     157        } 
     158        static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 
     159        //LogManager::getSingleton().logMessage("pushing box"); 
     160} 
    145161} // namespace Ogre 
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r111 r112  
    1212mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false) 
    1313{ 
     14        CreateCulledNodeMaterials(); 
     15         
     16} 
     17//----------------------------------------------------------------------- 
     18void PlatformHierarchyInterface::CreateCulledNodeMaterials() 
     19{ 
     20        // material for frustum culled nodes 
     21        MaterialPtr mat = MaterialManager::getSingleton().getByName("FrustumCulledNodesMaterial"); 
     22        MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting"); 
     23        if (mat.isNull()) 
     24        { 
     25                mat = MaterialManager::getSingleton().create("FrustumCulledNodesMaterial",  
     26                        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
     27 
     28                //baseWhite.get()->copyDetailsTo(mat); 
     29                //mat->setColourWriteEnabled(true); 
     30                mat->setLightingEnabled(false); 
     31                //mat->setAmbient(ColourValue(1,0,0)); 
     32        } 
     33 
     34        // material for query culled nodes 
     35        MaterialPtr mat2 = MaterialManager::getSingleton().getByName("QueryCulledNodesMaterial"); 
     36 
     37        if (mat2.isNull()) 
     38        { 
     39                mat2 = MaterialManager::getSingleton().create("QueryCulledNodesMaterial",  
     40                        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
     41                //baseWhite.get()->copyDetailsTo(mat2); 
     42        //      mat2->setColourWriteEnabled(true); 
     43                mat2->setLightingEnabled(false); 
     44                //mat2->setAmbient(ColourValue(0,0,1));          
     45        } 
    1446} 
    1547//----------------------------------------------------------------------- 
     
    162194        // Set colour write mode off 
    163195        mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 
    164         // Set colour write mode pff 
    165     mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 
    166196} 
    167197//----------------------------------------------------------------------- 
     
    177207{ 
    178208        mOnlyShadowCasters = onlyShadowCasters; 
    179         mDummy = mOnlyShadowCasters ; 
     209        //mIsShadowPass = mOnlyShadowCasters ; 
    180210} 
    181211//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp

    r111 r112  
    8787{ 
    8888        Matrix3 mat; 
    89         mat.FromEulerAnglesYXZ(Degree(rotation.x),//.valueRadians(),  
    90                                                    Degree(rotation.y),//.valueRadians(),  
    91                                                    Degree(rotation.z));//.valueRadians()); 
     89        mat.FromEulerAnglesYXZ(Degree(rotation.x), Degree(rotation.y), 
     90                                                   Degree(rotation.z)); 
    9291 
    9392        return GenerateSceneObject(position, Quaternion(mat), objName); 
  • trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp

    r103 r112  
    124124        return &mBox; 
    125125} 
     126//----------------------------------------------------------------------- 
     127void SceneNodeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
     128                                                                                                          GtpVisibility::CullingType type) 
     129{ 
     130        // TODO 
     131} 
    126132} // namespace Ogre      
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r103 r112  
    1212VisibilityOctreeSceneManager::VisibilityOctreeSceneManager( 
    1313        GtpVisibility::VisibilityManager *visManager) 
    14 : mVisibilityManager(visManager), mUseVisibilityCulling(true), 
    15 mShowVisualization(false) 
     14:  
     15mVisibilityManager(visManager),  
     16mUseVisibilityCulling(true), 
     17mShowVisualization(false), 
     18mRenderNodesForViz(false), 
     19mVisualizeCulledNodes(false) 
    1620{ 
    1721        mHierarchyInterface =  
     
    3741                                                        mCullCamera ? getCamera("CullCamera") : NULL); 
    3842 
    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) 
    44         {        
    45                 OctreeSceneManager::_renderVisibleObjects(); 
    46                 return; 
    47         }  
     43        if (!mShowVisualization) 
     44        { 
     45                // two cameras (one for culling, one for rendering) 
     46                mHierarchyInterface->InitFrame(mOctree, mCameraInProgress,  
     47                                                                mCullCamera ? getCamera("CullCamera") : NULL); 
     48 
     49                // call initframe to reset culling manager stats 
     50                mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 
     51        } 
    4852         
    4953        //-- hierarchical culling 
     
    136140                return true; 
    137141        } 
     142        if (key == "RenderNodesForViz") 
     143        { 
     144                mRenderNodesForViz = (*static_cast<const bool *>(val)); 
     145                return true; 
     146        } 
     147        if (key == "SkyBoxEnabled") 
     148        { 
     149                mSkyBoxEnabled = (*static_cast<const bool *>(val)); 
     150                return true; 
     151        } 
     152        if (key == "SkyPlaneEnabled") 
     153        { 
     154                mSkyPlaneEnabled = (*static_cast<const bool *>(val)); 
     155                return true; 
     156        } 
     157        if (key == "SkyDomeEnabled") 
     158        { 
     159                mSkyDomeEnabled = (*static_cast<const bool *>(val)); 
     160                return true; 
     161        } 
     162        if (key == "VisualizeCulledNodes") 
     163        { 
     164                mVisualizeCulledNodes = (*static_cast<const bool *>(val)); 
     165                return true; 
     166        } 
    138167        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    139168                setOption(key, val) || OctreeSceneManager::setOption(key, val); 
  • trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp

    r111 r112  
    3838void VisibilitySceneManager::_renderVisibleObjects() 
    3939{ 
    40         // two cameras (one for culling, one for rendering) 
    41         mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
     40        if (!mShowVisualization) 
     41        { 
     42                // two cameras (one for culling, one for rendering) 
     43                mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
    4244 
    43         // call initframe to reset culling manager stats 
    44         mVisibilityManager->GetCullingManager()->InitFrame(); 
     45                // call initframe to reset culling manager stats 
     46                mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 
     47        } 
    4548 
    4649        // standard terrain scenemanager rendering without hierarchical culling 
     
    4851        {        
    4952                SceneManager::_renderVisibleObjects(); 
     53         
    5054                return; 
    5155        }  
    52          
     56 
    5357        //-- hierarchical culling 
    5458        // the objects of different layers (e.g., background, scene,  
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r111 r112  
    1919mUseVisibilityCulling(true), 
    2020mShowVisualization(false), 
    21 mRenderNodesForViz(false) 
     21mRenderNodesForViz(false), 
     22mVisualizeCulledNodes(false) 
    2223{ 
    2324        mHierarchyInterface =  
     
    6667                for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
    6768                { 
     69                        MaterialPtr mp = (*it)->getMaterial(); 
     70                         
     71                        mp.get()->setLightingEnabled(false); 
     72                        mp.get()->setAmbient(ColourValue(1,0,0)); 
     73                        mp.get()->setDiffuse(ColourValue(1,1,1)); 
     74                        mp.get()->setSpecular(ColourValue(1,1,1)); 
     75                         
     76                        mp.get()->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     77                        //*mp = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting"); 
     78                        //(*it)->setMaterialName("BaseWhiteNoLighting"); 
    6879                        getRenderQueue()->addRenderable(*it); 
    6980 
     
    8596void VisibilityTerrainSceneManager::_renderVisibleObjects() 
    8697{ 
    87  
    8898        if (!mShowVisualization) 
    8999        { 
     
    93103 
    94104                // call initframe to reset culling manager stats 
    95                 mVisibilityManager->GetCullingManager()->InitFrame(); 
    96         } 
    97  
     105                mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 
     106        } 
     107         
    98108        // standard terrain scenemanager rendering without hierarchical culling 
    99109        if (!mUseVisibilityCulling || mShowVisualization) 
     
    184194        { 
    185195                mSkyDomeEnabled = (*static_cast<const bool *>(val)); 
     196                return true; 
     197        } 
     198        if (key == "VisualizeCulledNodes") 
     199        { 
     200                mVisualizeCulledNodes = (*static_cast<const bool *>(val)); 
    186201                return true; 
    187202        } 
Note: See TracChangeset for help on using the changeset viewer.