Changeset 2171 for GTP/trunk/Lib
- Timestamp:
- 02/27/07 10:25:01 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h
r2164 r2171 124 124 bool LoadViewCells(const String &filename); 125 125 126 void RenderDepthForQuery(Camera* camera, Viewport* vp); 127 126 128 protected: 127 129 … … 130 132 void SetObjectVisible(GtpVisibilityPreprocessor::Intersectable *entry, 131 133 const bool visible); 134 132 135 void ShowViewCellsGeometry(); 133 136 … … 180 183 void loadConfig(DataStreamPtr& stream); 181 184 182 void RenderDepthPass( );185 void RenderDepthPass(const bool fillRenderQueue = true); 183 186 184 187 void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays); 188 189 int FindExactVisibleObjects(Camera *camera, 190 Viewport* vp, 191 const bool fromPoint, 192 const bool nodeVisibility); 185 193 186 194 ////////////////////////////////////////// -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionQueriesQueryManager.h
r925 r2171 19 19 20 20 void ComputeCameraVisibility(const Camera &camera, 21 22 23 GtpVisibility::PatchInfoContainer *visiblePatches,24 21 GtpVisibility::NodeInfoContainer *visibleNodes, 22 GtpVisibility::MeshInfoContainer *visibleGeometry, 23 GtpVisibility::PatchInfoContainer *visiblePatches, 24 bool relativeVisibility = false); 25 25 26 26 /** … … 29 29 */ 30 30 void ComputeFromPointVisibility(const Vector3 &point, 31 32 33 34 31 GtpVisibility::NodeInfoContainer *visibleNodes, 32 GtpVisibility::MeshInfoContainer *visibleGeometry, 33 GtpVisibility::PatchInfoContainer *visiblePatches, 34 bool relativeVisibility = false); 35 35 36 36 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2170 r2171 24 24 #include "IVReader.h" 25 25 #include "ObjReader.h" 26 26 #include "OgreOcclusionQueriesQueryManager.h" 27 27 28 28 … … 194 194 String val; 195 195 196 LogManager::getSingleton().logMessage("****** OcclusionCullingSceneManager Options ********"); 196 LogManager::getSingleton(). 197 logMessage("****** OcclusionCullingSceneManager Options ********"); 197 198 config.load(stream); 198 199 … … 717 718 // because shadows have low occlusion anyway 718 719 if ((mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 719 mIlluminationStage == IRS_RENDER_TO_TEXTURE) ||720 mIlluminationStage == IRS_RENDER_TO_TEXTURE) || 720 721 mNormalExecution) 721 722 { … … 772 773 { 773 774 // note matt: this is also called in TerrainSceneManager: really necessary? 774 mDestRenderSystem ->setLightingEnabled(false);775 mDestRenderSystem->setLightingEnabled(false); 775 776 776 777 if (mUseItemBuffer) … … 1077 1078 * static_cast<unsigned int *>(val) = (unsigned int)algorithm; 1078 1079 1079 getRenderQueue()->clear(true); 1080 1080 //getRenderQueue()->clear(); 1081 1082 return true; 1083 } 1084 if (key == "VisibleObjects") 1085 { 1086 if (mNormalExecution) 1087 return false; 1088 1089 const bool fromPoint = true; 1090 const bool nodeVisibility = true; 1091 1092 * static_cast<unsigned int *>(val) = 1093 (unsigned int)FindExactVisibleObjects(mCameraInProgress, 1094 mCurrentViewport, 1095 fromPoint, 1096 nodeVisibility); 1081 1097 return true; 1082 1098 } … … 1818 1834 } 1819 1835 //----------------------------------------------------------------------- 1820 void OcclusionCullingSceneManager::RenderDepthPass() 1821 { 1836 void OcclusionCullingSceneManager::RenderDepthPass(const bool fillRenderQueue) 1837 { 1838 if (mNormalExecution) 1839 { 1840 // not in the normal workflow 1841 return; 1842 } 1843 1822 1844 // create material for depth pass 1823 1845 InitDepthPass(); … … 1853 1875 mLeavePassesInQueue = 0; 1854 1876 1855 // the shaded geometry is rendered in a second pass 1856 // add visible nodes found by the visibility culling algorithm 1857 NodeList::const_iterator it, it_end = mVisible.end(); 1858 1859 if(1) 1860 for (it = mVisible.begin(); it != it_end; ++ it) 1861 { 1862 (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); 1877 if (fillRenderQueue) 1878 { 1879 // the shaded geometry is rendered in a second pass 1880 // add visible nodes found by the visibility culling algorithm 1881 NodeList::const_iterator it, it_end = mVisible.end(); 1882 for (it = mVisible.begin(); it != it_end; ++ it) 1883 { 1884 (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); 1885 } 1863 1886 } 1864 1887 } … … 1887 1910 1888 1911 //----------------------------------------------------------------------- 1889 void OcclusionCullingSceneManager::_renderScene(Camera* camera, Viewport* vp, bool includeOverlays) 1912 void OcclusionCullingSceneManager::_renderScene(Camera* camera, 1913 Viewport* vp, 1914 bool includeOverlays) 1890 1915 { 1891 1916 Root::getSingleton()._setCurrentSceneManager(this); … … 2057 2082 camera->_notifyRenderedFaces(mDestRenderSystem->_getFaceCount()); 2058 2083 } 2059 2084 //----------------------------------------------------------------------- 2085 int OcclusionCullingSceneManager::FindExactVisibleObjects(Camera *camera, 2086 Viewport* vp, 2087 const bool fromPoint, 2088 const bool nodeVisibility) 2089 { 2090 const int itemBufferMode = 0; 2091 const bool relativeVisibility = false; 2092 2093 int queryModes = 0; 2094 2095 if (nodeVisibility) 2096 queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY; 2097 else 2098 queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY; 2099 2100 OcclusionQueriesQueryManager *queryManager = 2101 new OcclusionQueriesQueryManager(mHierarchyInterface, 2102 vp, 2103 queryModes, 2104 itemBufferMode); 2105 2106 mVisibilityManager->SetQueryManager(queryManager); 2107 2108 GtpVisibility::NodeInfoContainer visibleNodes; 2109 GtpVisibility::MeshInfoContainer visibleGeometry; 2110 GtpVisibility::PatchInfoContainer visiblePatches; 2111 2112 if (fromPoint) 2113 { 2114 queryManager->ComputeFromPointVisibility(camera->getDerivedPosition(), 2115 &visibleNodes, 2116 &visibleGeometry, 2117 &visiblePatches, 2118 relativeVisibility); 2119 } 2120 else 2121 { 2122 queryManager->ComputeCameraVisibility(*camera, 2123 &visibleNodes, 2124 &visibleGeometry, 2125 &visiblePatches, 2126 relativeVisibility); 2127 } 2128 2129 if (0) 2130 { 2131 std::stringstream d; 2132 d << "Query mode: " << queryModes 2133 << " visible nodes: " << (int)visibleNodes.size() 2134 << " visible geometry: " << (int)visibleGeometry.size(); 2135 2136 LogManager::getSingleton().logMessage(d.str()); 2137 } 2138 2139 /////////////////////// 2140 //-- put items in render queue 2141 ////////// 2142 2143 getRenderQueue()->clear(); 2144 2145 ////////////////////// 2146 //-- apply queries on geometry level 2147 2148 if (!nodeVisibility) 2149 { 2150 GtpVisibility::MeshInfoContainer::iterator geomIt, geomIt_end = visibleGeometry.end(); 2151 2152 for (geomIt = visibleGeometry.begin(); geomIt != geomIt_end; ++geomIt) 2153 { 2154 MovableObject *mo = (*geomIt).GetSource(); 2155 2156 // add if not 0 2157 if (!(*geomIt).GetVisiblePixels()) 2158 continue; 2159 2160 mo->_notifyCurrentCamera(camera); 2161 2162 if (mo->isVisible()) 2163 { 2164 mo->_updateRenderQueue(getRenderQueue()); 2165 } 2166 } 2167 } 2168 else 2169 { 2170 //////////////// 2171 //-- apply queries on node level 2172 2173 GtpVisibility::NodeInfoContainer::iterator nodesIt, nodesIt_end = visibleNodes.end(); 2174 2175 for (nodesIt = visibleNodes.begin(); nodesIt != nodesIt_end; ++ nodesIt) 2176 { 2177 if (!(*nodesIt).GetVisiblePixels()) 2178 continue; 2179 2180 Octree *octree = static_cast<Octree *>((*nodesIt).GetSource()); 2181 2182 NodeList::iterator nIt, nIt_end = octree->mNodes.end(); 2183 2184 for (nIt = octree->mNodes.begin(); nIt != nIt_end; ++ nIt) 2185 { 2186 (*nIt)->_addToRenderQueue(camera, getRenderQueue(), false); 2187 } 2188 } 2189 } 2190 2191 delete queryManager; 2192 2193 if (nodeVisibility) 2194 return (int)visibleNodes.size(); 2195 else 2196 return (int)visibleGeometry.size(); 2197 } 2198 //----------------------------------------------------------------------- 2199 void OcclusionCullingSceneManager::RenderDepthForQuery(Camera* camera, 2200 Viewport* vp) 2201 { 2202 Root::getSingleton()._setCurrentSceneManager(this); 2203 mActiveQueuedRenderableVisitor->targetSceneMgr = this; 2204 2205 mCameraInProgress = camera; 2206 2207 // Update scene graph for this camera (can happen multiple times per frame) 2208 _updateSceneGraph(camera); 2209 2210 // Invert vertex winding? 2211 if (camera->isReflected()) 2212 { 2213 mDestRenderSystem->setInvertVertexWinding(true); 2214 } 2215 else 2216 { 2217 mDestRenderSystem->setInvertVertexWinding(false); 2218 } 2219 2220 // Tell params about viewport 2221 mAutoParamDataSource.setCurrentViewport(vp); 2222 // Set the viewport 2223 setViewport(vp); 2224 2225 // Tell params about camera 2226 mAutoParamDataSource.setCurrentCamera(camera); 2227 // Set autoparams for finite dir light extrusion 2228 mAutoParamDataSource.setShadowDirLightExtrusionDistance(mShadowDirLightExtrudeDist); 2229 2230 // Tell params about current ambient light 2231 mAutoParamDataSource.setAmbientLightColour(mAmbientLight); 2232 // Tell rendersystem 2233 mDestRenderSystem->setAmbientLight(mAmbientLight.r, mAmbientLight.g, mAmbientLight.b); 2234 2235 // Tell params about render target 2236 mAutoParamDataSource.setCurrentRenderTarget(vp->getTarget()); 2237 2238 2239 // Set camera window clipping planes (if any) 2240 if (mDestRenderSystem->getCapabilities()->hasCapability(RSC_USER_CLIP_PLANES)) 2241 { 2242 if (camera->isWindowSet()) 2243 { 2244 const std::vector<Plane>& planeList = 2245 camera->getWindowPlanes(); 2246 for (ushort i = 0; i < 4; ++i) 2247 { 2248 mDestRenderSystem->enableClipPlane(i, true); 2249 mDestRenderSystem->setClipPlane(i, planeList[i]); 2250 } 2251 } 2252 else 2253 { 2254 for (ushort i = 0; i < 4; ++i) 2255 { 2256 mDestRenderSystem->enableClipPlane(i, false); 2257 } 2258 } 2259 } 2260 2261 // Prepare render queue for receiving new objects 2262 prepareRenderQueue(); 2263 2264 // Begin the frame 2265 mDestRenderSystem->_beginFrame(); 2266 2267 // Set rasterisation mode 2268 mDestRenderSystem->_setPolygonMode(camera->getPolygonMode()); 2269 2270 // Set initial camera state 2271 mDestRenderSystem->_setProjectionMatrix(mCameraInProgress->getProjectionMatrixRS()); 2272 mDestRenderSystem->_setViewMatrix(mCameraInProgress->getViewMatrix(true)); 2273 2274 // // Render scene content in order fill depth buffer 2275 bool savedUseDepthPass = mUseDepthPass; 2276 mUseDepthPass = true; 2277 2278 // don't need shading, render only depth pass 2279 const bool fillQueue = false; 2280 RenderDepthPass(fillQueue); 2281 // _renderVisibleObjects(); 2282 2283 mUseDepthPass = savedUseDepthPass; 2284 2285 // End frame 2286 mDestRenderSystem->_endFrame(); 2287 } 2060 2288 //----------------------------------------------------------------------- 2061 2289 const String OcclusionCullingSceneManagerFactory::FACTORY_TYPE_NAME = "OcclusionCullingSceneManager"; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp
r2168 r2171 5 5 #include <OgreSubEntity.h> 6 6 #include "OgrePlatformHierarchyInterface.h" 7 #include "OgreOcclusionCullingSceneManager.h" 8 #include "VisibilityEnvironment.h" 9 10 7 11 8 12 namespace Ogre { … … 19 23 } 20 24 //----------------------------------------------------------------------- 21 void OcclusionQueriesQueryManager::ComputeCameraVisibility(const Camera &camera, 22 GtpVisibility::NodeInfoContainer *visibleNodes, 23 GtpVisibility::MeshInfoContainer *visibleGeometry, 24 GtpVisibility::PatchInfoContainer *visiblePatches, 25 bool relativeVisibility) 25 void OcclusionQueriesQueryManager::ComputeCameraVisibility( 26 const Camera &camera, 27 GtpVisibility::NodeInfoContainer *visibleNodes, 28 GtpVisibility::MeshInfoContainer *visibleGeometry, 29 GtpVisibility::PatchInfoContainer *visiblePatches, 30 bool relativeVisibility) 26 31 { 27 32 // we need access to the scene manager and the rendersystem 28 33 PlatformHierarchyInterface *pfHierarchyInterface = 29 //static_cast<PlatformHierarchyInterface *>(mHierarchyInterface);30 34 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 31 35 32 36 // disable overlays, reset them later 33 37 bool overlayEnabled = mViewport->getOverlaysEnabled(); 34 Ogre::LogManager::getSingleton().logMessage("here020202"); 38 35 39 /////////// 36 40 //-- render scene with item buffer (i.e., objects with their id as color codes) 37 //mItemBufferMode = 0; 38 if ((mItemBufferMode && mQueryModes) != 0) 41 42 //mItemBufferMode = 0; 43 if (0 && 44 (mItemBufferMode && mQueryModes) != 0) 39 45 { 40 46 int savedQueryModes = mQueryModes; 41 47 mQueryModes = mItemBufferMode; 42 48 43 PlatformQueryManager::ComputeCameraVisibility(camera, visibleNodes, 44 visibleGeometry, visiblePatches, relativeVisibility); 49 PlatformQueryManager::ComputeCameraVisibility(camera, 50 visibleNodes, 51 visibleGeometry, 52 visiblePatches, 53 relativeVisibility); 45 54 46 55 // overlays cause false visibility … … 54 63 mViewport->setOverlaysEnabled(false); 55 64 65 //////////////////////// 56 66 //-- Render scene to get conservative visibility and fill depth buffer 57 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 58 } 59 60 61 /* Two query lists for projected pixels and for visibile pixels: 67 68 OcclusionCullingSceneManager *occlusionSceneMgr = 69 static_cast<OcclusionCullingSceneManager *>(pfHierarchyInterface->GetSceneManager()); 70 71 // no visibility manager available => no visibility scene manager, return 72 GtpVisibility::VisibilityManager *visManager = NULL; 73 74 if (!occlusionSceneMgr->getOption("VisibilityManager", &visManager)) 75 { 76 Ogre::LogManager::getSingleton().logMessage("no vismanager found"); 77 return; 78 } 79 80 // use stop and wait culling for from view point queries because probably 81 // no temporal coherence 82 GtpVisibility::VisibilityEnvironment::CullingManagerType occlusionType = 83 visManager->GetCullingManagerType(); 84 85 visManager->SetCullingManager(GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING); 86 87 if (1) 88 occlusionSceneMgr->RenderDepthForQuery(pCam, mViewport); 89 else 90 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 91 92 visManager->SetCullingManager(occlusionType); 93 } 94 95 96 /* Two query lists for projected pixels and for visibile pixels: 62 97 We test queries after a rendering pass 63 98 to get exact visibility with regard to the current camera. … … 88 123 if (mQueryModes & GEOMETRY_VISIBILITY) 89 124 { 90 for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++ visNodesIt)125 for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++ visNodesIt) 91 126 { 92 127 mHierarchyInterface->GetNodeGeometryList(*visNodesIt, &geometryList, false); … … 128 163 int n = relativeVisibility ? 2 : 1; 129 164 if (mItemBufferMode > 0) 130 LogManager::getSingleton().logMessage(" item buffer");131 132 for (int i = 0; i < n; ++ i)165 LogManager::getSingleton().logMessage("using item buffer"); 166 167 for (int i = 0; i < n; ++ i) 133 168 { 134 169 //-- queries for hierarchy nodes … … 139 174 } 140 175 176 //////////////////////////// 141 177 //-- queries for geometry: if item buffer, capture only projected visibility 178 142 179 if ((mItemBufferMode != GEOMETRY_VISIBILITY) || (i == 1)) 143 180 { 144 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++ geometryIt)181 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++ geometryIt) 145 182 { 146 183 queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt)); … … 148 185 } 149 186 187 //////////////////////// 150 188 //-- queries for patches: if item buffer, capture only projected visibility 189 151 190 if ((mItemBufferMode != PATCH_VISIBILITY) || (i == 1)) 152 191 { … … 160 199 } 161 200 162 201 /////////////// 163 202 //-- collect results 203 164 204 GtpVisibility::QueryList::iterator visQueryIt = queryList[0].begin(); 165 205 GtpVisibility::QueryList::iterator projQueryIt = queryList[1].begin(); 166 206 167 207 // collect occlusion queries for hierarchy nodes 168 CollectNodeVisibility(visQueryIt, projQueryIt, &nodeList, visibleNodes, relativeVisibility); 208 CollectNodeVisibility(visQueryIt, 209 projQueryIt, 210 &nodeList, 211 visibleNodes, 212 relativeVisibility); 169 213 170 214 … … 174 218 // if visibility was established using the item buffer, 175 219 // the array is organized different (e.g., ordered by id, all possible objects) 176 CollectRelativeGeometryVisibilityForItemBuffer(projQueryIt, &geometryList, visibleGeometry); 220 CollectRelativeGeometryVisibilityForItemBuffer(projQueryIt, 221 &geometryList, 222 visibleGeometry); 177 223 } 178 224 else if (mItemBufferMode != GEOMETRY_VISIBILITY) 179 225 { 180 CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, visibleGeometry, 226 CollectGeometryVisibility(visQueryIt, 227 projQueryIt, 228 &geometryList, 229 visibleGeometry, 181 230 relativeVisibility); 182 231 } … … 186 235 if ((mItemBufferMode == PATCH_VISIBILITY) && relativeVisibility) 187 236 { 188 CollectRelativePatchVisibilityForItemBuffer(projQueryIt, &patchList, visiblePatches); 237 CollectRelativePatchVisibilityForItemBuffer(projQueryIt, 238 &patchList, 239 visiblePatches); 189 240 } 190 241 else if (mItemBufferMode != PATCH_VISIBILITY) 191 242 { 192 CollectPatchVisibility(visQueryIt, projQueryIt, &patchList, visiblePatches, relativeVisibility); 243 CollectPatchVisibility(visQueryIt, 244 projQueryIt, 245 &patchList, 246 visiblePatches, 247 relativeVisibility); 193 248 } 194 249 195 196 //-- reset options 250 //////////// 251 //-- reset state 252 197 253 enableDepthWrite = true; 198 254 // this option must be provided by the scene manager … … 204 260 } 205 261 //----------------------------------------------------------------------- 206 void OcclusionQueriesQueryManager::ComputeFromPointVisibility(const Vector3 &point, 207 GtpVisibility::NodeInfoContainer *visibleNodes, 208 GtpVisibility::MeshInfoContainer *visibleGeometry, 209 GtpVisibility::PatchInfoContainer *visiblePatches, 210 bool relativeVisibility) 211 {Ogre::LogManager::getSingleton().logMessage("here5"); 212 PlatformQueryManager::ComputeFromPointVisibility(point, visibleNodes, 213 visibleGeometry, visiblePatches, relativeVisibility); 262 void OcclusionQueriesQueryManager::ComputeFromPointVisibility( 263 const Vector3 &point, 264 GtpVisibility::NodeInfoContainer *visibleNodes, 265 GtpVisibility::MeshInfoContainer *visibleGeometry, 266 GtpVisibility::PatchInfoContainer *visiblePatches, 267 bool relativeVisibility) 268 { 269 PlatformQueryManager::ComputeFromPointVisibility(point, 270 visibleNodes, 271 visibleGeometry, 272 visiblePatches, 273 relativeVisibility); 214 274 215 275 // adds up their visibility and removes duplicates 216 276 // (duplicates occur if an object is on the edge of the viewport) 217 277 RemoveDuplicateNodes(visibleNodes); 218 Ogre::LogManager::getSingleton().logMessage("here6"); 278 219 279 if (mItemBufferMode != GEOMETRY_VISIBILITY) 220 280 { 221 281 RemoveDuplicateGeometry(visibleGeometry); 222 282 } 223 Ogre::LogManager::getSingleton().logMessage("here7"); 283 224 284 if (mItemBufferMode != PATCH_VISIBILITY) 225 285 { … … 228 288 } 229 289 //------------------------------------------------------------------------ 230 void 290 void OcclusionQueriesQueryManager::CollectNodeVisibility( 231 291 GtpVisibility::QueryList::iterator &visQueryIt, 232 292 GtpVisibility::QueryList::iterator &projQueryIt, … … 238 298 239 299 //-- queries for nodes 240 for (nodeIt = nodeList->begin(); nodeIt != nodeList->end(); ++ nodeIt)300 for (nodeIt = nodeList->begin(); nodeIt != nodeList->end(); ++ nodeIt) 241 301 { 242 302 unsigned int visiblePixels = 0; … … 248 308 { 249 309 (*projQueryIt)->GetQueryResult(projectedPixels, true); 250 251 ++projQueryIt; 252 } 253 254 ++visQueryIt; 310 ++ projQueryIt; 311 } 312 313 ++ visQueryIt; 255 314 256 315 // node with visibilty 0 in queue (e.g., if node is intersected by near plane) 257 316 if (visiblePixels > 0) 258 317 { 259 visibleNodes->push_back( GtpVisibility::NodeInfo(*nodeIt, visiblePixels,260 projectedPixels));318 visibleNodes->push_back( 319 GtpVisibility::NodeInfo(*nodeIt, visiblePixels, projectedPixels)); 261 320 } 262 321 } … … 384 443 GtpVisibility::NodeInfoContainer *visibleNodes) 385 444 { 386 s table_sort(visibleNodes->begin(), visibleNodes->end()/*, nodeinfo_lt*/);445 sort(visibleNodes->begin(), visibleNodes->end()); 387 446 388 447 GtpVisibility::NodeInfoContainer::iterator visibleNodesIt, … … 412 471 GtpVisibility::MeshInfoContainer *visibleGeometry) 413 472 { 414 s table_sort(visibleGeometry->begin(), visibleGeometry->end());473 sort(visibleGeometry->begin(), visibleGeometry->end()); 415 474 416 475 GtpVisibility::MeshInfoContainer::iterator visibleGeomIt, … … 440 499 GtpVisibility::PatchInfoContainer *visiblePatches) 441 500 { 442 s table_sort(visiblePatches->begin(), visiblePatches->end());501 sort(visiblePatches->begin(), visiblePatches->end()); 443 502 444 503 GtpVisibility::PatchInfoContainer::iterator visiblePatchIt, -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp
r2066 r2171 27 27 } 28 28 //----------------------------------------------------------------------- 29 void PlatformQueryManager::ComputeFromPointVisibility(const Vector3 &point, 30 GtpVisibility::NodeInfoContainer *visibleNodes, 31 GtpVisibility::MeshInfoContainer *visibleGeometry, 32 GtpVisibility::PatchInfoContainer *visiblePatches, 33 bool relativeVisibility) 34 { 35 SceneManager *sm = //static_cast<PlatformHierarchyInterface *> 29 void PlatformQueryManager::ComputeFromPointVisibility( 30 const Vector3 &point, 31 GtpVisibility::NodeInfoContainer *visibleNodes, 32 GtpVisibility::MeshInfoContainer *visibleGeometry, 33 GtpVisibility::PatchInfoContainer *visiblePatches, 34 bool relativeVisibility) 35 { 36 SceneManager *sm = 36 37 static_cast<PlatformHierarchyInterface *> 37 (mHierarchyInterface)->GetSceneManager();38 (mHierarchyInterface)->GetSceneManager(); 38 39 39 40 // create a camera for the point query … … 43 44 Camera *savedCam = mViewport->getCamera(); 44 45 45 // --- initialise new camera 46 47 ////////////// 48 //-- initialise new camera 49 46 50 mViewport->setCamera(cam); 47 51 cam->setPosition(point); … … 56 60 int sign = -1; 57 61 58 // ---- capture visibility from all 6 directions 62 /////////////// 63 //-- capture visibility from all 6 directions 64 59 65 for (int dir=0; dir < 6; dir++) 60 66 { … … 62 68 63 69 // Print camera details 64 std::stringstream d; 65 d << "Point query camera: " + StringConverter::toString(cam->getDerivedPosition()) + 66 " " + "O: " + StringConverter::toString(cam->getDerivedOrientation()); 67 LogManager::getSingleton().logMessage(d.str()); 70 if (0) 71 { 72 std::stringstream d; 73 d << "Point query camera: " + StringConverter::toString(cam->getDerivedPosition()) + 74 " " + "O: " + StringConverter::toString(cam->getDerivedOrientation()); 75 LogManager::getSingleton().logMessage(d.str()); 76 } 68 77 69 78 // prevent from initialising geometry / node array again … … 73 82 } 74 83 75 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, visiblePatches, 84 ComputeCameraVisibility(*cam, 85 visibleNodes, 86 visibleGeometry, 87 visiblePatches, 76 88 relativeVisibility); 77 89 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("wait"); … … 79 91 // permute directions 80 92 Vector3 direction(0,0,0); 81 direction[dir /2] = sign;93 direction[dir / 2] = sign; 82 94 83 95 cam->setDirection(direction); … … 88 100 } 89 101 //----------------------------------------------------------------------- 90 void PlatformQueryManager::ComputeCameraVisibility(const Camera &camera, 91 GtpVisibility::NodeInfoContainer *visibleNodes, 92 GtpVisibility::MeshInfoContainer *visibleGeometry, 93 GtpVisibility::PatchInfoContainer *visiblePatches, 94 bool relativeVisibility) 102 void PlatformQueryManager::ComputeCameraVisibility( 103 const Camera &camera, 104 GtpVisibility::NodeInfoContainer *visibleNodes, 105 GtpVisibility::MeshInfoContainer *visibleGeometry, 106 GtpVisibility::PatchInfoContainer *visiblePatches, 107 bool relativeVisibility) 95 108 { 96 109 // we need access to the scene manager and the rendersystem 97 110 PlatformHierarchyInterface *pfHierarchyInterface = 98 //static_cast<PlatformHierarchyInterface *>(mHierarchyInterface);99 111 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 100 112 … … 113 125 mViewport->setBackgroundColour(ColourValue(0, 0, 0, 0)); 114 126 //pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR | FBT_DEPTH); 127 115 128 #ifdef ITEM_BUFFER 116 129 // initialise item buffer (if not already initialised) 117 130 InitItemBuffer(visibleGeometry, visiblePatches); 118 131 132 ////////// 119 133 //-- render scene with item buffer (i.e., objects with their id as color codes) 120 134 … … 127 141 128 142 #ifdef ITEM_BUFFER 143 ///////// 129 144 //-- collect results 130 145 CollectItemBufferResults(visibleGeometry, visiblePatches); 131 146 132 // -- reset options133 147 ///////// 148 //-- reset state 134 149 useItemBuffer = false; // don't need item buffer anymore 135 150 sm->setOption("UseItemBuffer", &useItemBuffer); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp
r1486 r2171 16 16 { 17 17 // delete old queries (not needed for e.g., view frustum culling) 18 // note cannot be deleted because of new ogre occlusion query implementation 19 // there we cannot just delete the queries, so they would stay! 20 //mHierarchyInterface->ResetQueries(); 18 // note cannot be deleted because of new ogre occlusion query 19 // implementation there we cannot just delete the queries, so 20 // they would stay! 21 // mHierarchyInterface->ResetQueries(); 21 22 mVisibilityManager->SetCullingManager(*static_cast<const 22 23 GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val)); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2168 r2171 112 112 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;"..\..\lib\$(ConfigurationName)";"..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)";"..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\lib\$(ConfigurationName)"" 113 113 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 114 GenerateDebugInformation=" TRUE"114 GenerateDebugInformation="FALSE" 115 115 SubSystem="2" 116 116 OptimizeReferences="2" -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/DummyQueryManager.h
r316 r2171 6 6 7 7 namespace GtpVisibility { 8 8 9 /** This implements dummy visibility queries. The queries return only the root of the 9 10 hierarchy as visible node. 10 11 */ 11 12 13 12 class DummyQueryManager : public QueryManager 13 { 14 public: 14 15 /** Constructor taking a scene traverser for a specific type of hierarchyInterface 15 16 as argument. … … 21 22 @sa QueryManager::ComputeCameraVisibility() 22 23 */ 23 virtual void 24 ComputeCameraVisibility(const Camera &camera, 25 NodeInfoContainer *visibleNodes, 26 MeshInfoContainer *visibleGeometry, 27 PatchInfoContainer *visiblePatches, 28 bool relativeVisibility = false ); 24 virtual void ComputeCameraVisibility(const Camera &camera, 25 NodeInfoContainer *visibleNodes, 26 MeshInfoContainer *visibleGeometry, 27 PatchInfoContainer *visiblePatches, 28 bool relativeVisibility = false); 29 29 30 30 /** 31 31 @sa QueryManager::ComputeFromPointVisibility() 32 32 */ 33 virtual void 34 ComputeFromPointVisibility(const Vector3 &point, 35 NodeInfoContainer *visibleNodes, 36 MeshInfoContainer *visibleGeometry, 37 PatchInfoContainer *visiblePatches, 38 bool relativeVisibility = false 39 ); 40 41 }; 33 virtual void ComputeFromPointVisibility(const Vector3 &point, 34 NodeInfoContainer *visibleNodes, 35 MeshInfoContainer *visibleGeometry, 36 PatchInfoContainer *visiblePatches, 37 bool relativeVisibility = false); 38 }; 42 39 43 } ;40 } 44 41 #endif // VisibilitySummyQueryManager -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp
r1816 r2171 25 25 unsigned int visiblePixels = 0; 26 26 27 // Ogre::LogManager::getSingleton().logMessage("chc");27 ///////////// 28 28 //-- PART 1: process finished occlusion queries 29 29 30 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 30 31 { -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/StopAndWaitCullingManager.cpp
r925 r2171 13 13 14 14 // interesting for visualization purpose 15 mHierarchyInterface->SetNodeVisible(node, false); 16 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 15 if (mVisualizeCulledNodes) 16 { 17 mHierarchyInterface->SetNodeVisible(node, false); 18 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 19 } 17 20 18 21 bool intersects = false; … … 30 33 else if (intersects) 31 34 { 32 mHierarchyInterface->SetNodeVisible(node, true); 35 if (mVisualizeCulledNodes) 36 { 37 mHierarchyInterface->SetNodeVisible(node, true); 38 } 39 33 40 mHierarchyInterface->TraverseNode(node); 34 41 } … … 42 49 43 50 // node visible 44 if ( 0 ||visiblePixels > mVisibilityThreshold)51 if (visiblePixels > mVisibilityThreshold) 45 52 { 46 53 mHierarchyInterface->TraverseNode(node);
Note: See TracChangeset
for help on using the changeset viewer.