Changeset 144
- Timestamp:
- 06/22/05 00:38:49 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/DummyQueryManager.h
r143 r144 25 25 InfoContainer<NodeInfo> *visibleNodes, 26 26 InfoContainer<MeshInfo> *visibleGeometry, 27 bool projectedPixels = false 28 ); 27 bool relativeVisibility = false ); 29 28 30 29 /** … … 35 34 InfoContainer<NodeInfo> *visibleNodes, 36 35 InfoContainer<MeshInfo> *visibleGeometry, 37 bool projectedPixels= false36 bool relativeVisibility = false 38 37 ); 39 38 -
trunk/VUT/GtpVisibility/include/QueryManager.h
r143 r144 51 51 InfoContainer<NodeInfo> *visibleNodes, 52 52 InfoContainer<MeshInfo> *visibleGeometry, 53 bool projectedPixels= false53 bool relativeVisibility = false 54 54 ) = 0; 55 55 … … 62 62 InfoContainer<NodeInfo> *visibleNodes, 63 63 InfoContainer<MeshInfo> *visibleGeometry, 64 bool projectedPixels= false64 bool relativeVisibility = false 65 65 ) = 0; 66 66 -
trunk/VUT/GtpVisibility/include/VisibilityInfo.h
r143 r144 27 27 HierarchyNode *GetNode() const {return mNode;} 28 28 29 float ComputeRelativeVisibility() { float result = mVisiblePixels; if (mProjectedPixels) result /= (float)mProjectedPixels; return result;} 29 30 //bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;} 30 31 -
trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj
r136 r144 133 133 </File> 134 134 <File 135 RelativePath="..\src\VisibilityInfo.cpp"> 136 </File> 137 <File 135 138 RelativePath="..\src\VisibilityManager.cpp"> 136 139 </File> -
trunk/VUT/GtpVisibility/src/DummyQueryManager.cpp
r143 r144 11 11 InfoContainer<NodeInfo> *visibleNodes, 12 12 InfoContainer<MeshInfo> *visibleGeometry, 13 bool projectedPixels 14 ) 13 bool relativeVisibility) 15 14 { 16 15 visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetSceneRoot(), 0, 0)); … … 30 29 InfoContainer<NodeInfo> *visibleNodes, 31 30 InfoContainer<MeshInfo> *visibleGeometry, 32 bool projectedPixels 33 ) 31 bool relativeVisibility) 34 32 { 35 33 visibleNodes->push_back(NodeInfo(mHierarchyInterface->GetSceneRoot(), 0, 0)); -
trunk/VUT/Ogre/include/OgrePlatformQueryManager.h
r143 r144 41 41 InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 42 42 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 43 bool projectedPixels= false43 bool relativeVisibility = false 44 44 ); 45 45 … … 52 52 InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 53 53 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 54 bool projectedPixels= false54 bool relativeVisibility = false 55 55 ); 56 56 … … 73 73 ); 74 74 75 /** Sets a viewport to render into.75 /** Sets a viewport for rendering. 76 76 */ 77 77 void SetViewport(Viewport *vp); -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r143 r144 23 23 InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 24 24 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 25 bool projectedPixels)25 bool relativeVisibility) 26 26 { 27 27 // we need access to the scene manager and the rendersystem … … 68 68 */ 69 69 // for relative visibility we need 2 rendering passes 70 int n = projectedPixels? 2 : 1;70 int n = relativeVisibility ? 2 : 1; 71 71 72 72 for (int i=0; i<n; ++i) … … 104 104 105 105 //---- collect results 106 unsigned int visiblePixels = 0;106 107 107 std::pair<InfoContainer<GtpVisibility::NodeInfo>::iterator, bool> insertNode; 108 108 std::pair<InfoContainer<GtpVisibility::MeshInfo>::iterator, bool> insertGeom; … … 116 116 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 117 117 { 118 unsigned int visiblePixels = 0; 118 119 (*visQueryIt)->GetQueryResult(visiblePixels, true); 119 120 120 int visiblePixels = visiblePixels; 121 int projectedPixels = 0; 122 123 if (projectedPixels) 124 { 125 (*projQueryIt)->GetQueryResult(visiblePixels, true); 126 127 mProjectedPixels = visiblePixels; 121 unsigned int projectedPixels = 0; 122 123 if (relativeVisibility) 124 { 125 (*projQueryIt)->GetQueryResult(projectedPixels, true); 128 126 129 127 ++projQueryIt; … … 145 143 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 146 144 { 145 unsigned int visiblePixels = 0; 147 146 (*visQueryIt)->GetQueryResult(visiblePixels, true); 148 147 149 int visiblePixels = visiblePixels; 150 int projectedPixels = 0; 151 152 if (projectedPixels) 153 { 154 (*projQueryIt)->GetQueryResult(visiblePixels, true); 155 156 mProjectedPixels = visiblePixels; 148 unsigned int projectedPixels = 0; 149 150 if (relativeVisibility) 151 { 152 (*projQueryIt)->GetQueryResult(projectedPixels, true); 157 153 158 154 ++projQueryIt; … … 163 159 // approximate depth ordering during rendering => 164 160 // geometry maybe occluded 165 if ( isVisible)161 if (visiblePixels > 0) 166 162 { 167 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt,visiblePixels, projectedPixels)); 163 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, 164 visiblePixels, projectedPixels)); 168 165 } 169 166 } … … 181 178 } 182 179 //----------------------------------------------------------------------- 180 inline bool nodeinfo_lower(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2) 181 { 182 return info1.GetNode() < info2.GetNode(); 183 } 184 //----------------------------------------------------------------------- 185 inline bool meshinfo_lower(const GtpVisibility::MeshInfo &info1, const GtpVisibility::MeshInfo &info2) 186 { 187 return info1.GetMesh() < info2.GetMesh(); 188 } 189 //----------------------------------------------------------------------- 183 190 void PlatformQueryManager::ComputeFromPointVisibility(const Vector3 &point, 184 191 InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 185 192 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 186 bool projectedPixels)193 bool relativeVisibility) 187 194 { 188 195 SceneManager *sm = dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); … … 221 228 LogManager::getSingleton().logMessage(d.str()); 222 229 223 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, projectedPixels);230 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 224 231 225 232 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("HAAHHAHAHAHAH"); … … 240 247 241 248 // --- visible nodes 242 sort(visibleNodes->begin(), visibleNodes->end() );249 sort(visibleNodes->begin(), visibleNodes->end(), nodeinfo_lower); 243 250 InfoContainer<GtpVisibility::NodeInfo>::iterator visibleNodesIt, 244 251 visibleNodesIt_end = visibleNodes->end(); … … 256 263 { 257 264 // add visibility 258 nodeInfo->SetVisib ility(nodeInfo->GetVisiblePixels() +265 nodeInfo->SetVisiblePixels(nodeInfo->GetVisiblePixels() + 259 266 (*visibleNodesIt).GetVisiblePixels()); 267 268 nodeInfo->SetProjectedPixels(nodeInfo->GetProjectedPixels() + 269 (*visibleNodesIt).GetProjectedPixels()); 260 270 } 261 271 … … 267 277 268 278 // --- visible geometry 269 sort(visibleGeometry->begin(), visibleGeometry->end() );279 sort(visibleGeometry->begin(), visibleGeometry->end(), meshinfo_lower); 270 280 InfoContainer<GtpVisibility::MeshInfo>::iterator visibleGeomIt, 271 281 visibleGeomIt_end = visibleGeometry->end(); … … 283 293 { 284 294 // add visibility 285 geomInfo->SetVisib ility(geomInfo->GetVisiblePixels() +295 geomInfo->SetVisiblePixels(geomInfo->GetVisiblePixels() + 286 296 (*visibleGeomIt).GetVisiblePixels()); 297 298 geomInfo->SetProjectedPixels(nodeInfo->GetProjectedPixels() + 299 (*visibleNodesIt).GetProjectedPixels()); 287 300 } 288 301 } 289 302 290 303 // now delete duplicates 291 visibleGeometry->erase(std::unique(visibleGeometry->begin(), 292 visibleGeometry->end(),meshinfo_eq), visibleGeometry->end());304 visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), 305 meshinfo_eq), visibleGeometry->end()); 293 306 294 307 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r143 r144 353 353 } 354 354 //----------------------------------------------------------------------- 355 void TerrainFrameListener::ApplyVisibilityQuery(bool fromPoint, bool projectedPixels)355 void TerrainFrameListener::ApplyVisibilityQuery(bool fromPoint, bool relativeVisibility) 356 356 { 357 357 InfoContainer<GtpVisibility::NodeInfo> visibleNodes; … … 362 362 mVisibilityManager->GetQueryManager()-> 363 363 ComputeFromPointVisibility(mCamNode->getPosition(), &visibleNodes, 364 &visibleGeometry, projectedPixels);364 &visibleGeometry, relativeVisibility); 365 365 } 366 366 else 367 367 { 368 368 mVisibilityManager->GetQueryManager()->ComputeCameraVisibility(*mCamera, 369 &visibleNodes, &visibleGeometry, projectedPixels);369 &visibleNodes, &visibleGeometry, relativeVisibility); 370 370 } 371 371 … … 405 405 //-- visibility queries stats 406 406 int idx = fromPoint ? 1 : 0; 407 idx += projectedPixels? 2 : 0;407 idx += relativeVisibility ? 2 : 0; 408 408 409 409 sprintf(str, ": %s", queryTypeCaptions[idx].c_str()); -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r143 r144 120 120 visible pixels / projected pixels. 121 121 */ 122 void ApplyVisibilityQuery(bool fromPoint, bool projectedPixels);122 void ApplyVisibilityQuery(bool fromPoint, bool relativeVisibility); 123 123 124 124 void toggleShowQueryStats(); -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r139 r144 71 71 bool result = ExampleApplication::setup(); 72 72 73 createRenderTargetListener(); 73 if (mWindow) 74 createRenderTargetListener(); 74 75 75 76 return result;
Note: See TracChangeset
for help on using the changeset viewer.