Changeset 155 for trunk/VUT/Ogre/src
- Timestamp:
- 07/05/05 18:35:47 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreBspHierarchyInterface.cpp
r87 r155 12 12 } 13 13 //----------------------------------------------------------------------- 14 void BspHierarchyInterface::Traverse Node(GtpVisibility::HierarchyNode *node)14 void BspHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 15 15 { 16 16 } -
trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp
r154 r155 32 32 SceneManager *sm = pfHierarchyInterface->GetSceneManager(); 33 33 34 // -- Render scene as item buffer (e.g., color coded objects)34 // ---- Render scene as 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 … … 49 49 mViewport->setBackgroundColour(ColourValue(0, 0, 0, 0)); 50 50 51 //pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR); 52 // render item buffer51 52 // --- render item buffer 53 53 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 54 54 55 56 55 57 // reset old overlay status 56 58 mViewport->setOverlaysEnabled(overlayEnabled); … … 84 86 ((*visibleGeometry)[id]).AddVisibility(1, 1); 85 87 } 86 /*else { std::stringstream d;87 d << "adding pixel to geometry with id: " << id << ", buf 1: " << (int)buf[idx] << ", buf 2: " << (int)buf[idx + 1] << ", buf 3: " << (int)buf[idx + 2];88 LogManager::getSingleton().logMessage(d.str()); }*/89 88 } 90 89 … … 101 100 return; 102 101 102 103 103 mWasInitialised = true; 104 104 105 SceneManager::EntityIterator it = 106 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)-> 107 GetSceneManager()->getEntityIterator(); 105 SceneManager *sm = 106 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 107 108 SceneManager::EntityIterator it = sm->getEntityIterator(); 108 109 109 110 // TODO: make this more efficient … … 115 116 visibleGeometry->push_back(GtpVisibility::MeshInfo(it.getNext(), 0, 0)); 116 117 } 118 119 // -- initialise hierarchy interface for simple node traversal 120 mHierarchyInterface->InitTraversal(false); 121 122 GtpVisibility::HierarchyNode *node = NULL; 123 124 while (node = mHierarchyInterface->GetNextNode()) 125 { 126 visibleNodes->push_back(GtpVisibility::NodeInfo(node, 0, 0)); 127 } 117 128 } 129 118 130 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp
r154 r155 83 83 if (i == 0) 84 84 { 85 mHierarchyInterface->Get Geometry(*nodeIt, &geometryList, false);85 mHierarchyInterface->GetNodeGeometryList(*nodeIt, &geometryList, false); 86 86 } 87 87 } … … 105 105 mViewport->setOverlaysEnabled(overlayEnabled); 106 106 107 // ---- collect results107 // ---- collect results 108 108 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; 109 109 … … 135 135 } 136 136 137 // ---- queries for geometry137 // ---- queries for geometry 138 138 geometryIt_end = geometryList.end(); 139 139 … … 154 154 ++visQueryIt; 155 155 156 // approximate depth ordering during rendering =>156 // WARNING: approximate depth ordering during rendering => 157 157 // geometry maybe occluded 158 158 if (visiblePixels > 0) -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r154 r155 10 10 //----------------------------------------------------------------------- 11 11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys): 12 SceneNodeHierarchyInterface(sm, rsys) 13 { 14 } 15 //----------------------------------------------------------------------- 16 void OctreeHierarchyInterface::Traverse Node(GtpVisibility::HierarchyNode *node)12 SceneNodeHierarchyInterface(sm, rsys), mCurrentOctreePosition(0) 13 { 14 } 15 //----------------------------------------------------------------------- 16 void OctreeHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 17 17 { 18 18 ++ mNumTraversedNodes; … … 84 84 Octree *octant = static_cast<Octree *>(node); 85 85 86 while (octant && !octant->isOctreeVisible())86 while (octant && !octant->isOctreeVisible()) 87 87 { 88 88 octant->setOctreeVisible(true); … … 129 129 AxisAlignedBox *OctreeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 130 130 { 131 if (node != m PreviousNode)132 { 133 m PreviousNode = node;131 if (node != mSavedNode) 132 { 133 mSavedNode = node; 134 134 //static_cast<Octree *>(node)->_getCullBounds(&mBox); 135 135 mBox = static_cast<Octree *>(node)->_getWorldAABB(); 136 //std::stringstream d; d << mBox;LogManager::getSingleton().logMessage(d.str());137 136 } 138 137 … … 157 156 } 158 157 //----------------------------------------------------------------------- 159 void OctreeHierarchyInterface::Get Geometry(GtpVisibility::HierarchyNode *node,158 void OctreeHierarchyInterface::GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 160 159 GtpVisibility::GeometryList *geometryList, 161 160 bool includeChildren) … … 166 165 for (nodeIt = static_cast<Octree *>(node)->mNodes.begin(); nodeIt != nodeIt_end; ++nodeIt) 167 166 { 168 SceneNodeHierarchyInterface::Get Geometry(*nodeIt, geometryList, includeChildren);167 SceneNodeHierarchyInterface::GetNodeGeometryList(*nodeIt, geometryList, includeChildren); 169 168 } 170 169 } … … 180 179 } 181 180 //----------------------------------------------------------------------- 182 /*bool OctreeHierarchyInterface::FindVisibleObjects(GtpVisibility::HierarchyNode *node, 183 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 184 bool includeChildren) 185 { 186 bool foundVisible = false; 187 188 PlatformOcclusionQuery query(mRenderSystem); 189 190 NodeList *nodes = &static_cast<Octree *>(node)->mNodes; 181 GtpVisibility::HierarchyNode *OctreeHierarchyInterface::GetNextNode() 182 { 183 if (mTraversalStack->empty()) 184 return NULL; 191 185 192 NodeList::const_iterator nodeIt = nodes->begin(), nodeIt_end; 193 194 nodeIt_end = nodes->end(); 195 196 while (nodeIt != nodeIt_end) 197 { 198 OctreeNode *octreeNode = (*nodeIt); 199 if (SceneNodeHierarchyInterface::FindVisibleObjects(octreeNode, visibleGeometry, includeChildren)) 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) 200 195 { 201 foundVisible = true;196 mTraversalStack->push(nextChild); 202 197 } 203 ++nodeIt; 204 } 205 206 return foundVisible; 207 }*/ 208 198 } 199 200 return octree; 201 } 202 209 203 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r139 r155 130 130 } 131 131 //----------------------------------------------------------------------- 132 void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root, 133 Camera *cam, Camera *cullCam, int leavePassesInQueue) 134 { 135 GtpVisibility::HierarchyInterface::InitFrame(root); 136 137 mPreviousNode = NULL; 132 void PlatformHierarchyInterface::InitTraversal(Camera *cam, Camera *cullCam, int leavePassesInQueue) 133 { 134 GtpVisibility::HierarchyInterface::InitTraversal(); 135 136 mSavedNode = NULL; 138 137 mLeavePassesInQueue = leavePassesInQueue; 139 138 … … 178 177 // If camera for culling is different from camera for rendering or only solids 179 178 // will be rendereded => cannot optimize 180 if (m UseOptimization&& (mCamera == mCullCamera) && wasVisible && IsLeaf(node))179 if (mTestGeometryForVisibleLeaves && (mCamera == mCullCamera) && wasVisible && IsLeaf(node)) 181 180 { 182 181 //LogManager::getSingleton().logMessage("render node\n"); … … 253 252 } 254 253 //----------------------------------------------------------------------- 255 bool PlatformHierarchyInterface::Get UseOptimization()256 { 257 return m UseOptimization;254 bool PlatformHierarchyInterface::GetTestGeometryForVisibleLeaves() 255 { 256 return mTestGeometryForVisibleLeaves; 258 257 } 259 258 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r154 r155 17 17 } 18 18 //----------------------------------------------------------------------- 19 void SceneNodeHierarchyInterface::Traverse Node(GtpVisibility::HierarchyNode *node)19 void SceneNodeHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 20 20 { 21 21 ++ mNumTraversedNodes; … … 121 121 { 122 122 // only create renderable bounding box for new node 123 if (node != m PreviousNode)123 if (node != mSavedNode) 124 124 { 125 m PreviousNode = node;125 mSavedNode = node; 126 126 mBox = static_cast<SceneNode *>(node)->_getWorldAABB(); 127 127 } … … 136 136 } 137 137 //----------------------------------------------------------------------- 138 void SceneNodeHierarchyInterface::Get Geometry(GtpVisibility::HierarchyNode *node,138 void SceneNodeHierarchyInterface::GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 139 139 GtpVisibility::GeometryList *geometryList, 140 140 bool includeChildren) … … 151 151 { 152 152 Entity *ent = static_cast<Entity *>(movable); 153 //std::stringstream d; d << "ent " << ent->getName(); LogManager::getSingleton().logMessage(d.str()); 153 //std::stringstream d; d << "ent " << ent->getName(); 154 //LogManager::getSingleton().logMessage(d.str()); 154 155 geometryList->push_back(ent); 155 156 } … … 166 167 return static_cast<SceneNode *>(node)->getId(); 167 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 178 // internal node: add children to priority queue for further processing 179 Node::ChildNodeIterator it = node->getChildIterator(); 180 181 while (it.hasMoreElements()) 182 { 183 mTraversalStack->push(it.getNext()); 184 } 185 186 return node; 187 } 168 188 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r154 r155 184 184 bool leaveTransparentsInQueue = mDelayRenderTransparents && !mUseDepthPass; 185 185 186 // -- initialise interface for rendering traversal of the hierarchy 187 mHierarchyInterface->SetHierarchyRoot(mOctree); 188 186 189 // possible two cameras (one for culling, one for rendering) 187 mHierarchyInterface->Init Frame(mOctree,mCameraInProgress,190 mHierarchyInterface->InitTraversal(mCameraInProgress, 188 191 mCullCamera ? getCamera("CullCamera") : NULL, 189 192 leaveTransparentsInQueue); 193 190 194 191 195 // reset culling manager stats … … 352 356 d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", " 353 357 << "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", " 354 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->Get UseOptimization()) << ", "358 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 355 359 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << "\n" 356 360 << "Hierarchy nodes: " << mNumOctreeNodes << ", " -
trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
r146 r155 26 26 if (key == "AssumedVisibility") 27 27 { 28 mVisibilityManager->SetAssumedVisibility (*static_cast<const int *>(val));28 mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val)); 29 29 return true; 30 30 } 31 if (key == " UseOptimization")31 if (key == "TestGeometryForVisibleLeaves") 32 32 { 33 mHierarchyInterface-> SetUseOptimization(*static_cast<const bool *>(val));33 mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val)); 34 34 return true; 35 35 } -
trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
r139 r155 40 40 if (!mShowVisualization) 41 41 { 42 // two cameras (one for culling, one for rendering)43 mHierarchyInterface->Init Frame(mSceneRoot,mCameraInProgress);42 mHierarchyInterface->SetHierarchyRoot(mSceneRoot); 43 mHierarchyInterface->InitTraversal(mCameraInProgress); 44 44 45 45 // reset culling manager stats -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r154 r155 30 30 mEnableDepthWrite(true), 31 31 mSkipTransparents(false), 32 mSavedShadowTechnique(SHADOWTYPE_NONE) 32 mSavedShadowTechnique(SHADOWTYPE_NONE), 33 mRenderOnlyBoundingBoxes(false) 33 34 { 34 35 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); … … 126 127 if (mRenderNodesForViz) 127 128 { 128 OctreeNode *node = *it; 129 if ((node->numAttachedObjects() > 0) && (node->numChildren() == 0) 130 && node->getAttachedObject(0)->getMovableType() == "Entity") 131 getRenderQueue()->addRenderable(node); 129 if (((*it)->numAttachedObjects() > 0) && ((*it)->numChildren() == 0) 130 && (*it)->getAttachedObject(0)->getMovableType() == "Entity") 131 getRenderQueue()->addRenderable((*it)); 132 132 133 133 // addbounding boxes instead of node itself … … 213 213 PrepareVisualization(cam); 214 214 } 215 else 215 else if (mRenderOnlyBoundingBoxes) 216 { 217 } 218 else 216 219 { 217 220 // for hierarchical culling, we interleave identification 218 221 // and rendering of objects in _renderVisibibleObjects 219 222 220 // only for the shadow pass we use standard rendering 223 // for the shadow pass we use only standard rendering 224 // because of low occlusion 221 225 if (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 222 226 mIlluminationStage == IRS_RENDER_TO_TEXTURE) … … 225 229 } 226 230 // only shadow casters will be rendered in shadow texture pass 227 // mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters);231 // mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 228 232 } 229 233 //TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters); … … 236 240 void VisibilityTerrainSceneManager::_renderVisibleObjects() 237 241 { 242 // save ambient light to reset later 238 243 ColourValue savedAmbient = mAmbientLight; 239 244 240 // visualization or shadow pass: apply standard rendering 241 if (mShowVisualization || (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 242 mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 245 // --- apply standard rendering for some cases 246 // e.g., visualization, shadow pass 247 248 if (mShowVisualization || mRenderOnlyBoundingBoxes || 249 (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 243 250 { 244 251 IlluminationRenderStage savedStage = mIlluminationStage; 245 252 246 253 if (mShowVisualization) 247 // disable illumination stage so we haveno shadows in visualization254 // disable illumination stage because we want no shadows in visualization 248 255 mIlluminationStage = IRS_NONE; 249 256 … … 455 462 d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", " 456 463 << "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", " 457 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->Get UseOptimization()) << ", "464 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 458 465 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 459 466 << "Hierarchy nodes: " << mNumOctreeNodes << ", " … … 699 706 (mLeavePassesInQueue & RenderPriorityGroup::TRANSPARENT_PASSES); 700 707 708 // -- initialise interface for rendering traversal of the hierarchy 709 mHierarchyInterface->SetHierarchyRoot(mOctree); 710 701 711 // possible two cameras (one for culling, one for rendering) 702 mHierarchyInterface->Init Frame(mOctree, cam,703 mCullCamera ? getCamera("CullCamera") : NULL,704 mLeavePassesInQueue);712 mHierarchyInterface->InitTraversal(mCameraInProgress, 713 mCullCamera ? getCamera("CullCamera") : NULL, 714 mLeavePassesInQueue); 705 715 706 716 //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue;LogManager::getSingleton().logMessage(d.str());
Note: See TracChangeset
for help on using the changeset viewer.