Changeset 129 for trunk/VUT/Ogre/src
- Timestamp:
- 06/10/05 17:28:14 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r122 r129 77 77 mItemBufferPass = itemBufferMat->getTechnique(0)->getPass(0); 78 78 } 79 mItemBufferPass->setAmbient( 0, 0, 0);79 mItemBufferPass->setAmbient(1, 1, 0); 80 80 } 81 81 //----------------------------------------------------------------------- … … 221 221 void VisibilityTerrainSceneManager::_renderVisibleObjects() 222 222 { 223 std::stringstream d; 223 /* 224 std::stringstream d; 224 225 d << "Terrain render level: " << TerrainRenderable::getCurrentRenderLevelIndex(); 225 226 LogManager::getSingleton().logMessage(d.str()); … … 232 233 renderLevel = 0; 233 234 } 234 235 */ 235 236 // visualization: apply standard rendering 236 237 if (mShowVisualization) 237 238 { 238 239 TerrainSceneManager::_renderVisibleObjects(); 239 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel);240 // TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 240 241 return; 241 242 } … … 308 309 TerrainSceneManager::_renderVisibleObjects(); 309 310 310 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel);311 //TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 311 312 //WriteLog(); // write out stats 312 313 } … … 373 374 // notifiy that frame has ended so terrain render level can be reset for correct 374 375 // terrain rendering 375 if (key == "TerrainLevelIdx")376 /* if (key == "TerrainLevelIdx") 376 377 { 377 378 TerrainRenderable::setCurrentRenderLevelIndex((*static_cast<const int *>(val))); 378 } 379 return true; 380 }*/ 379 381 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 380 382 setOption(key, val) || TerrainSceneManager::setOption(key, val); … … 496 498 for (irend = rendList->begin(); irend != irendend; ++irend) 497 499 { 498 RenderSingleObjectForItemBuffer(*irend); 499 } 500 } 501 502 // ----- TRANSPARENT LOOP 500 std::stringstream d; d << "itembuffer, pass name: " << 501 ipass->first->getParent()->getParent()->getName(); 502 //<< ", renderable name: " << irend-> 503 504 LogManager::getSingleton().logMessage(d.str()); 505 506 //if(ipass->first->getParent()->getParent()->getName() == "Examples/Athene") 507 //<< ", renderable name: " << irend-> 508 RenderSingleObjectForItemBuffer(*irend, ipass->first); 509 RenderSingleObjectForOcclusionQuery( 510 } 511 } 512 513 // ----- TRANSPARENT LOOP: must be handlet differently altough we don't really 514 // care about transparents for the item buffer 515 // TODO: HOW TO HANDLE OCCLUDED OBJECTS ???? 503 516 RenderPriorityGroup::TransparentRenderablePassList 504 517 transpObjs = pGroup->_getTransparentPasses(); … … 508 521 for (itrans = transpObjs.begin(); itrans != itransend; ++itrans) 509 522 { 510 // Render only first pass523 // like for solids, render only first pass 511 524 if (itrans->pass->getIndex() == 0) 512 { 513 RenderSingleObjectForItemBuffer(itrans->renderable );525 { 526 RenderSingleObjectForItemBuffer(itrans->renderable, itrans->pass); 514 527 } 515 528 } 516 529 } 517 530 //----------------------------------------------------------------------- 518 void VisibilityTerrainSceneManager::RenderSingleObjectForItemBuffer(Renderable *rend )531 void VisibilityTerrainSceneManager::RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass) 519 532 { 520 533 static LightList nullLightList; 534 521 535 Real col = (Real)rend->getId() / (Real)mCurrentEntityId; 522 mItemBufferPass->setAmbient(col, 0, 0); 523 524 setPass(mItemBufferPass); 525 536 537 mItemBufferPass->setAmbient(ColourValue(0, 1, 1)); 538 //mItemBufferPass->setDiffuse(ColourValue(0, col, 0)); 539 // mItemBufferPass->setSpecular(ColourValue(0, col, 0)); 540 // mItemBufferPass->_load(); 541 542 // set vertex program of current pass 543 if (pass->hasVertexProgram()) 544 { 545 mItemBufferPass->setVertexProgram(pass->getVertexProgramName()); 546 547 if (mItemBufferPass->hasVertexProgram()) 548 { 549 const GpuProgramPtr& prg = mItemBufferPass->getVertexProgram(); 550 // Load this program if not done already 551 if (!prg->isLoaded()) 552 prg->load(); 553 // Copy params 554 mItemBufferPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 555 } 556 } 557 else if (mItemBufferPass->hasVertexProgram()) 558 { 559 mItemBufferPass->setVertexProgram(""); 560 } 561 562 //LogManager::getSingleton().logMessage("has vertex program"); 563 Pass *usedPass = setPass(mItemBufferPass); 564 //Pass *usedPass = setPass(pass); 526 565 std::stringstream d; 527 566 d << "item buffer id: " << rend->getId() << ", col: " << col; 528 567 LogManager::getSingleton().logMessage(d.str()); 568 529 569 // Render a single object, this will set up auto params if required 530 renderSingleObject(rend, mItemBufferPass, true, &nullLightList);570 renderSingleObject(rend, usedPass, false, &nullLightList); 531 571 } 532 572 //-----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.