Changeset 135 for trunk/VUT/Ogre/src
- Timestamp:
- 06/16/05 18:13:33 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r130 r135 137 137 { 138 138 mPreviousNode = node; 139 static_cast<Octree *>(node)->_getCullBounds(&mBox); 139 // static_cast<Octree *>(node)->_getCullBounds(&mBox); 140 mBox = static_cast<Octree *>(node)->_getWorldAABB(); 140 141 } 141 142 -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r133 r135 188 188 else 189 189 { 190 // used by the scene manager, because bounding box rendering must be handled191 // differently190 // this information is used e.g., by the scene graph, because the bounding box 191 // must be treated differently to the scene geometry during rendering 192 192 mIsBoundingBoxQuery = true; 193 193 -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r134 r135 25 25 bool relativeVisibility) 26 26 { 27 if (relativeVisibility)28 LogManager::getSingleton().logMessage("relative");29 else30 LogManager::getSingleton().logMessage("absolute");31 32 27 // we need access to the scene manager and the rendersystem 33 28 PlatformHierarchyInterface *pfHierarchyInterface = … … 39 34 Camera *pCam = const_cast<Camera *>(&camera); 40 35 36 bool overlayEnabled = mViewport->getOverlaysEnabled(); 37 mViewport->setOverlaysEnabled(false); 41 38 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 42 39 … … 53 50 GtpVisibility::GeometryList geometryList; 54 51 55 GtpVisibility::HierarchyNodeList:: const_iterator nodeIt, nodeIt_end = nodeList->end();52 GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 56 53 // geometry list has still do be built 57 54 GtpVisibility::GeometryList::iterator geometryIt, geometryIt_end; 58 55 56 // to obtain the correct number of projected pixels, depth write must be disabled 57 58 bool enableDepthWrite = false; 59 // this option must be provided by the scene manager 60 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 61 62 /* relative visiblity: 63 1) get visible pixels count of objects 64 2) clear frame buffer 65 3) get projected visible pixels count: 66 test all objects again without depth write (set as option in scene manager) 67 4) calculate ratio between visible vs. projected pixels 68 */ 59 69 // for relative visibility we need 2 rendering passes 60 70 int n = relativeVisibility ? 2 : 1; … … 63 73 { 64 74 //-- queries for hierarchy nodes 65 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 75 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 66 76 { 67 77 // TODO: DELETE QUERIES FROM PREVIOUS RENDER … … 69 79 70 80 // store geometry of the hierarchy node in a geometry list (only once!) 71 if (i == n - 2)81 if (i == 0) 72 82 { 73 83 mHierarchyInterface->GetGeometry(*nodeIt, &geometryList, false); … … 83 93 } 84 94 85 // --- relative visiblity 86 /* 87 1) get visible pixels count of objects 88 2) clear frame buffer 89 3) get projected visible pixels count: 90 test all objects again without depth write (set as option in scene manager) 91 4) calculate ratio between visible vs. projected pixels 92 */ 93 if (i == n - 2) // if relativeVisibility, between first and second loop 94 { 95 pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR | FBT_DEPTH); 96 } 97 98 // to obtain the correct number of projected pixels, depth write must be disabled 99 bool enableDepthWrite = (i != n - 2); 100 101 // this option must be provided by the scene manager 102 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 95 96 pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_DEPTH); 103 97 } 104 98 99 enableDepthWrite = true; 100 // this option must be provided by the scene manager 101 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 102 103 mViewport->setOverlaysEnabled(overlayEnabled); 105 104 106 105 //---- collect results 107 unsigned int visiblePixels ;106 unsigned int visiblePixels = 0; 108 107 109 108 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; … … 111 110 visQueryIt = queryList[0].begin(); 112 111 projQueryIt = queryList[1].begin(); 112 113 113 114 114 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 115 115 { 116 116 (*visQueryIt)->GetQueryResult(visiblePixels, true); 117 117 118 118 119 float vis = (float)visiblePixels; 119 120 … … 121 122 { 122 123 (*projQueryIt)->GetQueryResult(visiblePixels, true); 123 std::stringstream d; d << "relativ " << visiblePixels; 124 LogManager::getSingleton().logMessage(d.str()); 125 124 126 125 if (visiblePixels > 0) 127 126 { … … 132 131 133 132 ++visQueryIt; 134 133 135 134 // leave nodes with visibilty 0 in queue: 136 135 // happens if node is intersected by near plane … … 141 140 geometryIt_end = geometryList.end(); 142 141 143 /*for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt)142 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 144 143 { 145 (*absQueryIt)->GetQueryResult(visiblePixels, true); 144 (*visQueryIt)->GetQueryResult(visiblePixels, true); 145 146 146 147 147 float vis = (float)visiblePixels; … … 150 150 if (relativeVisibility) 151 151 { 152 (* relQueryIt)->GetQueryResult(visiblePixels, true);152 (*projQueryIt)->GetQueryResult(visiblePixels, true); 153 153 154 154 if (visiblePixels) … … 156 156 vis /= (float) visiblePixels; 157 157 } 158 ++ relQueryIt;158 ++projQueryIt; 159 159 } 160 160 161 ++ absQueryIt;161 ++visQueryIt; 162 162 163 163 // approximate depth ordering during rendering => … … 167 167 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, vis)); 168 168 } 169 } */169 } 170 170 171 171 } … … 176 176 bool relativeVisibility) 177 177 { 178 visibleNodes->push_back(GtpVisibility::NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f));178 179 179 } 180 180 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreTerrainContentGenerator.cpp
r130 r135 70 70 const Vector3 &rotation, const String& objName, const bool clampToTerrain) 71 71 { 72 73 if (clampToTerrain) 74 { 75 return GenerateSceneObject(position, rotation, objName); 76 } 77 else 78 { 79 return SceneContentGenerator::GenerateSceneObject(position, rotation, objName); 80 } 81 } 82 //----------------------------------------------------------------------- 83 SceneNode *TerrainContentGenerator::GenerateSceneObject(const Vector3 &position, 84 const Vector3 &rotation, const String& objName) 85 { 72 86 Vector3 queryResult; 73 87 // set y to max height so we are sure to be over terrain 74 88 Vector3 pos(position.x, MAX_HEIGHT, position.z); 75 76 if (!clampToTerrain)77 {78 return SceneContentGenerator::GenerateSceneObject(queryResult, rotation, objName);79 }80 89 81 90 if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r134 r135 274 274 TerrainSceneManager::_renderVisibleObjects(); 275 275 276 277 276 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 278 277 _deleteRenderedQueueGroups(false); … … 300 299 mVisibilityManager->ApplyVisibilityCulling(); 301 300 301 // delete remaining renderables from queue (or all but transparents) 302 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 303 _deleteRenderedQueueGroups(mSkipTransparents); 304 #endif 302 305 303 306 // for depth pass: add visible nodes found with the visibility culling … … 320 323 321 324 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 325 getRenderQueue()->clear(); 322 326 //WriteLog(); // write out stats 323 327 }
Note: See TracChangeset
for help on using the changeset viewer.