| 61 | } |
| 62 | |
| 63 | bool AdvancedRenderControls::keyPressed(const KeyboardEvent& evt) { |
| 64 | if (mTrayMgr->isDialogVisible()) |
| 65 | return true; // don't process any more keys if dialog is up |
| 66 | |
| 67 | int key = evt.keysym.sym; |
| 68 | |
| 69 | if (key == 'f') // toggle visibility of advanced frame stats |
| 70 | { |
| 71 | mTrayMgr->toggleAdvancedFrameStats(); |
| 72 | } else if (key == 'g') // toggle visibility of even rarer debugging details |
| 73 | { |
| 74 | if (mDetailsPanel->getTrayLocation() == TL_NONE) { |
| 75 | mTrayMgr->moveWidgetToTray(mDetailsPanel, TL_TOPRIGHT, 0); |
| 76 | mDetailsPanel->show(); |
| 77 | } else { |
| 78 | mTrayMgr->removeWidgetFromTray(mDetailsPanel); |
| 79 | mDetailsPanel->hide(); |
| 80 | } |
| 81 | } else if (key == 't') // cycle texture filtering mode |
| 82 | { |
| 83 | Ogre::String newVal; |
| 84 | Ogre::TextureFilterOptions tfo; |
| 85 | unsigned int aniso; |
| 86 | |
| 87 | Ogre::FilterOptions mip = Ogre::MaterialManager::getSingleton().getDefaultTextureFiltering(Ogre::FT_MIP); |
| 88 | |
| 89 | switch (Ogre::MaterialManager::getSingleton().getDefaultTextureFiltering(Ogre::FT_MAG)) { |
| 90 | case Ogre::FO_LINEAR: |
| 91 | if (mip == Ogre::FO_POINT) { |
| 92 | newVal = "Trilinear"; |
| 93 | tfo = Ogre::TFO_TRILINEAR; |
| 94 | aniso = 1; |
| 95 | } else { |
| 96 | newVal = "Anisotropic"; |
| 97 | tfo = Ogre::TFO_ANISOTROPIC; |
| 98 | aniso = 8; |
| 99 | } |
| 100 | break; |
| 101 | case Ogre::FO_ANISOTROPIC: |
| 102 | newVal = "None"; |
| 103 | tfo = Ogre::TFO_NONE; |
| 104 | aniso = 1; |
| 105 | break; |
| 106 | default: |
| 107 | newVal = "Bilinear"; |
| 108 | tfo = Ogre::TFO_BILINEAR; |
| 109 | aniso = 1; |
| 110 | break; |
| 111 | } |
| 112 | |
| 113 | Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(tfo); |
| 114 | Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(aniso); |
| 115 | mDetailsPanel->setParamValue(9, newVal); |
| 116 | } else if (key == 'r') // cycle polygon rendering mode |
| 117 | { |
| 118 | Ogre::String newVal; |
| 119 | Ogre::PolygonMode pm; |
| 120 |
nothing calls this directly
no test coverage detected