Changeset 3262
- Timestamp:
- 01/11/09 01:18:50 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter.vcproj
r3261 r3262 133 133 StringPooling="true" 134 134 RuntimeLibrary="2" 135 BufferSecurityCheck="false" 135 136 EnableEnhancedInstructionSet="2" 136 137 RuntimeTypeInfo="false" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp
r3261 r3262 12 12 const VertexArray &vertices, 13 13 const VertexArray &normals, 14 const vector< pair<float, float>> &texcoords,14 const vector<Texcoord> &texcoords, 15 15 VertexArray &faceVertices, 16 16 VertexArray &faceNormals, … … 28 28 { 29 29 string s(pch); 30 //s += "\n",31 30 triples.push_back(s); 32 31 … … 34 33 } 35 34 35 // throw away last symbol (\n) 36 triples.back().resize(triples.back().size() - 1); 37 36 38 vector<int> indices; 37 39 vector<int> nIndices; 38 40 vector<int> tIndices; 39 41 40 char seps[] = " /\t\n"; 42 char seps[] = " "; 43 char seps2[] = "/"; 41 44 42 45 for (size_t i = 0; i < triples.size(); ++ i) 43 46 { 44 static int dummy = 0; 45 47 //cout << "triple " << i << " " << triples[i] << endl; 46 48 size_t found; 47 found = triples[i].find_first_of(seps );49 found = triples[i].find_first_of(seps2); 48 50 size_t prevfound = 0; 49 // vertex, normal, texture indices 51 52 // extract vertex, normal, texture indices 50 53 string str = triples[i].substr(prevfound, found); 51 54 52 55 int index = (int)strtol(str.c_str(), NULL, 10) - 1; 53 54 56 int tIndex = index; 55 57 int nIndex = index; 56 58 57 prevfound = found; 58 found = triples[i].find_first_of(seps, found + 1); 59 // try to extract texture and normal indices 60 prevfound = found + 1; 61 found = triples[i].find_first_of(seps2, prevfound); 59 62 60 63 if (found != string::npos) … … 65 68 if (idx > 0) tIndex = idx; 66 69 } 67 68 if ( (found + 1) < triples[i].size())70 71 if (found != string::npos) 69 72 { 70 73 str = triples[i].substr(found + 1); … … 80 83 nIndices.push_back(nIndex); 81 84 tIndices.push_back(tIndex); 82 } 83 85 86 //cout << index << " " << tIndex << " " << nIndex << endl; 87 } 88 89 int idx[3]; 84 90 // new triangle found 85 91 if (indices.size() > 2) … … 87 93 // change orientation of faces? 88 94 #if 1 89 i nt idx1= 0;90 i nt idx2= (int)indices.size() - 2;91 i nt idx3= (int)indices.size() - 1;95 idx[0] = 0; 96 idx[1] = (int)indices.size() - 2; 97 idx[2] = (int)indices.size() - 1; 92 98 #else 93 i nt idx3= 0;94 i nt idx2= (int)indices.size() - 2;95 i nt idx1= (int)indices.size() - 1;99 idx[2] = 0; 100 idx[1] = (int)indices.size() - 2; 101 idx[0] = (int)indices.size() - 1; 96 102 #endif 97 faceVertices.push_back(vertices[indices[idx1]]); 98 faceVertices.push_back(vertices[indices[idx2]]); 99 faceVertices.push_back(vertices[indices[idx3]]); 103 for (int j = 0; j < 3; ++ j) 104 faceVertices.push_back(vertices[indices[idx[j]]]); 100 105 101 106 102 107 if (!normals.empty()) 103 108 { 104 faceNormals.push_back(normals[nIndices[idx1]]); 105 faceNormals.push_back(normals[nIndices[idx2]]); 106 faceNormals.push_back(normals[nIndices[idx3]]); 109 for (int j = 0; j < 3; ++ j) 110 faceNormals.push_back(normals[nIndices[idx[j]]]); 107 111 } 108 112 else 109 113 { 110 114 // no face normals? => create normals 111 const SimpleTri tri(vertices[indices[idx1]], 112 vertices[indices[idx2]], 113 vertices[indices[idx3]]); 115 const SimpleTri tri(vertices[indices[idx[0]]], 116 vertices[indices[idx[1]]], 117 vertices[indices[idx[2]]]); 118 114 119 const SimpleVec n = tri.GetNormal(); 115 120 … … 121 126 if (!texcoords.empty()) 122 127 { 123 faceTexcoords.push_back(texcoords[tIndices[idx1]]); 124 faceTexcoords.push_back(texcoords[tIndices[idx2]]); 125 faceTexcoords.push_back(texcoords[tIndices[idx3]]); 128 for (int j = 0; j < 3; ++ j) 129 { 130 if (tIndices[idx[j]] >= (int)texcoords.size()) 131 cerr << "error: texcoord indices exceed array size " << texcoords.size() << " " << tIndices[idx[j]] << endl; 132 const int tidx = min((int)texcoords.size() - 1, tIndices[idx[j]]); 133 134 faceTexcoords.push_back(texcoords[tidx]); 135 } 126 136 } 127 137 } … … 219 229 } 220 230 221 222 231 return true; 223 232 } … … 233 242 for (it = filenames.begin(); it != it_end; ++ it) 234 243 { 235 cout << "\n==================\n loading file " << *it << endl; 236 237 if (!ReadFile(*it)) 238 { 239 cerr << "could not read file " << *it << endl; 240 return false; 241 } 242 } 244 const string filename = *it; 245 246 cout << "\n==================\n loading file " << filename << endl; 247 248 if (!ReadFile(filename)) 249 { 250 cerr << "could not read file ... skipping " << filename << endl; 251 //return false; 252 } 253 } 254 255 cout << "\n*******************\n writing file " << outputFilename << endl; 243 256 244 257 if (!WriteFile(outputFilename)) … … 279 292 while (fgets(str, len, file) != NULL) 280 293 { 294 //cout << "line: " << line << endl; 295 281 296 switch (str[0]) 282 297 { … … 323 338 //-- indices in the current line 324 339 340 //cout << "f: " << vertices.size() << " n: " << normals.size() << " " << texcoords.size() << endl; 341 325 342 LoadIndices(str, 326 343 vertices, normals, texcoords, -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
r3261 r3262 32 32 33 33 //const int numFiles = 879; 34 const int numFiles = 100;34 const int numFiles = 300; 35 35 36 36 vector<string> filenames; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r3260 r3262 160 160 > 161 161 <File 162 RelativePath=".\src\BvhConstructor.cpp" 163 > 164 </File> 165 <File 166 RelativePath=".\src\BvhConstructor.h" 167 > 168 </File> 169 <File 162 170 RelativePath=".\src\BvhExporter.cpp" 163 171 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
r3261 r3262 130 130 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" 131 131 RuntimeLibrary="2" 132 BufferSecurityCheck="false" 132 133 EnableEnhancedInstructionSet="2" 133 134 RuntimeTypeInfo="false" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter.vcproj
r3260 r3262 125 125 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 126 126 RuntimeLibrary="2" 127 RuntimeTypeInfo="false" 127 128 UsePrecompiledHeader="0" 128 129 WarningLevel="3" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter.vcproj
r3258 r3262 122 122 Name="VCCLCompilerTool" 123 123 AdditionalOptions=" /D "_CRT_SECURE_NO_WARNINGS"" 124 Optimization="3" 125 InlineFunctionExpansion="2" 126 EnableIntrinsicFunctions="true" 127 FavorSizeOrSpeed="1" 128 OmitFramePointers="true" 129 EnableFiberSafeOptimizations="true" 124 130 AdditionalIncludeDirectories="libs\Zlib\include; src" 125 131 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 126 132 RuntimeLibrary="2" 133 BufferSecurityCheck="false" 134 EnableEnhancedInstructionSet="2" 135 RuntimeTypeInfo="false" 127 136 UsePrecompiledHeader="0" 128 137 WarningLevel="3" … … 145 154 AdditionalLibraryDirectories="libs\Zlib\lib; lib\$(ConfigurationName)" 146 155 IgnoreDefaultLibraryNames="libCMT" 147 GenerateDebugInformation=" true"156 GenerateDebugInformation="false" 148 157 SubSystem="1" 149 158 LargeAddressAware="2" 150 159 OptimizeReferences="2" 151 160 EnableCOMDATFolding="2" 161 OptimizeForWindows98="1" 152 162 TargetMachine="1" 153 163 /> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3260 r3262 23 23 visibilitySolution=vienna_full-8x3-pgv 24 24 viewCellsScaleFactor=1.0f 25 useSkylightForIllum= 125 useSkylightForIllum=0 26 26 27 27 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3259 r3262 146 146 } 147 147 148 BvhInterior::BvhInterior(BvhNode *parent): 149 mBack(NULL), mFront(NULL), BvhNode(parent) 150 {} 151 152 153 bool BvhInterior::IsLeaf() const 154 { 155 return false; 156 } 157 158 159 160 BvhLeaf::BvhLeaf(BvhNode *parent): BvhNode(parent) 161 {} 162 163 164 bool BvhLeaf::IsLeaf() const 165 { 166 return true; 167 } 168 169 148 170 149 171 /**********************************************************/ 150 172 /* class Bvh implementation */ 151 173 /**********************************************************/ 152 153 154 155 inline AxisAlignedBox3 ComputeBoundingBox(SceneEntity **entities, int numEntities)156 {157 AxisAlignedBox3 box;158 159 if (!numEntities)160 { // no box=> just initialize161 box.Initialize();162 }163 else164 {165 box = entities[0]->GetWorldBoundingBox();166 167 for (int i = 1; i < numEntities; ++ i)168 {169 box.Include(entities[i]->GetWorldBoundingBox());170 }171 }172 173 return box;174 }175 174 176 175 … … 1440 1439 leaf->mParent = parent; 1441 1440 1442 front->mBox = ComputeBoundingBox(mGeometry + front->mFirst, front->CountPrimitives());1443 leaf->mBox = ComputeBoundingBox(mGeometry + leaf->mFirst, leaf->CountPrimitives());1441 front->mBox = SceneEntity::ComputeBoundingBox(mGeometry + front->mFirst, front->CountPrimitives()); 1442 leaf->mBox = SceneEntity::ComputeBoundingBox(mGeometry + leaf->mFirst, leaf->CountPrimitives()); 1444 1443 1445 1444 // recursively continue subdivision … … 1468 1467 SceneEntity **entities = GetGeometry(node, numEntities); 1469 1468 1470 node->mBox = ComputeBoundingBox(entities, numEntities);1469 node->mBox = SceneEntity::ComputeBoundingBox(entities, numEntities); 1471 1470 //cout << "box: " << node->mBox << endl; 1472 1471 } … … 1488 1487 { 1489 1488 // the bvh has two main branches 1490 // a static branch (the old root), and a dynamic branch1489 // a static branch (the old root), and a dynamic branch 1491 1490 // we create a 'dynamic' leaf which basically is a container 1492 1491 // for all dynamic objects underneath … … 1501 1500 mDynamicRoot = l; 1502 1501 1503 l->mBox = ComputeBoundingBox(mGeometry + mStaticGeometrySize, (int)mDynamicGeometrySize); 1502 l->mBox = SceneEntity::ComputeBoundingBox(mGeometry + mStaticGeometrySize, 1503 (int)mDynamicGeometrySize); 1504 1504 1505 1505 l->mFirst = (int)mStaticGeometrySize; … … 1510 1510 1511 1511 if (mDynamicGeometrySize) 1512 { 1512 1513 mDynamicRoot = SubdivideLeaf(l, 0); 1514 } 1513 1515 } 1514 1516 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h
r3259 r3262 31 31 friend class BvhLoader; 32 32 friend class BvhExporter; 33 friend class mygreaterdistance;33 friend class BvhConstructor; 34 34 35 35 public: … … 236 236 //-- rendering related options 237 237 238 /// the bounding boxes of the test nodes are queries instead of the actualnode238 /// we query the bounding boxes of the test nodes when testing this node 239 239 int mTestNodesIdx; 240 240 /// the number of these test nodes … … 246 246 247 247 248 /////////////////249 //-- public inline functions250 251 252 int BvhNode::GetLastVisitedFrame() const253 {254 return mVisibility[sCurrentState].mLastVisitedFrame;255 }256 257 258 void BvhNode::SetLastVisitedFrame(const int lastVisited)259 {260 mVisibility[sCurrentState].mLastVisitedFrame = lastVisited;261 }262 263 264 bool BvhNode::IsVisible() const265 {266 return mVisibility[sCurrentState].mIsVisible;267 }268 269 270 void BvhNode::SetVisible(bool visible)271 {272 mVisibility[sCurrentState].mIsVisible = visible;273 }274 275 276 void BvhNode::IncTimesTestedInvisible()277 {278 ++ mVisibility[sCurrentState].mTimesInvisible;279 }280 281 282 int BvhNode::GetTimesTestedInvisible() const283 {284 return mVisibility[sCurrentState].mTimesInvisible;285 }286 287 288 void BvhNode::SetTimesTestedInvisible(int t)289 {290 mVisibility[sCurrentState].mTimesInvisible = t;291 }292 293 294 bool BvhNode::IsViewFrustumCulled() const295 {296 return mVisibility[sCurrentState].mIsFrustumCulled;297 }298 299 300 void BvhNode::SetViewFrustumCulled(bool frustumCulled)301 {302 mVisibility[sCurrentState].mIsFrustumCulled = frustumCulled;303 }304 305 306 bool BvhNode::IsNew() const307 {308 return mVisibility[sCurrentState].mIsNew;309 }310 311 312 void BvhNode::SetIsNew(bool isNew)313 {314 mVisibility[sCurrentState].mIsNew = isNew;315 }316 317 318 void BvhNode::SetAssumedVisibleFrameId(int t)319 {320 mVisibility[sCurrentState].mAssumedVisibleFrameId = t;321 }322 323 324 int BvhNode::GetAssumedVisibleFrameId() const325 {326 return mVisibility[sCurrentState].mAssumedVisibleFrameId;327 }328 329 330 int BvhNode::GetLastQueriedFrame() const331 {332 return mVisibility[sCurrentState].mLastQueriedFrame;333 }334 335 336 void BvhNode::SetLastQueriedFrame(int lastTested)337 {338 mVisibility[sCurrentState].mLastQueriedFrame = lastTested;339 }340 341 342 int BvhNode::GetLastRenderedFrame() const343 {344 return mLastRenderedFrame[sCurrentState];345 }346 347 348 void BvhNode::SetLastRenderedFrame(int lastRenderedFrame)349 {350 mLastRenderedFrame[sCurrentState] = lastRenderedFrame;351 }352 353 354 bool BvhNode::Empty() const355 {356 return (mFirst == -1);357 }358 359 360 int BvhNode::CountPrimitives() const361 {362 return mLast - mFirst + 1;363 }364 365 int BvhNode::GetDepth() const366 {367 return mDepth;368 }369 370 371 BvhNode *BvhNode::GetParent()372 {373 return mParent;374 }375 376 377 int BvhNode::GetNumLeaves() const378 {379 return mNumLeaves;380 }381 382 383 bool BvhNode::IsVirtualLeaf() const384 {385 return mIsVirtualLeaf;386 }387 388 389 float BvhNode::GetDistance() const390 {391 return mDistance;392 }393 394 395 const AxisAlignedBox3 &BvhNode::GetBox() const396 {397 return mBox;398 }399 400 401 int BvhNode::GetId() const402 {403 return mId;404 }405 406 407 void BvhNode::SetId(int id)408 {409 mId = id;410 }411 412 413 void BvhNode::SetCurrentState(int _state)414 {415 sCurrentState = _state;416 }417 418 419 248 /** Internal node of the bv hierarchy. 420 249 */ … … 424 253 friend class BvhLoader; 425 254 friend class BvhExporter; 255 friend class BvhConstructor; 426 256 427 257 public: 428 258 429 BvhInterior(BvhNode *parent) : mBack(NULL), mFront(NULL), BvhNode(parent)430 {}431 virtual bool IsLeaf() const { return false; }259 BvhInterior(BvhNode *parent); 260 261 virtual bool IsLeaf() const; 432 262 /** Back child. 433 263 */ 434 inline BvhNode *GetBack() { return mBack; }264 inline BvhNode *GetBack(); 435 265 /** Front child. 436 266 */ 437 inline BvhNode *GetFront() { return mFront; }267 inline BvhNode *GetFront(); 438 268 /** Recursivly delete hierarchy. 439 269 */ … … 448 278 449 279 280 450 281 class BvhLeaf: public BvhNode 451 282 { … … 455 286 public: 456 287 457 BvhLeaf(BvhNode *parent): BvhNode(parent) 458 {} 288 BvhLeaf(BvhNode *parent); 459 289 460 290 ~BvhLeaf(); 461 291 462 virtual bool IsLeaf() const { return true; }292 virtual bool IsLeaf() const; 463 293 }; 464 294 … … 485 315 { 486 316 friend class BvhLoader; 317 friend class BvhConstructor; 487 318 friend class BvhExporter; 488 319 … … 646 477 647 478 //////////// 648 //-- functions influencing the tightness of the bounds that are used for testing479 //-- these functions determine the 'tightness' of the bounds that are used for querying 649 480 650 481 … … 681 512 Sets the static and dynamic objects for the hierarchy. 682 513 */ 683 constBvh(const SceneEntityContainer &staticEntities,684 514 Bvh(const SceneEntityContainer &staticEntities, 515 const SceneEntityContainer &dynamicEntities); 685 516 /** Protected constructor taking scene geometry into account 686 517 Sets the static and dynamic objects for the hierarchy. 687 518 */ 688 constBvh(const SceneEntityContainer &staticEntities,689 690 519 Bvh(const SceneEntityContainer &staticEntities, 520 const SceneEntityContainer &dynamicEntities, 521 int maxDepthForTestingChildren); 691 522 /** Called by the constructor. Initializes important members. 692 523 */ … … 842 673 843 674 844 int Bvh::GetNumNodes() const 675 inline int BvhNode::GetLastVisitedFrame() const 676 { 677 return mVisibility[sCurrentState].mLastVisitedFrame; 678 } 679 680 681 inline void BvhNode::SetLastVisitedFrame(const int lastVisited) 682 { 683 mVisibility[sCurrentState].mLastVisitedFrame = lastVisited; 684 } 685 686 687 inline bool BvhNode::IsVisible() const 688 { 689 return mVisibility[sCurrentState].mIsVisible; 690 } 691 692 693 inline void BvhNode::SetVisible(bool visible) 694 { 695 mVisibility[sCurrentState].mIsVisible = visible; 696 } 697 698 699 inline void BvhNode::IncTimesTestedInvisible() 700 { 701 ++ mVisibility[sCurrentState].mTimesInvisible; 702 } 703 704 705 inline int BvhNode::GetTimesTestedInvisible() const 706 { 707 return mVisibility[sCurrentState].mTimesInvisible; 708 } 709 710 711 inline void BvhNode::SetTimesTestedInvisible(int t) 712 { 713 mVisibility[sCurrentState].mTimesInvisible = t; 714 } 715 716 717 inline bool BvhNode::IsViewFrustumCulled() const 718 { 719 return mVisibility[sCurrentState].mIsFrustumCulled; 720 } 721 722 723 inline void BvhNode::SetViewFrustumCulled(bool frustumCulled) 724 { 725 mVisibility[sCurrentState].mIsFrustumCulled = frustumCulled; 726 } 727 728 729 inline bool BvhNode::IsNew() const 730 { 731 return mVisibility[sCurrentState].mIsNew; 732 } 733 734 735 inline void BvhNode::SetIsNew(bool isNew) 736 { 737 mVisibility[sCurrentState].mIsNew = isNew; 738 } 739 740 741 inline void BvhNode::SetAssumedVisibleFrameId(int t) 742 { 743 mVisibility[sCurrentState].mAssumedVisibleFrameId = t; 744 } 745 746 747 inline int BvhNode::GetAssumedVisibleFrameId() const 748 { 749 return mVisibility[sCurrentState].mAssumedVisibleFrameId; 750 } 751 752 753 inline int BvhNode::GetLastQueriedFrame() const 754 { 755 return mVisibility[sCurrentState].mLastQueriedFrame; 756 } 757 758 759 inline void BvhNode::SetLastQueriedFrame(int lastTested) 760 { 761 mVisibility[sCurrentState].mLastQueriedFrame = lastTested; 762 } 763 764 765 inline int BvhNode::GetLastRenderedFrame() const 766 { 767 return mLastRenderedFrame[sCurrentState]; 768 } 769 770 771 inline void BvhNode::SetLastRenderedFrame(int lastRenderedFrame) 772 { 773 mLastRenderedFrame[sCurrentState] = lastRenderedFrame; 774 } 775 776 777 inline bool BvhNode::Empty() const 778 { 779 return (mFirst == -1); 780 } 781 782 783 inline int BvhNode::CountPrimitives() const 784 { 785 return mLast - mFirst + 1; 786 } 787 788 inline int BvhNode::GetDepth() const 789 { 790 return mDepth; 791 } 792 793 794 inline BvhNode *BvhNode::GetParent() 795 { 796 return mParent; 797 } 798 799 800 inline int BvhNode::GetNumLeaves() const 801 { 802 return mNumLeaves; 803 } 804 805 806 inline bool BvhNode::IsVirtualLeaf() const 807 { 808 return mIsVirtualLeaf; 809 } 810 811 812 inline float BvhNode::GetDistance() const 813 { 814 return mDistance; 815 } 816 817 818 inline const AxisAlignedBox3 &BvhNode::GetBox() const 819 { 820 return mBox; 821 } 822 823 824 inline int BvhNode::GetId() const 825 { 826 return mId; 827 } 828 829 830 inline void BvhNode::SetId(int id) 831 { 832 mId = id; 833 } 834 835 836 inline void BvhNode::SetCurrentState(int _state) 837 { 838 sCurrentState = _state; 839 } 840 841 842 inline BvhNode *BvhInterior::GetBack() 843 { 844 return mBack; 845 } 846 847 848 inline BvhNode *BvhInterior::GetFront() 849 { 850 return mFront; 851 } 852 853 854 inline int Bvh::GetNumNodes() const 845 855 { 846 856 return mNumNodes; … … 848 858 849 859 850 in t Bvh::GetNumLeaves() const860 inline int Bvh::GetNumLeaves() const 851 861 { 852 862 return mNumNodes / 2 + 1; … … 854 864 855 865 856 in t Bvh::GetNumVirtualNodes() const866 inline int Bvh::GetNumVirtualNodes() const 857 867 { 858 868 return mNumVirtualNodes; … … 860 870 861 871 862 in t Bvh::GetNumVirtualLeaves() const872 inline int Bvh::GetNumVirtualLeaves() const 863 873 { 864 874 return mNumVirtualNodes / 2 + 1; … … 866 876 867 877 868 BvhNode *Bvh::GetRoot()878 inline BvhNode *Bvh::GetRoot() 869 879 { 870 880 return mRoot; … … 872 882 873 883 874 BvhNode *Bvh::GetDynamicRoot()884 inline BvhNode *Bvh::GetDynamicRoot() 875 885 { 876 886 return mDynamicRoot; … … 878 888 879 889 880 BvhNode *Bvh::GetStaticRoot()890 inline BvhNode *Bvh::GetStaticRoot() 881 891 { 882 892 return mStaticRoot; … … 884 894 885 895 886 const AxisAlignedBox3 &Bvh::GetBox() const896 inline const AxisAlignedBox3 &Bvh::GetBox() const 887 897 { 888 898 return mBox; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
r3259 r3262 183 183 184 184 185 } 185 AxisAlignedBox3 SceneEntity::ComputeBoundingBox(SceneEntity **entities, int numEntities) 186 { 187 AxisAlignedBox3 box; 188 189 if (!numEntities) 190 { // no box => just initialize 191 box.Initialize(); 192 } 193 else 194 { 195 box = entities[0]->GetWorldBoundingBox(); 196 197 for (int i = 1; i < numEntities; ++ i) 198 { 199 box.Include(entities[i]->GetWorldBoundingBox()); 200 } 201 } 202 203 return box; 204 } 205 206 207 AxisAlignedBox3 SceneEntity::ComputeBoundingBox(const SceneEntityContainer &entities) 208 { 209 AxisAlignedBox3 box; 210 211 if (!entities.empty()) 212 { // no box => just initialize 213 box.Initialize(); 214 } 215 else 216 { 217 box = entities[0]->GetWorldBoundingBox(); 218 219 for (size_t i = 1; i < entities.size(); ++ i) 220 { 221 box.Include(entities[i]->GetWorldBoundingBox()); 222 } 223 } 224 225 return box; 226 } 227 228 229 230 231 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
r3260 r3262 122 122 */ 123 123 static int GetCurrentVisibleId(); 124 125 static AxisAlignedBox3 ComputeBoundingBox(SceneEntity **entities, int numEntities); 126 static AxisAlignedBox3 ComputeBoundingBox(const SceneEntityContainer &entities); 124 127 125 128
Note: See TracChangeset
for help on using the changeset viewer.