Changeset 150
- Timestamp:
- 06/27/05 17:22:08 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/VisibilityInfo.h
r145 r150 28 28 */ 29 29 void AddVisibility(const VisibilityInfo &info); 30 30 /** Adds visibility to current visibility information. 31 */ 32 void AddVisibility(const int visiblePixels, const int vrojectedPixels); 31 33 32 34 protected: 33 /** number of visible pixels. */ 35 /** number of visible pixels. 36 */ 34 37 int mVisiblePixels; 35 /** number of projected pixels */ 38 /** number of projected pixels 39 */ 36 40 int mProjectedPixels; 37 41 }; -
trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp
r145 r150 45 45 mProjectedPixels += info.GetProjectedPixels(); 46 46 } 47 //----------------------------------------------------------------------- 48 void VisibilityInfo::AddVisibility(const int visiblePixels, const int projectedPixels) 49 { 50 mVisiblePixels +=visiblePixels; 51 mProjectedPixels += projectedPixels; 52 } 53 47 54 /****************************************************/ 48 55 /* NodeInfo implementation */ 49 56 /****************************************************/ 57 58 50 59 //----------------------------------------------------------------------- 51 60 NodeInfo::NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels): -
trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj
r136 r150 192 192 Filter="h;hpp;hxx;hm;inl;inc"> 193 193 <File 194 RelativePath="..\include\OgreItemBufferQueryManager.h"> 195 </File> 196 <File 194 197 RelativePath="..\include\OgrePlatformHierarchyInterface.h"> 195 198 </File> … … 222 225 Name="Source Files" 223 226 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 227 <File 228 RelativePath="..\src\OgreItemBufferQueryManager.cpp"> 229 </File> 224 230 <File 225 231 RelativePath="..\src\OgrePlatformHierarchyInterface.cpp"> -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r145 r150 31 31 //-- Render scene to get conservative visibility and fill depth buffer 32 32 33 // c an do const_cast because Camera nochanged in renderScene33 // const_cast allowed because camera is not changed in renderScene 34 34 Camera *pCam = const_cast<Camera *>(&camera); 35 35 36 // disable overlays, reset them later 36 37 bool overlayEnabled = mViewport->getOverlaysEnabled(); 37 38 mViewport->setOverlaysEnabled(false); … … 39 40 40 41 /* 41 Two query lists: 42 We test two to get exact visibility with regard to the current camera and 43 issue all queries at once to avoid starvation & stalls. 42 Two query lists for projected pixels and for visibile pixels: 43 We test queries after a rendering pass 44 to get exact visibility with regard to the current camera. 45 We issue all queries at once to avoid starvation & stalls. 44 46 */ 45 47 GtpVisibility::QueryList queryList[2]; … … 100 102 // this option must be provided by the scene manager 101 103 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 102 104 // reset old overlay status 103 105 mViewport->setOverlaysEnabled(overlayEnabled); 104 106 105 107 //---- collect results 106 107 std::pair<InfoContainer<GtpVisibility::NodeInfo>::iterator, bool> insertNode;108 std::pair<InfoContainer<GtpVisibility::MeshInfo>::iterator, bool> insertGeom;109 110 108 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; 111 109 … … 236 234 mViewport->setCamera(savedCam); 237 235 238 // --- single out duplicates239 240 // before duplicates can be deleted we have to add up visibility236 // --- remove duplicates (happens if an object is on the edge of the viewport) 237 238 // before duplicates can be deleted we have to add up their visibility 241 239 242 240 // --- visible nodes … … 261 259 } 262 260 263 // nowdelete duplicates261 // really delete duplicates 264 262 visibleNodes->erase( std::unique(visibleNodes->begin(), 265 263 visibleNodes->end(), nodeinfo_eq), visibleNodes->end()); … … 286 284 } 287 285 288 // nowdelete duplicates286 // really delete duplicates 289 287 visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), 290 288 meshinfo_eq), visibleGeometry->end()); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r149 r150 78 78 mItemBufferPass->setDepthWriteEnabled(true); 79 79 mItemBufferPass->setLightingEnabled(true); 80 //mItemBufferPass->setLightingEnabled(false); 80 81 } 81 82 else … … 83 84 mItemBufferPass = itemBufferMat->getTechnique(0)->getPass(0); 84 85 } 85 mItemBufferPass->setAmbient(1, 1, 0);86 //mItemBufferPass->setAmbient(1, 1, 0); 86 87 } 87 88 //----------------------------------------------------------------------- … … 213 214 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 214 215 { 215 // needs full ambient lighting for item colors to be exact216 //if (mRenderItemBuffer) {setAmbientLight(ColourValue(1,1,1,1));}217 218 216 //-- show visible scene nodes and octree bounding boxes from last frame 219 217 if (mShowVisualization) … … 244 242 void VisibilityTerrainSceneManager::_renderVisibleObjects() 245 243 { 244 ColourValue savedAmbient = mAmbientLight; 245 246 246 // visualization or shadow pass: apply standard rendering 247 247 if (mShowVisualization || (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && … … 305 305 mLeavePassesInQueue = 0; 306 306 mShadowTechnique = mSavedShadowTechnique; 307 307 mRenderItemBuffer = false; 308 308 309 309 // add visible nodes found by the visibility culling algorithm … … 327 327 328 328 getRenderQueue()->clear(); 329 330 // reset ambient light 331 setAmbientLight(savedAmbient); 329 332 //WriteLog(); // write out stats 330 333 } … … 399 402 { 400 403 mEnableDepthWrite = (*static_cast<const bool *>(val)); 404 return true; 405 } 406 if (key == "ItemBuffer") 407 { 408 mRenderItemBuffer = (*static_cast<const bool *>(val)); 401 409 return true; 402 410 } … … 531 539 532 540 // ----- TRANSPARENT LOOP: must be handled differently 533 // although we don't really care about transparents for the item buffer534 541 // TODO: HOW TO HANDLE OCCLUDED OBJECTS ???? 535 542 RenderPriorityGroup::TransparentRenderablePassList … … 551 558 { 552 559 static LightList nullLightList; 553 554 Real col = (Real)rend->getId() / (Real)mCurrentEntityId; 555 556 mItemBufferPass->setAmbient(ColourValue(0, col, 0)); 557 //mItemBufferPass->setDiffuse(ColourValue(0, col, 0)); 558 //mItemBufferPass->setSpecular(ColourValue(0, col, 0)); 560 561 int col[4]; 562 563 col[0] = (rend->getId() >> 16) & 255; 564 col[1] = (rend->getId() >> 8) & 255; 565 col[2] = rend->getId() & 255; 566 col[3] = 255; 567 568 //mDestRenderSystem->setColour(col[0], col[1], col[2], col[3]); 559 569 570 mItemBufferPass->setAmbient(ColourValue(col[0] / 255.0f, 571 col[1] / 255.0f, 572 col[2] / 255.0f, 1)); 573 560 574 // set vertex program of current pass 561 575 if (pass->hasVertexProgram()) … … 581 595 //Pass *usedPass = setPass(pass); 582 596 583 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col; 584 LogManager::getSingleton().logMessage(d.str()); 597 if (rend->getId() > 0) 598 { 599 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] << 600 " " << col[1] << " " << col[2] << " " << col[3]; 601 LogManager::getSingleton().logMessage(d.str()); 602 } 585 603 586 604 // Render a single object, this will set up auto params if required 587 605 renderSingleObject(rend, usedPass, false, &nullLightList); 606 607 // reset colour 608 //mDestRenderSystem->setColour(255, 255, 255, 255); 588 609 } 589 610 //----------------------------------------------------------------------- … … 600 621 for (int i = 0; i < (int)ent->getNumSubEntities(); ++i) 601 622 { 602 ent->getSubEntity(i)->setId(mCurrentEntityId ++); 603 } 623 ent->getSubEntity(i)->setId(mCurrentEntityId); 624 } 625 626 ++ mCurrentEntityId; 604 627 605 628 return ent; … … 615 638 616 639 640 mLeavePassesInQueue = 0; 641 642 // item buffer needs full ambient lighting to use item colors as unique id 643 if (mUseItemBuffer) 644 { 645 mRenderItemBuffer = true; 646 setAmbientLight(ColourValue(1,1,1,1)); 647 } 648 649 617 650 // set passes which should be stored in render queue 618 651 // for rendering after hierarchical culling 619 mLeavePassesInQueue = 0; 620 652 621 653 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 622 654 { … … 662 694 663 695 // set depth pass flag before rendering 664 mRenderDepthPass = mUseDepthPass; 665 696 mRenderDepthPass = mUseDepthPass; 666 697 // set flag for skipping transparents in the hierarchical culling pass 667 698 mSkipTransparents = mUseDepthPass || -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r145 r150 162 162 163 163 // the objects are generated on the whole terrain 164 mTerrainContentGenerator->GenerateScene(1500, "robot");165 //mTerrainContentGenerator->GenerateScene(1500, "athene");164 //mTerrainContentGenerator->GenerateScene(1500, "robot"); 165 mTerrainContentGenerator->GenerateScene(1500, "athene"); 166 166 //mTerrainContentGenerator->GenerateScene(500, "ninja"); 167 167 } -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp
r115 r150 2246 2246 glDisableVertexAttribArrayARB_ptr(1); // disable weights 2247 2247 } 2248 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 2248 2249 glColor4f(1,1,1,1); 2250 #else 2251 glColor4ub(mColour[0], mColour[1], mColour[2], mColour[3]); 2252 #endif // GTP_VISIBILITY_MODIFIED_OGRE 2253 2249 2254 glSecondaryColor3fEXT_ptr(0.0f, 0.0f, 0.0f); 2250 2255 … … 2446 2451 dest[3][2] = -1; 2447 2452 } 2448 2449 2453 // ------------------------------------------------------------------ 2450 2454 void GLRenderSystem::setClipPlane (ushort index, Real A, Real B, Real C, Real D)
Note: See TracChangeset
for help on using the changeset viewer.