Changeset 173 for trunk/VUT/Ogre/src
- Timestamp:
- 07/13/05 18:28:40 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp
r171 r173 22 22 } 23 23 //----------------------------------------------------------------------- 24 inline bool patchinfo_eq(const GtpVisibility::PatchInfo &info1, const GtpVisibility::PatchInfo &info2) 25 { 26 return info1.GetPatch() == info2.GetPatch(); 27 } 28 //----------------------------------------------------------------------- 24 29 inline bool nodeinfo_lower(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2) 25 30 { … … 31 36 return info1.GetMesh() < info2.GetMesh(); 32 37 } 33 38 //----------------------------------------------------------------------- 39 inline bool patchinfo_lower(const GtpVisibility::PatchInfo &info1, const GtpVisibility::PatchInfo &info2) 40 { 41 return info1.GetPatch() < info2.GetPatch(); 42 } 34 43 35 44 … … 100 109 GtpVisibility::GeometryList::iterator geometryIt, geometryIt_end = geometryList.end(); 101 110 111 // vector for storing subentities of meshes 112 GtpVisibility::PatchList patchList; 113 GtpVisibility::PatchList::iterator patchIt, patchIt_end = patchList.end(); 102 114 103 115 // to obtain the correct number of projected pixels, depth write must be disabled … … 128 140 129 141 //-- queries for geometry: if item buffer, capture only projected visibility 142 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 143 { 144 queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*geometryIt)); 145 } 146 147 //-- queries for patches: if item buffer, capture only projected visibility 130 148 if (!(mUseItemBuffer && (i == 0))) 131 149 { 132 for ( geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt)150 for (patchIt = patchList.begin(); patchIt != patchIt_end; ++patchIt) 133 151 { 134 queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(* geometryIt));152 queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*patchIt)); 135 153 } 136 154 } … … 150 168 if (relativeVisibility) 151 169 { 152 CollectRelative GeometryVisibilityForItemBuffer(projQueryIt, &geometryList, visibleGeometry);170 CollectRelativePatchVisibilityForItemBuffer(projQueryIt, &patchList, visiblePatches); 153 171 } 154 172 } 155 173 else 156 174 { 157 CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, 158 visibleGeometry, relativeVisibility); 159 //CollectPatchVisibility(patchList, visiblePatches); 160 } 161 162 175 CollectPatchVisibility(visQueryIt, projQueryIt, &patchList, visiblePatches, relativeVisibility); 176 } 177 178 CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, visibleGeometry, relativeVisibility); 179 163 180 //-- reset options 164 181 enableDepthWrite = true; … … 397 414 meshinfo_eq), visibleGeometry->end()); 398 415 } 399 416 //----------------------------------------------------------------------- 417 void OcclusionQueriesQueryManager::RemoveDuplicatePatches( 418 InfoContainer<GtpVisibility::PatchInfo> *visiblePatches) 419 { 420 sort(visiblePatches->begin(), visiblePatches->end(), patchinfo_lower); 421 422 InfoContainer<GtpVisibility::PatchInfo>::iterator visiblePatchIt, 423 visiblePatchIt_end = visiblePatches->end(); 424 425 GtpVisibility::PatchInfo *patchInfo = NULL; 426 427 for (visiblePatchIt = visiblePatches->begin(); visiblePatchIt != visiblePatchIt_end; 428 ++visiblePatchIt) 429 { 430 if (!patchInfo || (patchInfo->GetPatch() != (*visiblePatchIt).GetPatch())) 431 { 432 patchInfo = &(*visiblePatchIt); 433 } 434 else // info points to same mesh, just add visibility 435 { 436 patchInfo->AddVisibility(*visiblePatchIt); 437 } 438 } 439 440 // physically delete duplicates 441 visiblePatches->erase(std::unique(visiblePatches->begin(), visiblePatches->end(), 442 patchinfo_eq), visiblePatches->end()); 443 } 400 444 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r171 r173 16 16 mViewport(vp), 17 17 mWasInitialised(false), 18 mRenderPatches( false)18 mRenderPatches(renderPatches) 19 19 { 20 20 } … … 125 125 126 126 //-- collect results 127 127 CollectItemBufferResults(visibleGeometry, visiblePatches); 128 129 //-- reset options 130 131 useItemBuffer = false; // don't need item buffer anymore 132 sm->setOption("UseItemBuffer", &useItemBuffer); 133 134 mWasInitialised = false; // reset initialised - flag 135 mViewport->setOverlaysEnabled(overlayEnabled); // reset old overlay status 136 mViewport->setBackgroundColour(bg); // reset background color 137 } 138 //----------------------------------------------------------------------- 139 void PlatformQueryManager::CollectItemBufferResults( 140 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 141 InfoContainer<GtpVisibility::PatchInfo> *visiblePatches) 142 { 128 143 int dimx = 0; 129 144 int dimy = 0; … … 151 166 { 152 167 if (mRenderPatches) 153 { 168 { 154 169 ((*visiblePatches)[id]).AddVisibility(1, 0); 155 170 } … … 161 176 } 162 177 163 164 //-- reset options 165 166 useItemBuffer = false; // don't need item buffer anymore 167 sm->setOption("UseItemBuffer", &useItemBuffer); 168 169 mWasInitialised = false; // reset initialised - flag 170 mViewport->setOverlaysEnabled(overlayEnabled); // reset old overlay status 171 mViewport->setBackgroundColour(bg); // reset background color 172 173 delete [] buf; // delete copy of the frame buffer 174 } 178 delete [] buf; 179 } 180 175 181 //----------------------------------------------------------------------- 176 182 void PlatformQueryManager::InitItemBuffer( … … 215 221 subEnt->setId(id); 216 222 //subEnt->setId((41 << 16) + (4 << 8) + 60); 217 //subEnt->setId((2 << 16) + (4 << 8) + 60);218 223 } 219 224
Note: See TracChangeset
for help on using the changeset viewer.