Changeset 156 for trunk/VUT/Ogre
- Timestamp:
- 07/06/05 02:36:16 (19 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r155 r156 106 106 bool IsBoundingBoxQuery(); 107 107 108 /** Finds visible objects of hierarchy node using occlusion queries 109 @param node the current scene node 110 @param objs the visible objects 111 @param includeChildren if the children of current scene nodes should also be traversed 112 */ 113 /*virtual bool FindVisibleObjects(GtpVisibility::HierarchyNode *node, 114 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 115 bool includeChildren = false) = 0;*/ 108 116 109 protected: 117 110 /** Renders geometry … … 126 119 */ 127 120 void DeleteQueries(); 128 129 /** Renders bounding box of specified node.130 @param box the bounding box of the scene node to be rendered131 */132 void RenderBoundingBox(AxisAlignedBox *box);133 121 134 122 /** Returns pointer to current renderable bounding box geometry. … … 138 126 /** A pass that prepares an occlusion query. 139 127 @remark disables depth write, colour write, lighting, 140 vertex and fragment program. 141 */ 128 vertex and fragment program.*/ 142 129 //void SetOcclusionPass(); 143 130 144 /** Returns pointer to current renderable half bounding box geometry.*/ 145 //SolidHalfBoundingBox *GetSolidHalfBoundingBox(); 131 /** Renders given bounding box. 132 @param box the bounding box of the scene node to be rendered 133 */ 134 void RenderBoundingBox(AxisAlignedBox *box); 146 135 147 136 /** Renderable of an aabb. -
trunk/VUT/Ogre/include/OgreSolidBoundingBox.h
r117 r156 9 9 no colors, and no lighting. 10 10 */ 11 class SolidBoundingBox : public SimpleRenderable11 class __declspec(dllexport) SolidBoundingBox : public SimpleRenderable 12 12 { 13 13 public: … … 30 30 31 31 protected: 32 /** 33 Sets the material used for occlusion queries. 34 @remark the material is called "Visibility/QueryMaterial" and 35 uses no lighting, no depth write, and no colours 36 */ 37 void SetOcclusionQueryMaterial(); 38 /** Override this method to prevent parent transforms (rotation,translation,scale) 39 */ 40 void getWorldTransforms( Matrix4* xform ) const; 41 /** @copydoc Renderable::getWorldOrientation */ 42 const Quaternion& getWorldOrientation(void) const; 43 /** @copydoc Renderable::getWorldPosition */ 44 const Vector3& getWorldPosition(void) const; 32 /** 33 Sets the material used for occlusion queries. 34 @remark the material is called "Visibility/QueryMaterial" and 35 uses no lighting, no depth write, and no colours 36 */ 37 void SetOcclusionQueryMaterial(); 38 39 /** Override this method to prevent parent transforms (rotation,translation,scale) 40 */ 41 void getWorldTransforms( Matrix4* xform ) const; 42 /** @copydoc Renderable::getWorldOrientation */ 43 const Quaternion& getWorldOrientation(void) const; 44 /** @copydoc Renderable::getWorldPosition */ 45 const Vector3& getWorldPosition(void) const; 45 46 46 47 48 47 /** Builds the wireframe line list. 48 */ 49 void setupBoundingBoxVertices(const AxisAlignedBox& aab); 49 50 50 51 Real mRadius; 51 52 }; 52 53 -
trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
r155 r156 11 11 #include "OgrePlatformQueryManager.h" 12 12 #include "VisibilityManager.h" 13 #include <OgreSolidBoundingBox.h> 14 13 15 14 16 namespace Ogre { … … 123 125 ShadowTechnique mSavedShadowTechnique; 124 126 125 bool mRenderOnlyBoundingBoxes; 127 bool mRenderHierarchyNodes; 128 129 std::vector<SolidBoundingBox *> mSolidBoxes; 126 130 }; 127 131 -
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.