- Timestamp:
- 08/21/06 17:05:45 (18 years ago)
- Location:
- GTP/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
r1220 r1250 114 114 mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 115 115 mDemoMode(false), 116 mEnhancedVisibility(false) 116 mEnhancedVisibility(false), 117 mDemoInterval(1.0f) 117 118 { 118 119 … … 134 135 bool mDemoMode; 135 136 bool mEnhancedVisibility; 136 }; 137 Real mDemoInterval; 138 }; 139 140 struct DemoStats 141 { 142 unsigned int mTotalNumFrames; 143 unsigned int mNumFrames; 144 Real mTotalEllapsedTime; 145 Real mEllapsedTime; 146 } mDemoStats; 137 147 138 148 // Constructor takes a RenderWindow because it uses that to determine input context -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
r1220 r1250 37 37 .addOpt("s","scenemgr", ARGUMENT_REQUIRED) 38 38 .addOpt("","comment", ARGUMENT_REQUIRED) 39 .addOpt("e","enhancevis", ARGUMENT_NONE); 39 .addOpt("e","enhancevis", ARGUMENT_NONE) 40 .addOpt("","logint",ARGUMENT_REQUIRED); 40 41 41 42 … … 87 88 s << tmp; 88 89 s >> options.mKI; 90 s.clear(); 91 } 92 93 if (cmdparser.getOpt("logint", tmp)) 94 { 95 s << tmp; 96 s >> options.mDemoInterval; 89 97 s.clear(); 90 98 } … … 417 425 KdTreeAppListener::SCENEMANAGERNAME[mOptions.mSceneManager], 418 426 "MySceneManager"); 419 // set params depending onscene manager427 // set params for kdtree scene manager 420 428 if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT) 421 429 { … … 426 434 mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod); 427 435 mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility); 436 // fix 437 bool depthpass = false; 438 mSceneMgr->setOption("UseDepthPass", &depthpass); 428 439 } 429 440 // set algorithm when scene manager is OCM - numbering is different though 430 if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM)441 else if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM) 431 442 { 432 443 int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
r1220 r1250 131 131 mTimeUntilNextToggle(0.0f), 132 132 // stuff for walkthrough recording/playback 133 mTimeUntilNextLogWrite( 0.0f),133 mTimeUntilNextLogWrite(options.mDemoInterval), 134 134 mTimeRemaining(0.0f), 135 135 mWaitBeforeDemoStart(0.0f), … … 1063 1063 mTimeRemaining -= evt.timeSinceLastFrame; 1064 1064 1065 // update stats 1066 ++ mDemoStats.mNumFrames; 1067 ++ mDemoStats.mTotalNumFrames; 1068 mDemoStats.mEllapsedTime += evt.timeSinceLastFrame; 1069 mDemoStats.mTotalEllapsedTime += evt.timeSinceLastFrame; 1070 1065 1071 // store fps when in demo mode 1066 1072 if (mOptions.mDemoMode) … … 1070 1076 if (mTimeUntilNextLogWrite <= 0.0) 1071 1077 { 1072 const RenderTarget::FrameStats& stats = mWindow->getStatistics(); 1073 mTimeUntilNextLogWrite += 1.0; 1074 mDemoFPS.push_back(stats.lastFPS); 1078 mTimeUntilNextLogWrite += mOptions.mDemoInterval; 1079 //const RenderTarget::FrameStats& stats = mWindow->getStatistics(); 1080 //mDemoFPS.push_back(stats.lastFPS); 1081 mDemoFPS.push_back(mDemoStats.mNumFrames / mDemoStats.mEllapsedTime); 1082 mDemoStats.mNumFrames = 0; 1083 mDemoStats.mEllapsedTime = 0.0f; 1075 1084 } 1076 1085 } … … 1256 1265 mCurrFrame = mFrameList.begin(); 1257 1266 mTimeRemaining = mCurrFrame->mElapsedTime; 1267 1268 // reset stats 1269 mDemoStats.mNumFrames = 0; 1270 mDemoStats.mTotalNumFrames = 0; 1271 mDemoStats.mEllapsedTime = 0.0f; 1272 mDemoStats.mTotalEllapsedTime = 0.0f; 1258 1273 } 1259 1274 // stop playback … … 1452 1467 // stats 1453 1468 Real minFPS = Math::POS_INFINITY, maxFPS = 0.0, avgFPS = 0.0; 1454 String demofile; 1469 String line, storedname; 1470 String demopath, demoname; 1471 StringUtil::splitFilename(mOptions.mDemoInfileName, demoname, demopath); 1455 1472 1456 1473 // check if logfile exists … … 1458 1475 if (logread.is_open()) 1459 1476 { 1460 // read first item, it'sthe name of the demo1477 // read first line, shuold start with the name of the demo 1461 1478 // if matches, OK, otherwise do something 1462 logread >> demofile; 1463 if (!StringUtil::startsWith(demofile, mOptions.mDemoInfileName)) 1479 logread >> line; 1480 storedname = line.substr(0,line.find_first_of(',')); 1481 if (storedname != demoname) 1464 1482 { 1465 1483 LogManager::getSingleton().logMessage( 1466 1484 "##Error##: Saved demo stats do not match the current demo: " + 1467 demofile + " != " + mOptions.mDemoInfileName);1485 storedname + " != " + demoname); 1468 1486 logread.close(); 1469 1487 return; … … 1477 1495 { 1478 1496 // demo title 1479 logheader << mOptions.mDemoInfileName << fs;1497 logheader << demoname << fs; 1480 1498 // seconds 1481 1499 for (size_t i = 0; i < mDemoFPS.size(); i ++) … … 1484 1502 } 1485 1503 // minFPS, avgFPS, maxFPS, comment, record separator 1486 logheader << "min FPS" << fs << "avg FPS" << fs << "max FPS" << fs << "Comment" << rs; 1504 logheader << "\"min FPS\"" << fs << "\"avg FPS\"" << fs << "\"max FPS\"" << fs 1505 << "\"# Frames \"" << fs << "\"Total Time\"" << fs << "\"Comment\"" << rs; 1487 1506 logheader.close(); 1488 1507 } … … 1502 1521 { 1503 1522 // demo settings 1504 logwrite << SCENEMANAGER[mOptions.mSceneManager];1523 logwrite << "\"" << SCENEMANAGER[mOptions.mSceneManager]; 1505 1524 if (mOptions.mSceneManager == SM_KDT) 1506 1525 { … … 1512 1531 logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3]; 1513 1532 } 1514 logwrite << fs;1533 logwrite << "\"" << fs; 1515 1534 // per second stats 1516 1535 for (std::list<Real>::iterator it = mDemoFPS.begin(); it != mDemoFPS.end(); it ++) … … 1522 1541 maxFPS = *it; 1523 1542 1524 avgFPS += *it;1543 //avgFPS += *it; 1525 1544 1526 1545 logwrite << (int)(*it) << fs; 1527 1546 1528 1547 } 1529 avgFPS /= mDemoFPS.size(); 1548 //avgFPS /= mDemoFPS.size(); 1549 avgFPS = mDemoStats.mTotalNumFrames / mDemoStats.mTotalEllapsedTime; 1530 1550 // minFPS, avgFPS, maxFPS, comment, record separator 1531 logwrite << (int)minFPS << fs << (int)avgFPS << fs << (int)maxFPS << fs << mOptions.mComment << rs; 1551 logwrite << (int)minFPS << fs << (int)avgFPS << fs << (int)maxFPS << fs 1552 << mDemoStats.mTotalNumFrames << fs << mDemoStats.mTotalEllapsedTime << fs 1553 << "\"" << mOptions.mComment << "\"" << rs; 1532 1554 logwrite.close(); 1533 1555 } -
GTP/trunk/Lib/Vis/GtpVisibility.sln
r1239 r1250 10 10 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "OnlineCullingCHC\IVReader\src\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 11 11 ProjectSection(ProjectDependencies) = postProject 12 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}13 12 EndProjectSection 14 13 EndProject … … 30 29 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\..\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}" 31 30 ProjectSection(ProjectDependencies) = postProject 31 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 32 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 32 33 EndProjectSection 33 34 EndProject … … 35 36 ProjectSection(ProjectDependencies) = postProject 36 37 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 38 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 37 39 EndProjectSection 38 40 EndProject -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1220 r1250 213 213 virtual bool isEmpty() const = 0; 214 214 virtual bool hasGeometry() const = 0; 215 216 virtual void mergeLeaves(std::set<Leaf *>& leaves) = 0; 215 217 216 218 // Gets this node's parent (NULL if this is the root). … … 223 225 // add contained objects to render queue 224 226 virtual void queueVisibleObjects(unsigned long currentFrame, 225 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes ) = 0;227 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false) = 0; 226 228 227 229 // add contained geometry (Entities) to list … … 326 328 virtual bool hasGeometry() const { return false; }; 327 329 330 virtual void mergeLeaves(std::set<Leaf *>& leaves) 331 { 332 for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it++) 333 leaves.insert(*it); 334 } 335 328 336 // a branch should have at least one child 329 337 virtual KdTree::Node * getLeftChild() const { return mLeft; }; … … 331 339 332 340 virtual void queueVisibleObjects(unsigned long currentFrame, 333 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes )341 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false) 334 342 { 335 343 if (showBoxes) 336 344 if (mLevel == mOwner->getHiLiteLevel() || mOwner->getShowAllBoxes()) 337 345 queue->addRenderable(getWireBoundingBox()); 346 347 if (fullVis) 348 for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it ++) 349 (*it)->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, fullVis); 338 350 } 339 351 … … 347 359 mWorldAABB.setNull(); 348 360 361 // merge box & leaves 349 362 if (mLeft) 363 { 350 364 mWorldAABB.merge(mLeft->mWorldAABB); 365 mLeft->mergeLeaves(mLeaves); 366 } 351 367 if (mRight) 368 { 352 369 mWorldAABB.merge(mRight->mWorldAABB); 370 mRight->mergeLeaves(mLeaves); 371 } 353 372 354 373 // update parent recursively … … 361 380 Plane * mSplitPlane; 362 381 PlaneEvent::Side mPlaneSide; 382 protected: 383 std::set<Leaf *> mLeaves; 363 384 }; 364 385 … … 373 394 374 395 // a leaf is a leaf, dammit 375 virtual bool isLeaf() const { return true; } ;396 virtual bool isLeaf() const { return true; } 376 397 377 398 // a leaf is empty when it does not posses renderables 378 virtual bool isEmpty() const { return mKdRenderables.empty(); } ;399 virtual bool isEmpty() const { return mKdRenderables.empty(); } 379 400 380 401 // a leaf has geometry when it has renderables 381 virtual bool hasGeometry() const { return !mKdRenderables.empty(); }; 402 virtual bool hasGeometry() const { return !mKdRenderables.empty(); } 403 404 // a leaf adds itself to the leaf set 405 virtual void mergeLeaves(std::set<Leaf *>& leaves) { leaves.insert(this); } 382 406 383 407 // a leaf never has children … … 386 410 387 411 virtual void queueVisibleObjects(unsigned long currentFrame, 388 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes );412 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false); 389 413 390 414 virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h
r1212 r1250 51 51 // enhanced visibility 52 52 NodeVisibility getVisibilityEnhanced(const AxisAlignedBox& box) const; 53 54 // DEBUG 55 //mutable unsigned int mNumVisQueries; 53 56 protected: 54 57 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1211 r1250 1188 1188 bool showBoxes, KdTree::NodeList& visibleNodes) 1189 1189 { 1190 // debug 1191 //cam->mNumVisQueries = 0; 1192 1190 1193 if (mKdRoot) 1191 1194 recQueueVisibleObjects(mKdRoot, Root::getSingleton().getCurrentFrameNumber(), 1192 1195 cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 1196 1197 //mBuildLog->logMessage("Frame # " + StringConverter::toString(Root::getSingleton().getCurrentFrameNumber()) + 1198 // " ," + StringConverter::toString(cam->mNumVisQueries) + " vis queries"); 1193 1199 } 1194 1200 … … 1207 1213 visibleNodes.push_back(node); 1208 1214 1209 node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes); 1210 1211 if (node->getLeftChild()) 1212 recQueueVisibleObjects(node->getLeftChild(), currentFrame, 1213 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1214 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1215 if (node->getRightChild()) 1216 recQueueVisibleObjects(node->getRightChild(), currentFrame, 1217 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1218 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1215 bool v = (fullVis || vis == KdTreeCamera::KDNV_FULL); 1216 node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, v); 1217 1218 if (!v) 1219 { 1220 1221 if (node->getLeftChild()) 1222 recQueueVisibleObjects(node->getLeftChild(), currentFrame, 1223 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 1224 if (node->getRightChild()) 1225 recQueueVisibleObjects(node->getRightChild(), currentFrame, 1226 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 1227 } 1219 1228 } 1220 1229 } … … 1366 1375 //------------------------------------------------------------------------- 1367 1376 void KdTree::Leaf::queueVisibleObjects(unsigned long currentFrame, 1368 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes )1377 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis) 1369 1378 { 1370 1379 KdRenderableList::iterator it = mKdRenderables.begin(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp
r1212 r1250 28 28 { 29 29 mEnhancedVisMode = enhanced; 30 //if (mEnhancedVisMode)31 // getVisibility = getVisibilityEnhanced;32 //else33 // getVisibility = getVisibilitySimple;34 30 } 35 31 … … 43 39 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilityEnhanced(const AxisAlignedBox& box) const 44 40 { 41 //++ mNumVisQueries; 45 42 // Null boxes always invisible 46 43 if ( box.isNull() ) … … 101 98 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilitySimple(const AxisAlignedBox& box) const 102 99 { 100 //++ mNumVisQueries; 101 103 102 // dummy 104 103 FrustumPlane* culledBy = 0;
Note: See TracChangeset
for help on using the changeset viewer.