Changeset 2183 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 03/02/07 13:13:24 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreMeshInstance.h
r2115 r2183 52 52 GtpVisibilityPreprocessor::Vector3 &normal); 53 53 54 ostream &Describe(ostream &s);54 std::ostream &Describe(std::ostream &s); 55 55 56 56 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h
r2171 r2183 13 13 #include "Containers.h" 14 14 #include "ViewCellsManager.h" 15 #include "VisibilityInfo.h" 15 16 16 17 … … 20 21 21 22 class ObjReader; 23 22 24 23 25 namespace Ogre { … … 126 128 void RenderDepthForQuery(Camera* camera, Viewport* vp); 127 129 130 void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); 131 128 132 protected: 129 133 … … 191 195 const bool fromPoint, 192 196 const bool nodeVisibility); 197 198 void AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry, Camera *cam); 199 void AddVisibleNodeGeometryToQueue(const GtpVisibility::NodeInfoContainer &visibleNodes, Camera *cam); 193 200 194 201 ////////////////////////////////////////// -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreMeshInstance.cpp
r2115 r2183 74 74 } 75 75 76 ostream &OgreMeshInstance::Describe(ostream &s)76 std::ostream &OgreMeshInstance::Describe(std::ostream &s) 77 77 { 78 78 s << mEntity; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2176 r2183 25 25 #include "ObjReader.h" 26 26 #include "OgreOcclusionQueriesQueryManager.h" 27 #include "VisibilityInfo.h" 28 #include "Preprocessor.h" 27 29 28 30 … … 706 708 707 709 // standard rendering in first pass 708 if (!mNormalExecution && mUseDepthPass) 710 // hierarchical culling interleaves identification 711 // and rendering of objects in _renderVisibibleObjects 712 713 // for the shadow pass we use only standard rendering 714 // because shadows have low occlusion anyway 715 if ((mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 716 mIlluminationStage == IRS_RENDER_TO_TEXTURE) || 717 mNormalExecution) 718 { 719 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 720 } 721 else if (mUseDepthPass) 709 722 { 710 723 RenderDepthPass(); 711 724 } 712 else 713 { 714 // hierarchical culling interleaves identification 715 // and rendering of objects in _renderVisibibleObjects 716 717 // for the shadow pass we use only standard rendering 718 // because shadows have low occlusion anyway 719 if ((mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 720 mIlluminationStage == IRS_RENDER_TO_TEXTURE) || 721 mNormalExecution) 722 { 723 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 724 } 725 726 // only shadow casters will be rendered in shadow texture pass 727 //if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 728 } 725 726 // only shadow casters will be rendered in shadow texture pass 727 //if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 729 728 } 730 729 //----------------------------------------------------------------------- … … 1087 1086 return false; 1088 1087 1089 const bool fromPoint = true;1088 const bool fromPoint = false; 1090 1089 const bool nodeVisibility = true; 1091 1090 … … 1397 1396 1398 1397 // possible two cameras (one for culling, one for rendering) 1399 mHierarchyInterface->InitTraversal( mCameraInProgress,1398 mHierarchyInterface->InitTraversal(cam, 1400 1399 mCullCamera ? getCamera("CullCamera") : NULL, 1401 1400 mLeavePassesInQueue); … … 2311 2310 } 2312 2311 //----------------------------------------------------------------------- 2312 void OcclusionCullingSceneManager::AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry, 2313 Camera *cam) 2314 { 2315 GtpVisibility::MeshInfoContainer::const_iterator geomIt, geomIt_end = visibleGeometry.end(); 2316 2317 for (geomIt = visibleGeometry.begin(); geomIt != geomIt_end; ++geomIt) 2318 { 2319 MovableObject *mo = (*geomIt).GetSource(); 2320 2321 // add if not 0 2322 if (!(*geomIt).GetVisiblePixels()) 2323 continue; 2324 2325 mo->_notifyCurrentCamera(cam); 2326 2327 if (mo->isVisible()) 2328 { 2329 mo->_updateRenderQueue(getRenderQueue()); 2330 } 2331 } 2332 } 2333 //----------------------------------------------------------------------- 2334 void OcclusionCullingSceneManager::AddVisibleNodeGeometryToQueue(const GtpVisibility::NodeInfoContainer &visibleNodes, 2335 Camera *cam) 2336 { 2337 //////////////// 2338 //-- apply queries on node level 2339 2340 GtpVisibility::NodeInfoContainer::const_iterator nodesIt, nodesIt_end = visibleNodes.end(); 2341 2342 for (nodesIt = visibleNodes.begin(); nodesIt != nodesIt_end; ++ nodesIt) 2343 { 2344 if (!(*nodesIt).GetVisiblePixels()) 2345 continue; 2346 2347 Octree *octree = static_cast<Octree *>((*nodesIt).GetSource()); 2348 2349 NodeList::iterator nIt, nIt_end = octree->mNodes.end(); 2350 2351 for (nIt = octree->mNodes.begin(); nIt != nIt_end; ++ nIt) 2352 { 2353 (*nIt)->_addToRenderQueue(cam, getRenderQueue(), false); 2354 } 2355 } 2356 } 2357 //----------------------------------------------------------------------- 2358 void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, 2359 bool onlyShadowCasters) 2360 { 2361 // lists only used for visualization 2362 mVisible.clear(); 2363 mBoxes.clear(); 2364 2365 const bool fromPoint = false; 2366 const bool nodeVisibility = false; 2367 2368 const int itemBufferMode = 0; 2369 const bool relativeVisibility = false; 2370 2371 int queryModes = 0; 2372 2373 if (nodeVisibility) 2374 queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY; 2375 else 2376 queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY; 2377 2378 OcclusionQueriesQueryManager *queryManager = 2379 new OcclusionQueriesQueryManager(mHierarchyInterface, 2380 mCurrentViewport, 2381 queryModes, 2382 itemBufferMode); 2383 2384 mVisibilityManager->SetQueryManager(queryManager); 2385 2386 GtpVisibility::NodeInfoContainer visibleNodes; 2387 GtpVisibility::MeshInfoContainer visibleGeometry; 2388 GtpVisibility::PatchInfoContainer visiblePatches; 2389 2390 if (fromPoint) 2391 { 2392 queryManager->ComputeFromPointVisibility(cam->getDerivedPosition(), 2393 &visibleNodes, 2394 &visibleGeometry, 2395 &visiblePatches, 2396 relativeVisibility); 2397 } 2398 else 2399 { 2400 queryManager->ComputeCameraVisibility(*cam, 2401 &visibleNodes, 2402 &visibleGeometry, 2403 &visiblePatches, 2404 relativeVisibility); 2405 } 2406 2407 if (0) 2408 { 2409 std::stringstream d; 2410 d << "Query mode: " << queryModes 2411 << " visible nodes: " << (int)visibleNodes.size() 2412 << " visible geometry: " << (int)visibleGeometry.size(); 2413 2414 LogManager::getSingleton().logMessage(d.str()); 2415 } 2416 2417 /////////////////////// 2418 //-- put items in render queue 2419 ////////// 2420 2421 //getRenderQueue()->clear(); 2422 2423 ////////////////////// 2424 //-- apply queries on geometry level 2425 2426 if (!nodeVisibility) 2427 { 2428 AddVisibleMeshGeometryToQueue(visibleGeometry, cam); 2429 } 2430 else 2431 { 2432 AddVisibleNodeGeometryToQueue(visibleNodes, cam); 2433 } 2434 2435 delete queryManager; 2436 } 2437 2438 //----------------------------------------------------------------------- 2313 2439 void OcclusionCullingSceneManagerFactory::destroyInstance(SceneManager* instance) 2314 2440 { -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp
r2171 r2183 168 168 { 169 169 //-- queries for hierarchy nodes 170 for (nodeIt = nodeList.begin(); nodeIt != nodeIt_end; ++ nodeIt)170 for (nodeIt = nodeList.begin(); nodeIt != nodeIt_end; ++ nodeIt) 171 171 { 172 172 // TODO: DELETE QUERIES FROM PREVIOUS RENDER 173 queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false)); 173 bool intersects = false; 174 175 pfHierarchyInterface->CheckFrustumVisible(*nodeIt, intersects); 176 177 // always push back if intersects 178 if (1 && intersects) 179 { 180 // no more information available 181 const int visPixels = 1; 182 const int projPixels = 1; 183 184 visibleNodes->push_back(GtpVisibility::NodeInfo(*nodeIt, visPixels, projPixels)); 185 queryList[i].push_back(NULL); 186 } 187 else 188 { 189 queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false)); 190 } 174 191 } 175 192 … … 300 317 for (nodeIt = nodeList->begin(); nodeIt != nodeList->end(); ++ nodeIt) 301 318 { 319 if (!(*visQueryIt)) 320 { 321 ++ visQueryIt; 322 if (relativeVisibility) 323 ++ projQueryIt; 324 continue; 325 } 326 302 327 unsigned int visiblePixels = 0; 303 328 (*visQueryIt)->GetQueryResult(visiblePixels, true); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2171 r2183 21 21 Optimization="0" 22 22 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer" 23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE "23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 24 24 MinimalRebuild="TRUE" 25 25 BasicRuntimeChecks="3" … … 90 90 OptimizeForWindowsApplication="TRUE" 91 91 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE 1"92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 93 93 StringPooling="TRUE" 94 94 RuntimeLibrary="2" … … 320 320 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\Release";"$(OGRE_PATH)\OgreMain\lib\Release";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;"$(OGRE_PATH)\Dependencies\lib\Release";..\..\..\Preprocessing\lib\Release;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\Lib\Vis\Preprocessing\MultiLevelRayTracing\RTWorld\Release;..\..\..\..\..\Lib\Vis\Preprocessing\MultiLevelRayTracing\RTScene\Release;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\Release;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\lib\Release" 321 321 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 322 GenerateDebugInformation=" FALSE"322 GenerateDebugInformation="TRUE" 323 323 SubSystem="2" 324 324 OptimizeReferences="2"
Note: See TracChangeset
for help on using the changeset viewer.