Changeset 156 for trunk/VUT/Ogre/src
- Timestamp:
- 07/06/05 02:36:16 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp
r155 r156 32 32 SceneManager *sm = pfHierarchyInterface->GetSceneManager(); 33 33 34 // ---- Render scene asitem buffer (i.e., objects with their id as color codes)34 // ---- Render scene with item buffer (i.e., objects with their id as color codes) 35 35 36 36 // const_cast allowed because camera is not changed in renderScene … … 52 52 // --- render item buffer 53 53 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 54 55 56 57 // reset old overlay status58 mViewport->setOverlaysEnabled(overlayEnabled);59 60 mViewport->setBackgroundColour(bg);61 62 // don't need item buffer anymore63 useItemBuffer = false;64 sm->setOption("UseItemBuffer", &useItemBuffer);65 54 66 55 … … 88 77 } 89 78 79 delete [] buf; 80 81 // ---- render visible nodes and collect node visibility 82 bool renderBoxes = true; 83 sm->setOption("RenderHierarchyNodes", &renderBoxes); 84 85 86 // --- render item buffer for visible nodes only 87 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 88 89 90 // get frame buffer for node visibility 91 buf = mViewport->getTarget()->getBufferContents(dimx, dimy); 92 93 94 // loop through frame buffer & collect visible pixels 95 for (int idx = 0; idx < dimy * dimx * 3; idx += 3) 96 { 97 // -- decode color code to receive id 98 int id = buf[idx] << 16; 99 id += buf[idx + 1] << 8; 100 id += buf[idx + 2]; 101 102 // if valid id <= add visibility (id values start at 1 103 if ((id > 0) && (id < (int)visibleNodes->size())) 104 { 105 ((*visibleNodes)[id]).AddVisibility(1, 1); 106 } 107 } 108 109 // don't need item buffer anymore 110 useItemBuffer = false; 111 //sm->setOption("UseItemBuffer", &useItemBuffer); 112 113 renderBoxes = false; 114 //sm->setOption("RenderHierarchyNodes", &renderBoxes); 115 90 116 // reset initialised - flag 91 117 mWasInitialised = false; 118 119 // reset old overlay status 120 mViewport->setOverlaysEnabled(overlayEnabled); 121 122 mViewport->setBackgroundColour(bg); 92 123 93 124 delete [] buf; … … 99 130 if (mWasInitialised) 100 131 return; 101 102 132 103 133 mWasInitialised = true; … … 122 152 GtpVisibility::HierarchyNode *node = NULL; 123 153 154 int i = 1; 155 124 156 while (node = mHierarchyInterface->GetNextNode()) 125 157 { 158 mHierarchyInterface->SetNodeId(node, i++); 126 159 visibleNodes->push_back(GtpVisibility::NodeInfo(node, 0, 0)); 127 160 } -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r154 r156 57 57 // prevent from initialising geometry / node array again 58 58 if (i > 0) 59 { 59 60 mWasInitialised = true; 61 } 60 62 61 63 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 62 64 63 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("wait");65 mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("wait"); 64 66 65 67 // permute directions -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r155 r156 41 41 if (depthMat.isNull()) 42 42 { 43 // Init44 43 depthMat = MaterialManager::getSingleton().create( 45 44 "Visibility/DepthPass", -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r155 r156 9 9 #include <OgreEntity.h> 10 10 #include <OgreSubEntity.h> 11 11 12 12 13 namespace Ogre { … … 31 32 mSkipTransparents(false), 32 33 mSavedShadowTechnique(SHADOWTYPE_NONE), 33 mRenderOnlyBoundingBoxes(false) 34 mRenderHierarchyNodes(false) 35 //mRenderHierarchyNodes(true) 34 36 { 35 37 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); … … 147 149 //Pass *usedPass = ((mRenderDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 148 150 149 // set depth fill pass only if depth write enabled151 // set depth fill pass if we currently do not make an aabb occlusion query 150 152 Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ? 151 153 mDepthPass : pass); … … 208 210 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 209 211 { 212 // clear list of solid boxes (used for item buffer hierarchy node rendering) 213 /*for (int i=0; i<(int)mSolidBoxes.size(); ++i) 214 delete mSolidBoxes[i]; 215 216 mSolidBoxes.clear();*/ 217 210 218 //-- show visible scene nodes and octree bounding boxes from last frame 211 219 if (mShowVisualization) … … 213 221 PrepareVisualization(cam); 214 222 } 215 else if (mRenderOnlyBoundingBoxes) 216 { 223 else if (mRenderHierarchyNodes) 224 { 225 AxisAlignedBox aab; 226 227 228 // get rendered hierarchy nodes from last frame 229 GtpVisibility::HierarchyNodeList *nodeList = mHierarchyInterface->GetRenderedNodes(); 230 GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 231 232 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 233 { 234 SolidBoundingBox *solidBox = new SolidBoundingBox(); 235 solidBox->SetupBoundingBox(aab); 236 237 Octree *octree = static_cast<Octree *>(*nodeIt); 238 solidBox->setId(octree->getId()); 239 mSolidBoxes.push_back(solidBox); 240 241 aab = octree->_getWorldAABB(); 242 std::stringstream d; d << "bounding box with id: " << octree->getId() << ", " << aab << "\n"; 243 LogManager::getSingleton().logMessage(d.str()); 244 245 getRenderQueue()->addRenderable(solidBox); 246 } 217 247 } 218 248 else … … 233 263 //TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 234 264 265 // -- delete lists stored for visualization 235 266 mVisible.clear(); 236 267 mBoxes.clear(); 237 238 268 } 239 269 //----------------------------------------------------------------------- … … 246 276 // e.g., visualization, shadow pass 247 277 248 if (mShowVisualization || mRenderOnlyBoundingBoxes || 249 (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 278 if (mShowVisualization || mRenderHierarchyNodes || 279 (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 280 mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 250 281 { 251 282 IlluminationRenderStage savedStage = mIlluminationStage; 252 283 253 if (mShowVisualization )254 // disable illumination stage because we want no shadows in visualization284 if (mShowVisualization || mRenderHierarchyNodes) 285 // disable illumination stage because we want no shadows 255 286 mIlluminationStage = IRS_NONE; 256 287 … … 416 447 mUseItemBuffer = (*static_cast<const bool *>(val)); 417 448 return true; 449 } 450 if (key == "RenderHierarchyNodes") 451 { 452 mRenderHierarchyNodes = (*static_cast<const bool *>(val)); 418 453 } 419 454 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). … … 503 538 } 504 539 505 //--- item buffer 540 // --- item buffer 541 506 542 // Iterate through priorities 507 543 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); … … 604 640 605 641 Pass *usedPass = setPass(mItemBufferPass); 606 607 /*if (rend->getId() > 0) 608 { 609 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] << 610 " " << col[1] << " " << col[2] << " " << col[3]; 611 LogManager::getSingleton().logMessage(d.str()); 612 }*/ 642 613 643 614 644 // Render a single object, this will set up auto params if required
Note: See TracChangeset
for help on using the changeset viewer.