Changeset 158 for trunk/VUT/Ogre/src
- Timestamp:
- 07/06/05 11:04:25 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreBspHierarchyInterface.cpp
r155 r158 12 12 } 13 13 //----------------------------------------------------------------------- 14 void BspHierarchyInterface::Traverse AndRenderNode(GtpVisibility::HierarchyNode *node)14 void BspHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 15 15 { 16 16 } -
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 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r155 r158 10 10 //----------------------------------------------------------------------- 11 11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys): 12 SceneNodeHierarchyInterface(sm, rsys) , mCurrentOctreePosition(0)12 SceneNodeHierarchyInterface(sm, rsys) 13 13 { 14 14 } 15 15 //----------------------------------------------------------------------- 16 void OctreeHierarchyInterface::Traverse AndRenderNode(GtpVisibility::HierarchyNode *node)16 void OctreeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 17 17 { 18 18 ++ mNumTraversedNodes; … … 168 168 } 169 169 } 170 //-----------------------------------------------------------------------171 void OctreeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id)172 {173 static_cast<Octree *>(node)->setId(id);174 }175 //-----------------------------------------------------------------------176 int OctreeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node)177 {178 return static_cast<Octree *>(node)->getId();179 }180 //-----------------------------------------------------------------------181 GtpVisibility::HierarchyNode *OctreeHierarchyInterface::GetNextNode()182 {183 if (mTraversalStack->empty())184 return NULL;185 186 Octree *octree = static_cast<Octree *>(mTraversalStack->top());187 mTraversalStack->pop();188 189 for(int i=0; i<8; ++i)190 {191 Octree *nextChild =192 octree->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1];193 194 if (nextChild)195 {196 mTraversalStack->push(nextChild);197 }198 }199 200 return octree;201 }202 203 170 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r155 r158 130 130 } 131 131 //----------------------------------------------------------------------- 132 void PlatformHierarchyInterface::InitTraversal(Camera *cam, Camera *cullCam, int leavePassesInQueue) 132 void PlatformHierarchyInterface::InitTraversal(Camera *cam, Camera *cullCam, 133 int leavePassesInQueue) 133 134 { 134 135 GtpVisibility::HierarchyInterface::InitTraversal(); -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r155 r158 17 17 } 18 18 //----------------------------------------------------------------------- 19 void SceneNodeHierarchyInterface::Traverse AndRenderNode(GtpVisibility::HierarchyNode *node)19 void SceneNodeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 20 20 { 21 21 ++ mNumTraversedNodes; … … 157 157 } 158 158 } 159 //-----------------------------------------------------------------------160 void SceneNodeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id)161 {162 static_cast<SceneNode *>(node)->setId(id);163 }164 //-----------------------------------------------------------------------165 int SceneNodeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node)166 {167 return static_cast<SceneNode *>(node)->getId();168 }169 //-----------------------------------------------------------------------170 GtpVisibility::HierarchyNode *SceneNodeHierarchyInterface::GetNextNode()171 {172 if (mTraversalStack->empty())173 return NULL;174 175 SceneNode *node = static_cast<SceneNode *>(mTraversalStack->top());176 mTraversalStack->pop();177 159 178 // internal node: add children to priority queue for further processing179 Node::ChildNodeIterator it = node->getChildIterator();180 181 while (it.hasMoreElements())182 {183 mTraversalStack->push(it.getNext());184 }185 186 return node;187 }188 160 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r157 r158 31 31 mEnableDepthWrite(true), 32 32 mSkipTransparents(false), 33 mSavedShadowTechnique(SHADOWTYPE_NONE), 34 mRenderHierarchyNodes(false) 35 //mRenderHierarchyNodes(true) 33 mSavedShadowTechnique(SHADOWTYPE_NONE) 36 34 { 37 35 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); … … 210 208 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 211 209 { 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 218 210 //-- show visible scene nodes and octree bounding boxes from last frame 219 211 if (mShowVisualization) … … 221 213 PrepareVisualization(cam); 222 214 } 223 else if (mRenderHierarchyNodes)224 {225 AxisAlignedBox aab;226 227 228 // get rendered hierarchy nodes from last frame229 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 }247 }248 215 else 249 216 { … … 273 240 ColourValue savedAmbient = mAmbientLight; 274 241 275 // --- apply standard rendering for some cases 276 // e.g., visualization, shadow pass 277 278 if (mShowVisualization || mRenderHierarchyNodes || 242 // --- apply standard rendering for some cases (e.g., visualization, shadow pass) 243 244 if (mShowVisualization || 279 245 (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 280 246 mIlluminationStage == IRS_RENDER_TO_TEXTURE)) … … 282 248 IlluminationRenderStage savedStage = mIlluminationStage; 283 249 284 if (mShowVisualization || mRenderHierarchyNodes)285 // disable illumination stage because we want noshadows250 if (mShowVisualization) 251 // disable illumination stage to prevent rendering shadows 286 252 mIlluminationStage = IRS_NONE; 287 253 … … 448 414 return true; 449 415 } 450 if (key == "RenderHierarchyNodes") 451 { 452 mRenderHierarchyNodes = (*static_cast<const bool *>(val)); 453 } 416 454 417 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 455 418 setOption(key, val) || TerrainSceneManager::setOption(key, val);
Note: See TracChangeset
for help on using the changeset viewer.