- Timestamp:
- 10/21/08 03:55:43 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r3040 r3052 112 112 EnableFiberSafeOptimizations="true" 113 113 AdditionalIncludeDirectories="libs;libs/GL;libs/Devil/include;src;libs/Zlib/include;"$(CG_INC_PATH)"" 114 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS "114 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SET" 115 115 StringPooling="true" 116 116 RuntimeLibrary="2" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3042 r3052 402 402 void Bvh::UpdateDistance(BvhNode *node) const 403 403 { 404 // use distance to center rather than the distance to the near plane because 405 // otherwise problems with big object penetrating the near plane 406 // (e.g., big objects in the distance which are then always visible) 407 // especially annoying is this problem when using the frustum 408 // fitting on the visible objects for shadow mapping 409 404 410 //node->mDistance = node->GetBox()GetMinDistance(sNearPlane); 405 411 node->mDistance = sNearPlane.Distance(node->GetBox().Center()); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r3021 r3052 76 76 BvhNode *root = LoadNextNode(stream, NULL); 77 77 78 #if 178 #if 0 79 79 80 80 bvh->mRoot = root; 81 81 82 82 #else 83 // copy root and set new one for dynamic objects 83 // we are setting a new root node 84 // which adds one level of indirection to the bvh but 85 // allows us to use dynamic objects 86 // the new bvh has two main branches 87 // one is the static branch (the old root), 88 // one is the dynamic branch 89 // we create a 'dynamic' leaf which basically is a container 90 // for all dynamic objects underneath 91 // the bounding boxes of the dynamic tree must be updated 92 // once each frame in order to be able to incorporate 93 // the movements of the objects within 94 84 95 BvhInterior *newRoot = new BvhInterior(NULL); 85 96 bvh->mRoot = newRoot; 97 98 BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot); 99 100 newRoot->mFront = root; 101 newRoot->mBack = dynamicLeaf; 102 root->mParent = newRoot; 103 104 // the separation is a purely logical one 105 // the bounding boxes of the child nodes is the 106 // same as for the root node 86 107 newRoot->mBox = root->mBox; 108 dynamicLeaf->mBox = root->mBox; 109 110 newRoot->mArea = newRoot->mBox.SurfaceArea(); 111 dynamicLeaf->mArea = dynamicLeaf->mBox.SurfaceArea(); 112 87 113 newRoot->mFirst = root->mFirst; 88 114 newRoot->mLast = root->mLast; 89 115 90 // create 'dynamic' leaf which basically is a container 91 // for all dynamic objects 92 BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot); 93 dynamicLeaf->mBox = root->mBox; 94 95 newRoot->mFront = root; 96 root->mParent = newRoot; 97 98 newRoot->mBack = dynamicLeaf; 99 100 bvh->mRoot = newRoot; 116 dynamicLeaf->mFirst = 0; 117 dynamicLeaf->mLast = 0; 101 118 #endif 102 119 103 tQueue.push( bvh->mRoot);120 tQueue.push(root); 104 121 bvh->mNumNodes = 1; 105 122 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.h
r3050 r3052 36 36 */ 37 37 RenderState(); 38 39 ~RenderState() { Reset(); };40 38 /** This must be called each time before and after an occlusion test. 41 39 Mode is one of render mode or query mode. Returns true if a state -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3050 r3052 91 91 92 92 93 void ResourceManager::DelSingleton() 94 { 95 DEL_PTR(sResourceManager); 96 } 97 98 93 99 SceneEntity *ResourceManager::LoadSceneEntity(igzstream &str) 94 100 { … … 431 437 432 438 433 434 439 ShaderProgram *ResourceManager::CreateFragmentProgram(const std::string &filename, 435 440 const std::string &funcName) … … 438 443 439 444 ShaderProgram *p = new ShaderProgram(sCgContext, fullName, sCgFragmentProfile, funcName); 440 441 445 mShaders.push_back(p); 442 446 … … 465 469 cerr << "Program " << funcName << " in " << fullName << " failed to load" << endl; 466 470 } 467 468 cout << "Program " << funcName << " in " << fullName << " loaded" << endl;471 else 472 cout << "Program " << funcName << " in " << fullName << " loaded" << endl; 469 473 470 474 return p; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
r3045 r3052 32 32 public: 33 33 34 /** Returns the resource manager as a singleton.35 */36 static ResourceManager *GetSingleton()37 {38 if (!sResourceManager)39 {40 sResourceManager = new ResourceManager();41 }42 43 return sResourceManager;44 }45 46 /** We also want full control over the delete.47 */48 static void DelSingleton()49 {50 DEL_PTR(sResourceManager);51 }52 53 34 /** Loads a model 54 35 */ 55 36 bool Load(const std::string &filename, SceneEntityContainer &geometry); 56 37 /** Returns number of scene entities loaded with this manager. 38 */ 57 39 int GetNumEntities() const { return (int)mSceneEntities.size(); } 58 59 40 /** Creates new gpu program parameters. 60 41 */ … … 71 52 void DisableVertexProfile(); 72 53 54 /** Returns the resource manager as a singleton. 55 */ 56 inline static ResourceManager *GetSingleton(); 57 /** We also want full control over the delete. 58 */ 59 static void DelSingleton(); 73 60 74 61 protected: … … 111 98 LODContainer mLODs; 112 99 113 ////////114 115 100 /// the scene entities 116 117 101 SceneEntityContainer mSceneEntities; 118 102 … … 132 116 133 117 118 ResourceManager *ResourceManager::GetSingleton() 119 { 120 if (!sResourceManager) 121 sResourceManager = new ResourceManager(); 122 123 return sResourceManager; 124 } 125 126 134 127 } 135 128 #endif -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3051 r3052 95 95 96 96 int assumedVisibleFrames = 10; 97 98 97 int maxBatchSize = 50; 99 100 98 int trianglesPerVirtualLeaf = INITIAL_TRIANGLES_PER_VIRTUAL_LEAVES; 101 102 99 SceneQuery *sceneQuery = NULL; 103 100 RenderQueue *renderQueue = NULL; 104 105 101 // traverses and renders the hierarchy 106 102 RenderTraverser *shadowTraverser = NULL; … … 291 287 int main(int argc, char* argv[]) 292 288 { 293 /*294 289 #ifdef _CRT_SET 295 290 … … 304 299 _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); 305 300 #endif 306 */ 301 307 302 cout << "=== reading environment file ===" << endl << endl; 308 303 … … 470 465 { 471 466 cerr << "loading file " << skyDomeStr << " failed" << endl; 472 473 467 CleanUp(); 474 468 exit(0); … … 1094 1088 CleanUp(); 1095 1089 exit(0); 1096 break;1097 1090 case 32: // space 1098 1091 renderMode = (renderMode + 1) % RenderTraverser::NUM_TRAVERSAL_TYPES; … … 1649 1642 DEL_PTR(shadowMap); 1650 1643 DEL_PTR(shadowTraverser); 1651 1644 1652 1645 ResourceManager::DelSingleton(); 1653 1646 loader = NULL;
Note: See TracChangeset
for help on using the changeset viewer.