- Timestamp:
- 04/04/06 23:55:38 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformHierarchyInterface.h
r187 r726 153 153 std::vector<PlatformOcclusionQuery *> mOcclusionQueries; 154 154 155 Vector3 mCameraPosition; 155 156 bool mOnlyShadowCasters; 156 157 int mLeavePassesInQueue; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityTerrainSceneManager.h
r347 r726 11 11 #include "OgrePlatformQueryManager.h" 12 12 #include "VisibilityManager.h" 13 14 13 15 14 namespace Ogre { … … 56 55 virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs, 57 56 bool doLightIteration, const LightList* manualLightList = 0); 58 59 57 /** Writes out stats into the Ogre log file. 60 58 */ 61 59 void WriteLog(); 62 60 63 /** Override pass so we can dothe z-fail pass.61 /** We override this because we want to include the z-fail pass. 64 62 */ 65 63 Pass* setPass(Pass* pass); 66 67 64 /** Override from SceneManager so we can skip all but first pass for depth pass. 68 65 */ 69 66 bool validatePassForRendering(Pass* pass); 70 67 /** This function renders renderables using false color ids. 68 */ 71 69 void RenderItemBuffer(RenderPriorityGroup* pGroup); 70 /** Renders a single object using false color id. 71 */ 72 72 void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass); 73 /** Overritten from scene manager to include the false color id rendering of the 74 scene objects. 75 */ 73 76 void renderQueueGroupObjects(RenderQueueGroup* pGroup); 74 77 … … 89 92 void endFrame(); 90 93 94 /** Override this because we must handle shadows differently. 95 */ 91 96 void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 97 /** Override this because we must handle shadows differently. 98 */ 92 99 void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 93 94 /** Override standard function so octree boxes are always of equal side length.95 This has advantages for CHC, because terrain tiles are in different octree nodes96 and can be culled.97 */98 void setWorldGeometry( const String& filename );99 100 100 101 protected: … … 161 162 162 163 bool mIsHierarchicalCulling; 164 165 std::ofstream mDummyLog; 163 166 }; 164 167 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
r722 r726 94 94 BufferSecurityCheck="FALSE" 95 95 EnableFunctionLevelLinking="TRUE" 96 RuntimeTypeInfo=" TRUE"96 RuntimeTypeInfo="FALSE" 97 97 UsePrecompiledHeader="0" 98 98 WarningLevel="3" … … 227 227 RelativePath="..\include\OgreVisibilitySceneManager.h"> 228 228 </File> 229 <File 230 RelativePath="..\include\VspBspTree.h"> 231 </File> 229 232 </Filter> 230 233 <Filter -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r720 r726 380 380 381 381 getRenderQueue()->clear(); // finally clear render queue 382 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before ...382 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before ... 383 383 WriteLog(); // write out stats 384 384 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp
r645 r726 27 27 // we need access to the scene manager and the rendersystem 28 28 PlatformHierarchyInterface *pfHierarchyInterface = 29 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 29 //dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 30 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 30 31 31 32 // disable overlays, reset them later -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r722 r726 21 21 22 22 // if we come across some renderable geometry => render it 23 if ( octree->mNodes.size() > 0)23 if (!octree->mNodes.empty()) 24 24 { 25 25 RenderNode(node); 26 26 } 27 27 28 // if (octree->numNodes() > (int)octree->mNodes.size()) //if not all subtrees are empty28 // if not all subtrees are empty 29 29 if (!IsLeaf(node)) 30 30 { 31 for(int i=0; i<8; ++i) 32 { 33 Octree *nextChild = 34 octree->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]; 35 36 if (nextChild) 37 { 38 mDistanceQueue->push(nextChild); 39 } 40 } 31 Octree *nextChild; 32 33 if ((nextChild = octree->mChildren[0][0][0]) != NULL) 34 mDistanceQueue->push(nextChild); 35 if ((nextChild = octree->mChildren[0][0][1]) != NULL) 36 mDistanceQueue->push(nextChild); 37 if ((nextChild = octree->mChildren[0][1][0]) != NULL) 38 mDistanceQueue->push(nextChild); 39 if ((nextChild = octree->mChildren[0][1][1]) != NULL) 40 mDistanceQueue->push(nextChild); 41 if ((nextChild = octree->mChildren[1][0][0]) != NULL) 42 mDistanceQueue->push(nextChild); 43 if ((nextChild = octree->mChildren[1][0][1]) != NULL) 44 mDistanceQueue->push(nextChild); 45 if ((nextChild = octree->mChildren[1][1][0]) != NULL) 46 mDistanceQueue->push(nextChild); 47 if ((nextChild = octree->mChildren[1][1][1]) != NULL) 48 mDistanceQueue->push(nextChild); 41 49 } 42 50 } … … 56 64 float OctreeHierarchyInterface::GetSquaredDistance(GtpVisibility::HierarchyNode *node) const 57 65 { 58 LogManager::getSingleton().logMessage("here4"); 66 const Vector3 bmin = static_cast<Octree *>(node)->mBox.getMinimum(); 67 const Vector3 bmax = static_cast<Octree *>(node)->mBox.getMaximum(); 59 68 60 const AxisAlignedBox &box = static_cast<Octree *>(node)->mBox; 61 const Vector3 pos = ((box.getMaximum() - box.getMinimum()) * 0.5) + box.getMinimum(); 69 const Vector3 pos = (bmax - bmin) * 0.5 + bmin; 62 70 63 return (mC ullCamera->getDerivedPosition()- pos).squaredLength();71 return (mCameraPosition - pos).squaredLength(); 64 72 } 65 73 //----------------------------------------------------------------------- … … 101 109 { 102 110 octant->setLastRendered(mFrameId); 103 104 dynamic_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera, 105 octant, mOnlyShadowCasters, mLeavePassesInQueue); 111 OctreeSceneManager *ocm = 112 //dynamic_cast<OctreeSceneManager *>(mSceneManager); 113 static_cast<OctreeSceneManager *>(mSceneManager); 114 ocm->_renderOctant(mCamera, octant, mOnlyShadowCasters, mLeavePassesInQueue); 106 115 107 116 mVisibleNodes.push_back(node); … … 155 164 } 156 165 157 dynamic_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 166 //dynamic_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 167 static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 158 168 } 159 169 //----------------------------------------------------------------------- 160 void OctreeHierarchyInterface::GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 161 GtpVisibility::GeometryVector *geometryList,162 bool includeChildren)170 void OctreeHierarchyInterface::GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 171 GtpVisibility::GeometryVector *geometryList, 172 bool includeChildren) 163 173 { 164 174 NodeList::const_iterator nodeIt, nodeIt_end; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp
r316 r726 11 11 12 12 //----------------------------------------------------------------------- 13 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 14 mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL), mCamera(NULL), 15 mCullCamera(NULL), mOnlyShadowCasters(false), mLeavePassesInQueue(0), 16 mIsBoundingBoxQuery(false) 13 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, 14 RenderSystem *rsys): 15 mSceneManager(sm), 16 mRenderSystem(rsys), 17 mSolidBoundingBox(NULL), 18 mCamera(NULL), 19 mCullCamera(NULL), 20 mOnlyShadowCasters(false), 21 mLeavePassesInQueue(0), 22 mIsBoundingBoxQuery(false), 23 mCameraPosition(Vector3(0, 0, 0)) 17 24 { 18 25 } … … 131 138 mCullCamera = cullCam ? cullCam : cam; 132 139 140 mCameraPosition = mCullCamera->getDerivedPosition(); 133 141 // create materials for node visualization 134 142 CreateNodeVizMaterials(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp
r316 r726 31 31 bool relativeVisibility) 32 32 { 33 SceneManager *sm = dynamic_cast<PlatformHierarchyInterface *> 33 SceneManager *sm = //dynamic_cast<PlatformHierarchyInterface *> 34 static_cast<PlatformHierarchyInterface *> 34 35 (mHierarchyInterface)->GetSceneManager(); 35 36 … … 93 94 // we need access to the scene manager and the rendersystem 94 95 PlatformHierarchyInterface *pfHierarchyInterface = 95 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 96 //dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 97 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 96 98 97 99 SceneManager *sm = pfHierarchyInterface->GetSceneManager(); … … 189 191 190 192 SceneManager *sm = 191 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 193 //dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 194 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 192 195 193 196 SceneManager::EntityIterator it = sm->getEntityIterator(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOctreeSceneManager.cpp
r720 r726 24 24 mLeavePassesInQueue(0), 25 25 mDelayRenderTransparents(true), 26 //mDelayRenderTransparents(false),27 //mUseDepthPass(true),28 26 mUseDepthPass(false), 29 27 mIsDepthPassPhase(false), 30 28 mUseItemBuffer(false), 31 //mUseItemBuffer(true),32 29 mIsItemBufferPhase(false), 33 30 mCurrentEntityId(1), -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityTerrainSceneManager.cpp
r720 r726 10 10 #include <OgreSubEntity.h> 11 11 12 // HACK 13 const static DEBUG_CHC = false; 12 13 // normal terrain rendering 14 const static NORMAL_RENDER_HACK = false; 14 15 15 16 namespace Ogre { … … 17 18 //----------------------------------------------------------------------- 18 19 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 19 GtpVisibility::VisibilityManager *visManager): 20 GtpVisibility::VisibilityManager *visManager): 21 TerrainSceneManager(), 20 22 mVisibilityManager(visManager), 21 23 mShowVisualization(false), … … 28 30 mIsDepthPassPhase(false), 29 31 mUseItemBuffer(false), 30 //mUseItemBuffer(true),31 32 mIsItemBufferPhase(false), 32 33 mCurrentEntityId(1), … … 101 102 //mItemBufferPass->setAmbient(1, 1, 0); 102 103 } 103 //-------------------------------------------------------------------------104 void VisibilityTerrainSceneManager::setWorldGeometry( const String& filename )105 {106 // Clear out any existing world resources (if not default)107 if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=108 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)109 {110 ResourceGroupManager::getSingleton().clearResourceGroup(111 ResourceGroupManager::getSingleton().getWorldResourceGroupName());112 }113 114 mTerrainPages.clear();115 116 // Load the configuration117 loadConfig(filename);118 119 // Resize the octree, allow for 1 page for now120 float max_x = mOptions.scale.x * mOptions.pageSize;121 float max_y = mOptions.scale.y;122 float max_z = mOptions.scale.z * mOptions.pageSize;123 124 float maxAxis = std::max(max_x, max_y);125 maxAxis = std::max(maxAxis, max_z);126 resize(AxisAlignedBox(0, 0, 0, maxAxis, maxAxis, maxAxis));127 128 setupTerrainMaterial();129 setupTerrainPages();130 }131 132 104 //----------------------------------------------------------------------- 133 105 void VisibilityTerrainSceneManager::PrepareVisualization(Camera *cam) … … 146 118 // ignore 147 119 } 120 // add bounding boxes of rendered objects 148 121 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 149 122 { 150 123 getRenderQueue()->addRenderable(*it); 151 124 } 125 152 126 if (mRenderNodesForViz || mRenderNodesContentForViz) 153 127 { … … 182 156 Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 183 157 { 158 if (NORMAL_RENDER_HACK) 159 { 160 return SceneManager::setPass(pass); 161 } 162 184 163 // TODO: setting vertex program is not efficient 185 164 //Pass *usedPass = ((mIsDepthPassPhase && !pass->hasVertexProgram()) ? mDepthPass : pass); 186 165 187 166 // set depth fill pass if we currently do not make an aabb occlusion query 188 const bool useDepthPass = 1 &&167 const bool useDepthPass = 189 168 (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery()); 190 169 … … 196 175 // set illumination stage to NONE so no shadow material is used 197 176 // for depth pass or for occlusion query 198 if (1 && 199 (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery())) 177 if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery()) 200 178 { 201 179 mIlluminationStage = IRS_NONE; … … 203 181 204 182 // --- set vertex program of current pass in order to set correct depth 205 if (mExecuteVertexProgramForAllPasses 206 && mIsDepthPassPhase207 &&pass->hasVertexProgram())183 if (mExecuteVertexProgramForAllPasses && 184 mIsDepthPassPhase && 185 pass->hasVertexProgram()) 208 186 { 209 187 // add vertex program of current pass to depth pass … … 254 232 bool onlyShadowCasters) 255 233 { 234 if (NORMAL_RENDER_HACK) 235 { 236 TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 237 return; 238 } 239 256 240 //-- show visible scene nodes and octree bounding boxes from last frame 257 241 if (mShowVisualization) … … 273 257 274 258 // only shadow casters will be rendered in shadow texture pass 275 if (0) 276 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 259 if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 277 260 } 278 261 … … 285 268 void VisibilityTerrainSceneManager::_renderVisibleObjects() 286 269 { 270 if (NORMAL_RENDER_HACK) 271 { 272 TerrainSceneManager::_renderVisibleObjects(); 273 274 return; 275 } 276 287 277 InitDepthPass(); // create material for depth pass 288 278 InitItemBufferPass(); // create material for item buffer pass … … 309 299 } 310 300 else //-- the hierarchical culling algorithm 311 { 301 { 302 // from TerrainSceneManager 303 mDestRenderSystem -> setLightingEnabled(false); 304 312 305 // don't render backgrounds for item buffer 313 306 if (mUseItemBuffer) … … 327 320 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE); 328 321 329 TerrainSceneManager::_renderVisibleObjects();322 OctreeSceneManager::_renderVisibleObjects(); 330 323 ///////////////////////////////////////////////// 331 324 … … 356 349 mVisibilityManager->ApplyVisibilityCulling(); 357 350 358 // delete remaining renderables from queue (all not in mLeavePassesInQueue) 351 // delete remaining renderables from queue: 352 // all which are not in mLeavePassesInQueue) 359 353 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 360 354 _deleteRenderedQueueGroups(mLeavePassesInQueue); … … 367 361 mLeavePassesInQueue = 0; 368 362 369 363 #if 1 370 364 // add visible nodes found by the visibility culling algorithm 371 #if 1372 365 if (mUseDepthPass) 373 366 { 374 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++ it) 367 NodeList::const_iterator it, it_end = mVisible.end(); 368 369 //getRenderQueue()->clear(); 370 for (it = mVisible.begin(); it != it_end; ++ it) 375 371 { 376 372 (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); … … 382 378 clearSpecialCaseRenderQueues(); 383 379 384 if (!DEBUG_CHC) 385 TerrainSceneManager::_renderVisibleObjects(); 380 OctreeSceneManager::_renderVisibleObjects(); 386 381 } 387 382 … … 394 389 395 390 getRenderQueue()->clear(); // finally clear render queue 396 OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared...397 398 //WriteLog(); // write out stats391 if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 392 393 if (0) WriteLog(); // write out stats 399 394 } 400 395 … … 402 397 void VisibilityTerrainSceneManager::_updateSceneGraph(Camera* cam) 403 398 { 399 if (NORMAL_RENDER_HACK) 400 { 401 TerrainSceneManager::_updateSceneGraph(cam); 402 return; 403 } 404 404 405 mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 405 406 mHierarchyInterface->SetRenderSystem(mDestRenderSystem); … … 531 532 } 532 533 //----------------------------------------------------------------------- 533 GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::getVisibilityManager( void)534 GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::getVisibilityManager() 534 535 { 535 536 return mVisibilityManager; … … 549 550 << "Query culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes() << ", " 550 551 << "Frustum culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes() << ", " 551 << "Queries issued: " << mVisibilityManager->GetCullingManager()->GetNumQueriesIssued() << "\n"; 552 << "Queries issued: " << mVisibilityManager->GetCullingManager()->GetNumQueriesIssued() << ", " 553 << "Found objects: " << (int)mVisible.size() << "\n"; 552 554 553 555 LogManager::getSingleton().logMessage(d.str()); … … 560 562 { 561 563 // for correct rendering, transparents must be rendered after hierarchical culling 562 if (1 && !mSkipTransparents) 563 { 564 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 564 // => do nothing 565 if (NORMAL_RENDER_HACK || !mSkipTransparents) 566 { 567 SceneManager::renderObjects(objs, doLightIteration, manualLightList); 565 568 } 566 569 } 567 570 //----------------------------------------------------------------------- 568 571 bool VisibilityTerrainSceneManager::validatePassForRendering(Pass* pass) 569 { 572 { 573 if (NORMAL_RENDER_HACK) 574 { 575 return SceneManager::validatePassForRendering(pass); 576 } 577 570 578 // skip all but first pass if we are doing the depth pass 571 579 if ((mIsDepthPassPhase || mIsItemBufferPhase) && (pass->getIndex() > 0)) … … 584 592 void VisibilityTerrainSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 585 593 { 586 if ( !mIsItemBufferPhase)587 { 588 TerrainSceneManager::renderQueueGroupObjects(pGroup);594 if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 595 { 596 SceneManager::renderQueueGroupObjects(pGroup); 589 597 return; 590 598 } … … 616 624 continue; 617 625 618 // Render only first pass 626 // Render only first pass of renderable as false color 619 627 if (ipass->first->getIndex() > 0) 620 628 continue; … … 627 635 for (irend = rendList->begin(); irend != irendend; ++irend) 628 636 { 629 std::stringstream d; d << "itembuffer, pass name: " << 637 if (0) 638 { 639 std::stringstream d; d << "itembuffer, pass name: " << 630 640 ipass->first->getParent()->getParent()->getName(); 631 632 //LogManager::getSingleton().logMessage(d.str());641 LogManager::getSingleton().logMessage(d.str()); 642 } 633 643 634 644 RenderSingleObjectForItemBuffer(*irend, ipass->first); … … 636 646 } 637 647 638 // -- TRANSPARENT LOOP: must be handled differently648 //-- TRANSPARENT LOOP: must be handled differently from solids 639 649 640 650 // transparents are treated either as solids or completely discarded … … 729 739 mLeavePassesInQueue = 0; 730 740 731 if (! DEBUG_CHC && !mUseDepthPass && !mUseItemBuffer)741 if (!mUseDepthPass && !mUseItemBuffer) 732 742 { 733 743 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) … … 760 770 // skip rendering transparents during the hierarchical culling 761 771 // (because they will be rendered afterwards) 762 mSkipTransparents = !DEBUG_CHC &&772 mSkipTransparents = 763 773 (mIsDepthPassPhase || (mLeavePassesInQueue & RenderPriorityGroup::TRANSPARENT_PASSES)); 764 774 … … 800 810 } 801 811 //----------------------------------------------------------------------- 802 void VisibilityTerrainSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 812 void VisibilityTerrainSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 813 RenderQueueGroup* pGroup) 803 814 { 804 815 // only render solid passes during hierarchical culling … … 832 843 } 833 844 //----------------------------------------------------------------------- 834 void VisibilityTerrainSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 845 void VisibilityTerrainSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 846 RenderQueueGroup* pGroup) 835 847 { 836 848 if (mIsHierarchicalCulling) -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/DistanceQueue.h
r722 r726 23 23 {} 24 24 25 bool operator() ( T v1,T v2) const25 bool operator() (const T v1, const T v2) const 26 26 { 27 return false;//mHierarchyInterface->GetSquaredDistance(v1) > mHierarchyInterface->GetSquaredDistance(v2); 27 //return false; 28 return mHierarchyInterface->GetSquaredDistance(v1) > mHierarchyInterface->GetSquaredDistance(v2); 28 29 } 29 30 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h
r606 r726 72 72 */ 73 73 DistanceQueue *GetQueue(); 74 74 75 /** Returns distance of the node to the view plane. 75 @param node 1the hierarchy node76 @param node the hierarchy node 76 77 */ 77 78 virtual float GetSquaredDistance(HierarchyNode *node) const = 0; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp
r350 r726 30 30 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 31 31 { 32 // only wait for result if queue is empty 32 33 while (!queryQueue.empty() && 33 34 queryQueue.front().second->GetQueryResult(visiblePixels, … … 40 41 if (visiblePixels > mVisibilityThreshold) 41 42 { 42 // ensure that we only traverse once if geometry in node43 // in case geometry is in omterior node: ensure that we only traverse once 43 44 if (!mHierarchyInterface->IsNodeVisible(node)) 45 { 44 46 mHierarchyInterface->TraverseNode(node); 47 } 48 45 49 mHierarchyInterface->PullUpVisibility(node); 46 50 } … … 96 100 { 97 101 SkipQuery(node); 98 99 102 continue; 100 103 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/FrustumCullingManager.cpp
r720 r726 8 8 { 9 9 if (0) Ogre::LogManager::getSingleton().logMessage("Frustum Culling"); 10 10 11 while (!mHierarchyInterface->GetQueue()->empty()) 11 12 { 12 13 HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 13 14 mHierarchyInterface->GetQueue()->pop(); 14 15 15 16 // interesting for visualization purpose 16 17 mHierarchyInterface->SetNodeVisible(node, false); … … 33 34 } 34 35 } 35 36 36 } // namespace GtpVisibility -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/HierarchyInterface.cpp
r316 r726 7 7 //----------------------------------------------------------------------- 8 8 HierarchyInterface::HierarchyInterface(): 9 mFrameId(0), mNumTraversedNodes(0), mHierarchyRoot(NULL), 10 mSavedNode(NULL), mCurrentTestIdx(0), mTestGeometryForVisibleLeaves(false) 9 mFrameId(0), 10 mNumTraversedNodes(0), 11 mHierarchyRoot(NULL), 12 mSavedNode(NULL), 13 mCurrentTestIdx(0), 14 mTestGeometryForVisibleLeaves(false) 11 15 { 12 16 mDistanceQueue = new DistanceQueue(GtDistance<HierarchyNode *>(this)); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityManager.cpp
r722 r726 18 18 mAssumedVisibilityForChc(0) 19 19 { 20 21 20 #if 1 22 21 SetCullingManager(VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING); -
GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
r722 r726 65 65 <Tool 66 66 Name="VCCLCompilerTool" 67 InlineFunctionExpansion="2" 68 FavorSizeOrSpeed="1" 69 OptimizeForWindowsApplication="TRUE" 67 70 AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces" 68 71 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;" -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
r704 r726 156 156 157 157 currentMesh->AddFace(face); 158 if (meshGrouping != 0 && 159 currentMesh->mFaces.size() >= meshGrouping) { 158 if (meshGrouping != 0 && currentMesh->mFaces.size() >= meshGrouping) { 160 159 if (ROTATE_SCENE) 161 160 RotateMesh(currentMesh); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r719 r726 2441 2441 { 2442 2442 geom.Add(candidatePolys[i], candidatePlanes[i]); 2443 // geom.mPolys.push_back(candidates[i]);2444 2443 } 2445 2444 } … … 2456 2455 2457 2456 2458 int BspTree::FindNeighbors(BspNode *n, vector<BspLeaf *>2459 &neighbors,2457 int BspTree::FindNeighbors(BspNode *n, 2458 vector<BspLeaf *> &neighbors, 2460 2459 const bool onlyUnmailed) const 2461 2460 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r722 r726 2104 2104 { 2105 2105 exporter->ExportMesh(vc->GetMesh()); 2106 2106 2107 return; 2107 2108 } 2108 2109 2110 2111 if (clipPlane) 2112 { 2113 ViewCellContainer leaves; 2114 mViewCellsTree->CollectLeaves(vc, leaves); 2115 ViewCellContainer::const_iterator it, it_end = leaves.end(); 2116 2117 for (it = leaves.begin(); it != it_end; ++ it) 2118 { 2119 BspNodeGeometry geom; 2120 2121 BspNodeGeometry front; 2122 BspNodeGeometry back; 2123 2124 BspLeaf *leaf = dynamic_cast<BspViewCell *>(*it)->mLeaf; 2125 mBspTree->ConstructGeometry(leaf, geom); 2126 2127 const float eps = 0.00000001f; 2128 const int cf = geom.Side(*clipPlane, eps); 2129 2130 if (cf == -1) 2131 { 2132 exporter->ExportPolygons(geom.GetPolys()); 2133 } 2134 else if (cf == 0) 2135 { 2136 geom.SplitGeometry(front, 2137 back, 2138 *clipPlane, 2139 mViewSpaceBox, 2140 eps); 2141 2142 //Debug << "geo size: " << geom.Size() << endl; 2143 //Debug << "size b: " << back.Size() << " f: " << front.Size() << endl; 2144 if (back.Valid()) 2145 { 2146 exporter->ExportPolygons(back.GetPolys()); 2147 } 2148 } 2149 } 2150 } 2151 else 2152 { 2153 BspNodeGeometry geom; 2154 mBspTree->ConstructGeometry(vc, geom); 2155 2156 exporter->ExportPolygons(geom.GetPolys()); 2157 } 2158 } 2159 2160 2161 void BspViewCellsManager::CreateMesh(ViewCell *vc) 2162 { 2163 // delete previous mesh 2164 ///DEL_PTR(vc->GetMesh()); 2109 2165 BspNodeGeometry geom; 2110 2166 mBspTree->ConstructGeometry(vc, geom); 2111 2167 2112 if (clipPlane)2113 {2114 const int cf = Polygon3::ClassifyPlane(geom.GetPolys(), *clipPlane, 0.0001f);2115 2116 if (cf == Polygon3::BACK_SIDE)2117 {2118 exporter->ExportPolygons(geom.GetPolys());2119 }2120 else if (cf == Polygon3::SPLIT)2121 {2122 BspNodeGeometry front;2123 BspNodeGeometry back;2124 2125 geom.SplitGeometry(front,2126 back,2127 *clipPlane,2128 mViewSpaceBox,2129 0.0001f);2130 2131 if (back.Valid())2132 exporter->ExportPolygons(back.GetPolys());2133 }2134 }2135 else2136 {2137 exporter->ExportPolygons(geom.GetPolys());2138 }2139 }2140 2141 2142 void BspViewCellsManager::CreateMesh(ViewCell *vc)2143 {2144 if (vc->GetMesh())2145 delete vc->GetMesh();2146 2147 BspNodeGeometry geom;2148 2149 mBspTree->ConstructGeometry(vc, geom);2150 2151 2168 Mesh *mesh = new Mesh(); 2169 2152 2170 geom.AddToMesh(*mesh); 2153 2171 vc->SetMesh(mesh); 2172 // put mesh into mesh container so we can savely delete it 2154 2173 mMeshContainer.push_back(mesh); 2155 2174 } … … 2785 2804 } 2786 2805 2806 2787 2807 void VspKdViewCellsManager::Visualize(const ObjectContainer &objects, 2788 2808 const VssRayContainer &sampleRays) … … 2882 2902 Exporter *exporter = Exporter::GetExporter("vspkdtree_merged.x3d"); 2883 2903 2884 //if (exportGeometry) exporter->SetWireframe();2885 //else exporter->SetFilled();2886 2904 2887 2905 ExportViewCellsForViz(exporter); … … 4000 4018 void VspBspViewCellsManager::CreateMesh(ViewCell *vc) 4001 4019 { 4002 if (vc->GetMesh()) 4003 delete vc->GetMesh(); 4004 4005 4020 //if (vc->GetMesh()) delete vc->GetMesh(); 4006 4021 BspNodeGeometry geom; 4007 4022 … … 4011 4026 geom.AddToMesh(*mesh); 4012 4027 vc->SetMesh(mesh); 4028 // put mesh into mesh container so we can savely delete it 4013 4029 mMeshContainer.push_back(mesh); 4014 4030 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r719 r726 458 458 459 459 EvalPriority(tData); 460 461 462 if (mSimulateOctree) 463 tData.mAxis = 0; 460 464 461 465 462 // first node is kd node, i.e. an axis aligned box … … 569 566 geom); 570 567 571 572 568 573 569 // compute first split candidate … … 695 691 VspBspTraversalData tBackData; 696 692 697 if (mSimulateOctree)698 { // choose axes in circular motion699 tFrontData.mAxis = (tData.mAxis + 1) % 3;700 tBackData.mAxis = (tData.mAxis + 1) % 3;701 }702 703 693 // create new interior node and two leaf nodes 704 694 // or return leaf as it is (if maxCostRatio missed) … … 709 699 Plane3 splitPlane; 710 700 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); 711 701 702 // choose next split plane 712 703 if (!SelectPlane(splitPlane, leaf, tData, tFrontData, tBackData, splitAxis)) 713 704 { … … 722 713 } 723 714 715 // if this a valid split => subdivide this node further 724 716 if (splitFurther) //-- continue subdivision 725 717 { … … 732 724 733 725 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 726 tFrontData.mAxis = tBackData.mAxis = splitAxis; 734 727 735 728 // how often was max cost ratio missed in this branch? … … 740 733 EvalPriority(tBackData); 741 734 735 // evaluate subdivision stats 742 736 if (1) 743 737 { 744 745 738 float cFront = (float)tFrontData.mPvs * tFrontData.mProbability; 746 739 float cBack = (float)tBackData.mPvs * tBackData.mProbability; … … 823 816 } 824 817 825 818 // subdivide using a split plane queue 826 819 BspNode *VspBspTree::Subdivide(VspBspSplitQueue &tQueue, 827 820 VspBspSplitCandidate &splitCandidate) … … 839 832 840 833 //-- continue subdivision 834 841 835 // create new interior node and two leaf node 842 836 const Plane3 splitPlane = splitCandidate.mSplitPlane; … … 853 847 854 848 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 855 849 tFrontData.mAxis = tBackData.mAxis = splitAxis; 850 856 851 // how often was max cost ratio missed in this branch? 857 852 tFrontData.mMaxCostMisses = maxCostMisses; … … 960 955 961 956 // compute locally best split plane 962 957 bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, 963 958 frontData, backData, splitData.mSplitAxis); 964 959 … … 1403 1398 sAxis = Random(3); 1404 1399 else if (mSimulateOctree) 1405 sAxis = tData.mAxis;1400 sAxis = (tData.mAxis + 1) % 3; 1406 1401 1407 1402 //Debug << "use special axis: " << useSpecialAxis << endl; … … 2012 2007 2013 2008 const int pvsSize = data.mPvs; 2014 //cout << "here433" << endl; 2009 2015 2010 RayInfoContainer::const_iterator rit, rit_end = data.mRays->end(); 2016 2011 -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r712 r726 1145 1145 for (oit = objects.begin(); oit != oit_end; ++ oit) 1146 1146 { 1147 if (1) 1148 { 1147 if (0) 1149 1148 SetForcedMaterial(RandomMaterial()); 1150 } 1151 1149 1152 1150 ExportIntersectable(*oit); 1153 1151 } -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
r712 r726 57 57 58 58 59 static void RotateMesh(Mesh *mesh) 60 { 61 VertexContainer::iterator it, it_end = mesh->mVertices.end(); 62 63 const float angle = 30.0f * PI / 180.0f; 64 const Matrix4x4 rot = RotationYMatrix(angle); 65 66 for (it = mesh->mVertices.begin(); it != it_end; ++ it) 67 { 68 (*it) = rot * (*it); 69 } 70 } 59 71 60 72 // --------------------------------------------------------------------------- … … 96 108 97 109 98 static void RotateMesh(Mesh *mesh)99 {100 VertexContainer::iterator it, it_end = mesh->mVertices.end();101 102 const float angle = 30.0f * PI / 180.0f;103 const Matrix4x4 rot = RotationYMatrix(angle);104 105 for (it = mesh->mVertices.begin(); it != it_end; ++ it)106 {107 (*it) = rot * (*it);108 }109 }110 110 111 111
Note: See TracChangeset
for help on using the changeset viewer.