Changeset 159 for trunk/VUT/work
- Timestamp:
- 07/06/05 17:52:44 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r158 r159 103 103 mVisibilityManager(NULL), 104 104 mDelayedQueriesIssued(0.0), 105 mDelayedTraversedNodes(0.0) 105 mDelayedTraversedNodes(0.0), 106 mUseItemBuffer(false), 107 mRenderPatchesForItemBuffer(false) 106 108 { 107 109 //mInputDevice = PlatformManager::getSingleton().createInputReader(); … … 162 164 //-- visibility query stats overlay 163 165 mQueryTypeInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/QueryTypeInfo"); 166 164 167 mQueryVisibleNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleNodesInfo"); 165 168 mQueryVisibleGeometryInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleGeometryInfo"); 169 mQueryVisiblePatchInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisiblePatchInfo"); 170 166 171 mQueryNodeVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/NodeVisibilityInfo"); 167 172 mQueryGeometryVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/GeometryVisibilityInfo"); 173 mQueryPatchVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/PatchVisibilityInfo"); 168 174 169 175 // show stats overlays … … 294 300 295 301 //-- IMPORTANT: must be set, otherwise terrain is not rendered correctly 296 int terrainLevelIdx = 0; 297 mSceneMgr->setOption("TerrainLevelIdx", &terrainLevelIdx); 302 mSceneMgr->endFrame(); 298 303 299 304 //-- setup what is needed for immediate mouse/key movement … … 392 397 { 393 398 mQueryManager = new ItemBufferQueryManager(sm->GetHierarchyInterface(), 394 mWindow->getViewport(0) );399 mWindow->getViewport(0), mRenderPatchesForItemBuffer); 395 400 } 396 401 else … … 404 409 InfoContainer<GtpVisibility::NodeInfo> visibleNodes; 405 410 InfoContainer<GtpVisibility::MeshInfo> visibleGeometry; 411 InfoContainer<GtpVisibility::PatchInfo> visiblePatches; 406 412 407 413 if (fromPoint) … … 409 415 mQueryManager-> 410 416 ComputeFromPointVisibility(mCamNode->getPosition(), &visibleNodes, 411 &visibleGeometry, relativeVisibility);417 &visibleGeometry, &visiblePatches, relativeVisibility); 412 418 } 413 419 else 414 420 { 415 421 mQueryManager->ComputeCameraVisibility(*mCamera, 416 &visibleNodes, &visibleGeometry, relativeVisibility); 417 } 418 419 float averageNodeVis = 0; 420 float averageGeometryVis = 0; 421 int geomSize = 0; 422 int nodesSize = 0; 422 &visibleNodes, &visibleGeometry, &visiblePatches, relativeVisibility); 423 } 424 425 float averageNodeVis = 0, averageGeometryVis = 0, averagePatchVis = 0; 426 int geomSize = 0, nodesSize = 0, patchSize = 0; 423 427 424 428 InfoContainer<GtpVisibility::MeshInfo>::iterator geomIt, geomIt_end = visibleGeometry.end(); … … 458 462 } 459 463 464 InfoContainer<GtpVisibility::PatchInfo>::iterator patchIt, patchIt_end = visiblePatches.end(); 465 466 for (patchIt = visiblePatches.begin(); patchIt != patchIt_end; ++patchIt) 467 { 468 // add if not 0 469 if ((*patchIt).GetVisiblePixels()) 470 { 471 float vis = relativeVisibility ? 472 (*patchIt).ComputeRelativeVisibility() : (float)(*patchIt).GetVisiblePixels(); 473 474 averagePatchVis += vis; 475 ++patchSize; 476 477 std::stringstream d; d << "Patch visibility: " << vis; 478 LogManager::getSingleton().logMessage(d.str()); 479 } 480 } 481 460 482 if (nodesSize) 461 483 averageNodeVis /= (float)nodesSize; 462 484 if (geomSize) 463 485 averageGeometryVis /= (float)geomSize; 486 if (patchSize) 487 averagePatchVis /= (float)patchSize; 464 488 465 489 //-- update visibility queries stats … … 481 505 mQueryVisibleGeometryInfo->setCaption(str); 482 506 507 sprintf(str,": %d", (int)patchSize); 508 mQueryVisiblePatchInfo->setCaption(str); 509 483 510 sprintf(str,": %3.3f", averageNodeVis); 484 511 mQueryNodeVisibilityInfo->setCaption(str); … … 486 513 sprintf(str,": %3.3f", averageGeometryVis); 487 514 mQueryGeometryVisibilityInfo->setCaption(str); 515 516 sprintf(str,": %3.3f", averagePatchVis); 517 mQueryPatchVisibilityInfo->setCaption(str); 488 518 } 489 519 catch (...) … … 909 939 break; 910 940 911 941 case KC_F: 912 942 nextFilter(); 913 943 break; … … 929 959 case KC_S: 930 960 toggleShowShadows(); 961 break; 962 963 case KC_I: 964 mUseItemBuffer = !mUseItemBuffer; 965 break; 966 967 case KC_C: 968 mRenderPatchesForItemBuffer = !mRenderPatchesForItemBuffer; 931 969 break; 932 970 … … 959 997 break; 960 998 case KC_F5: 961 ApplyVisibilityQuery(false, mShiftPressed, false);999 ApplyVisibilityQuery(false, mShiftPressed, mUseItemBuffer); 962 1000 break; 963 1001 case KC_F6: 964 ApplyVisibilityQuery(true, mShiftPressed, false); 965 break; 966 case KC_F7: 967 ApplyVisibilityQuery(false, mShiftPressed, true); 968 break; 969 case KC_F8: 970 ApplyVisibilityQuery(true, mShiftPressed, true); 971 break; 1002 ApplyVisibilityQuery(true, mShiftPressed, mUseItemBuffer); 1003 break; 1004 972 1005 case KC_F11: 973 1006 takeScreenShot(); -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r155 r159 169 169 OverlayElement *mQueryTypeInfo; 170 170 OverlayElement *mQueryVisibleNodesInfo; 171 OverlayElement *mQueryVisibleGeometryInfo; 171 OverlayElement *mQueryVisibleGeometryInfo; 172 OverlayElement *mQueryVisiblePatchInfo; 173 172 174 OverlayElement *mQueryVisiblityInfo; 173 175 OverlayElement *mQueryNodeVisibilityInfo; 174 176 OverlayElement *mQueryGeometryVisibilityInfo; 177 OverlayElement *mQueryPatchVisibilityInfo; 175 178 176 179 RayQueryExecutor *mRayQueryExecutor; … … 190 193 bool mShutdownRequested; 191 194 bool mDisplayCameraDetails; 192 195 bool mUseItemBuffer; 196 193 197 Real mVizCameraHeight; 194 198 … … 236 240 unsigned long mAvgFps; 237 241 unsigned long mFrameCount; 242 238 243 //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 239 244 PlatformQueryManager *mQueryManager; … … 241 246 float mDelayedQueriesIssued; 242 247 float mDelayedTraversedNodes; 248 249 bool mRenderPatchesForItemBuffer; 243 250 }; 244 251 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r156 r159 127 127 setupGui(); 128 128 129 // Floor plane130 /* 129 130 /* // occluder plane to test visibility 131 131 Plane plane; 132 132 plane.normal = Vector3::UNIT_Y; … … 138 138 pPlaneEnt->setMaterialName("Examples/Rockwall"); 139 139 pPlaneEnt->setCastShadows(true); 140 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); 141 */ 140 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); */ 141 142 142 mSceneMgr->setShadowTextureSettings(1024, 2); 143 143 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 144 //mSceneMgr->setShowDebugShadows(true); 145 144 146 145 147 146 //-- terrain content setup -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
r139 r159 156 156 157 157 /** Renders an Ogre MovableObject. 158 @param mov the movable object to be rendered 159 @param leavePassesInQueue flag determining the passes which are left 160 in render queue after rendering 158 161 */ 159 162 void _renderMovableObject(MovableObject *mov, const int leavePassesInQueue); 160 163 164 /** Tells the scene manager that the frame ends (i.e., 165 one frame in the main loop. 166 */ 167 virtual void endFrame() {}; 161 168 #endif // GTP_VISIBILITY_MODIFIED_OGRE 162 169 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h
r154 r159 299 299 300 300 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 301 // index of renderlevel used for current pass302 static int getCurrentRenderLevelIndex();303 // returnsindex of renderlevel304 static void setCurrentRenderLevelIndex(int index);301 // resets index of renderlevel used for current pass 302 static void ResetRenderLevelIndex(); 303 // next index of renderlevel 304 static void NextRenderLevelIndex(); 305 305 #endif // GTP_VISIBILITY_MODIFIED_OGRE 306 306 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreTerrainRenderable.cpp
r154 r159 1501 1501 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 1502 1502 //----------------------------------------------------------------------- 1503 int TerrainRenderable::getCurrentRenderLevelIndex()1503 void TerrainRenderable::ResetRenderLevelIndex() 1504 1504 { 1505 return msCurrentRenderLevelIndex;1505 msCurrentRenderLevelIndex = 0; 1506 1506 } 1507 1507 //----------------------------------------------------------------------- 1508 void TerrainRenderable:: setCurrentRenderLevelIndex(int index)1508 void TerrainRenderable::NextRenderLevelIndex() 1509 1509 { 1510 if (index > MAX_RENDERLEVEL_INDEX) 1511 index = 0; 1512 1513 msCurrentRenderLevelIndex = index; 1510 if ((++ msCurrentRenderLevelIndex) > MAX_RENDERLEVEL_INDEX) 1511 msCurrentRenderLevelIndex = 0; 1514 1512 } 1515 1513 #endif // GTP_VISIBILITY_MODIFIED_OGRE
Note: See TracChangeset
for help on using the changeset viewer.