Changeset 158 for trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp
- Timestamp:
- 07/06/05 11:04:25 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp
r156 r158 77 77 } 78 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 } 79 //-- reset options 108 80 109 81 // don't need item buffer anymore 110 82 useItemBuffer = false; 111 //sm->setOption("UseItemBuffer", &useItemBuffer); 112 113 renderBoxes = false; 114 //sm->setOption("RenderHierarchyNodes", &renderBoxes); 115 83 sm->setOption("UseItemBuffer", &useItemBuffer); 116 84 // reset initialised - flag 117 85 mWasInitialised = false; 118 119 86 // reset old overlay status 120 87 mViewport->setOverlaysEnabled(overlayEnabled); 121 88 // reset background color 122 89 mViewport->setBackgroundColour(bg); 123 90 91 // delete array storing the frame buffer 124 92 delete [] buf; 125 93 } … … 146 114 visibleGeometry->push_back(GtpVisibility::MeshInfo(it.getNext(), 0, 0)); 147 115 } 148 149 // -- initialise hierarchy interface for simple node traversal150 mHierarchyInterface->InitTraversal(false);151 152 GtpVisibility::HierarchyNode *node = NULL;153 154 int i = 1;155 156 while (node = mHierarchyInterface->GetNextNode())157 {158 mHierarchyInterface->SetNodeId(node, i++);159 visibleNodes->push_back(GtpVisibility::NodeInfo(node, 0, 0));160 }161 116 } 162 117
Note: See TracChangeset
for help on using the changeset viewer.