Changeset 120 for trunk/VUT/Ogre
- Timestamp:
- 06/06/05 18:55:02 (20 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r115 r120 84 84 /** see set */ 85 85 bool GetOnlyShadowCasters(); 86 /** see set */ 87 bool GetUseOptimization(); 86 88 87 89 protected: 88 /** true if query should test using geomery whenever it is possible, false if89 bounding boxes are always used.90 */91 bool UseOptimization() const;92 93 90 /** materials for visualizing frustum and query culled nodes */ 94 91 void CreateNodeVizMaterials(); -
trunk/VUT/Ogre/resources/VisibilityDemo.overlay
r115 r120 1 Example/VisibilityDemoOverlay 1 template element TextArea(Example/Visibility/Templates/BasicText) 2 { 3 metrics_mode pixels 4 left 5 5 top 5 6 width 180 7 height 30 8 font_name TrebuchetMSBold 9 char_height 16 10 colour_top 0.5 0.7 0.5 11 colour_bottom 0.3 0.5 0.3 12 } 13 14 Example/Visibility/DemoOverlay 2 15 { 3 16 zorder 500 … … 24 37 25 38 26 element TextArea(Example/Visibility/Algorithm) 27 { 28 metrics_mode pixels 39 element TextArea(Example/Visibility/Algorithm): Example/Visibility/Templates/BasicText 40 { 29 41 left 5 30 42 top 5 31 43 width 180 32 height 3033 font_name TrebuchetMSBold34 char_height 1635 44 caption [SPACE] Algorithm 36 colour_top 0.5 0.7 0.5 37 colour_bottom 0.3 0.5 0.3 38 } 39 element TextArea(Example/Visibility/AlgorithmInfo) 40 { 41 metrics_mode pixels 45 } 46 element TextArea(Example/Visibility/AlgorithmInfo): Example/Visibility/Templates/BasicText 47 { 42 48 left 155 43 49 top 5 44 50 width 90 45 51 height 30 46 font_name TrebuchetMSBold 47 char_height 16 48 caption : 49 colour_top 0.5 0.7 0.5 50 colour_bottom 0.3 0.5 0.3 51 } 52 53 element TextArea(Example/Visibility/Threshold) 54 { 55 metrics_mode pixels 52 caption : 53 } 54 55 element TextArea(Example/Visibility/Threshold): Example/Visibility/Templates/BasicText 56 { 56 57 left 5 57 58 top 20 58 59 width 90 59 60 height 30 60 font_name TrebuchetMSBold61 char_height 1662 61 caption [-][+] Threshold 63 colour_top 0.5 0.7 0.5 64 colour_bottom 0.3 0.5 0.3 65 } 66 element TextArea(Example/Visibility/ThresholdInfo) 67 { 68 metrics_mode pixels 62 } 63 element TextArea(Example/Visibility/ThresholdInfo): Example/Visibility/Templates/BasicText 64 { 69 65 left 155 70 66 top 20 71 67 width 90 72 68 height 30 73 font_name TrebuchetMSBold 74 char_height 16 75 caption : 76 colour_top 0.5 0.7 0.5 77 colour_bottom 0.3 0.5 0.3 78 } 79 element TextArea(Example/Visibility/UseOptimization) 80 { 81 metrics_mode pixels 69 caption : 70 } 71 element TextArea(Example/Visibility/UseOptimization): Example/Visibility/Templates/BasicText 72 { 82 73 left 5 83 74 top 35 84 75 width 90 85 76 height 30 86 font_name TrebuchetMSBold87 char_height 1688 77 caption [O] Optimization 89 colour_top 0.5 0.7 0.5 90 colour_bottom 0.3 0.5 0.3 91 } 92 element TextArea(Example/Visibility/UseOptimizationInfo) 93 { 94 metrics_mode pixels 78 } 79 element TextArea(Example/Visibility/UseOptimizationInfo): Example/Visibility/Templates/BasicText 80 { 95 81 left 155 96 82 top 35 97 83 width 90 98 84 height 30 99 font_name TrebuchetMSBold 100 char_height 16 101 caption : 102 colour_top 0.5 0.7 0.5 103 colour_bottom 0.3 0.5 0.3 104 } 105 element TextArea(Example/Visibility/UseDepthPass) 106 { 107 metrics_mode pixels 85 caption : 86 } 87 element TextArea(Example/Visibility/UseDepthPass): Example/Visibility/Templates/BasicText 88 { 108 89 left 5 109 90 top 50 110 91 width 90 111 92 height 30 112 font_name TrebuchetMSBold113 char_height 16114 93 caption [X] Depth pass 115 colour_top 0.5 0.7 0.5 116 colour_bottom 0.3 0.5 0.3 117 } 118 element TextArea(Example/Visibility/UseDepthPassInfo) 119 { 120 metrics_mode pixels 94 } 95 element TextArea(Example/Visibility/UseDepthPassInfo): Example/Visibility/Templates/BasicText 96 { 121 97 left 155 122 98 top 50 123 99 width 90 124 100 height 30 125 font_name TrebuchetMSBold 126 char_height 16 127 caption : 128 colour_top 0.5 0.7 0.5 129 colour_bottom 0.3 0.5 0.3 101 caption : 130 102 } 131 103 … … 153 125 border_bottomright_uv 0.9961 0.0039 1.0000 0.0000 154 126 155 element TextArea(Example/Visibility/FrustumCulledNodes) 156 { 157 metrics_mode pixels 127 element TextArea(Example/Visibility/FrustumCulledNodes): Example/Visibility/Templates/BasicText 128 { 158 129 left 5 159 130 top 5 160 131 width 180 161 132 height 30 133 caption Frustum Culled Nodes 134 } 135 element TextArea(Example/Visibility/FrustumCulledNodesInfo): Example/Visibility/Templates/BasicText 136 { 137 left 180 138 top 5 139 width 90 140 height 30 141 caption : 142 } 143 element TextArea(Example/Visibility/QueryCulledNodes): Example/Visibility/Templates/BasicText 144 { 145 left 5 146 top 20 147 width 180 148 height 30 149 caption Query Culled Nodes 150 } 151 element TextArea(Example/Visibility/QueryCulledNodesInfo): Example/Visibility/Templates/BasicText 152 { 153 left 180 154 top 20 155 width 90 156 height 30 157 caption : 158 } 159 element TextArea(Example/Visibility/TraversedNodes): Example/Visibility/Templates/BasicText 160 { 161 left 5 162 top 35 163 width 180 164 height 30 165 caption Traversed Nodes 166 } 167 element TextArea(Example/Visibility/TraversedNodesInfo): Example/Visibility/Templates/BasicText 168 { 169 left 180 170 top 35 171 width 90 172 height 30 173 caption : 174 } 175 element TextArea(Example/Visibility/HierarchyNodes): Example/Visibility/Templates/BasicText 176 { 177 left 5 178 top 50 179 width 180 180 height 30 181 caption Hierarchy Nodes 182 } 183 element TextArea(Example/Visibility/HierarchyNodesInfo): Example/Visibility/Templates/BasicText 184 { 185 left 180 186 top 50 187 width 90 188 height 30 189 caption : 190 } 191 element TextArea(Example/Visibility/RenderedNodes): Example/Visibility/Templates/BasicText 192 { 193 left 5 194 top 65 195 width 180 196 height 30 197 caption Rendered Nodes 198 } 199 element TextArea(Example/Visibility/RenderedNodesInfo): Example/Visibility/Templates/BasicText 200 { 201 left 180 202 top 65 203 width 90 204 height 30 205 caption : 206 } 207 element TextArea(Example/Visibility/Objects): Example/Visibility/Templates/BasicText 208 { 209 left 5 210 top 80 211 width 180 212 height 30 213 caption Number of objects 214 } 215 element TextArea(Example/Visibility/ObjectsInfo): Example/Visibility/Templates/BasicText 216 { 217 left 180 218 top 80 219 width 90 220 height 30 221 caption : 222 } 223 element TextArea(Example/Visibility/QueriesIssued): Example/Visibility/Templates/BasicText 224 { 225 left 5 226 top 95 227 width 180 228 height 30 229 caption Queries issued 230 } 231 element TextArea(Example/Visibility/QueriesIssuedInfo): Example/Visibility/Templates/BasicText 232 { 233 left 180 234 top 95 235 width 90 162 236 font_name TrebuchetMSBold 163 char_height 16 164 caption Frustum Culled Nodes 165 colour_top 0.5 0.7 0.5 166 colour_bottom 0.3 0.5 0.3 167 } 168 element TextArea(Example/Visibility/FrustumCulledNodesInfo) 169 { 170 metrics_mode pixels 171 left 180 172 top 5 173 width 90 174 height 30 175 font_name TrebuchetMSBold 176 char_height 16 177 caption : 178 colour_top 0.5 0.7 0.5 179 colour_bottom 0.3 0.5 0.3 180 } 181 element TextArea(Example/Visibility/QueryCulledNodes) 182 { 183 metrics_mode pixels 184 left 5 185 top 20 186 width 180 187 height 30 188 font_name TrebuchetMSBold 189 char_height 16 190 caption Query Culled Nodes 191 colour_top 0.5 0.7 0.5 192 colour_bottom 0.3 0.5 0.3 193 } 194 element TextArea(Example/Visibility/QueryCulledNodesInfo) 195 { 196 metrics_mode pixels 197 left 180 198 top 20 199 width 90 200 height 30 201 font_name TrebuchetMSBold 202 char_height 16 203 caption : 204 colour_top 0.5 0.7 0.5 205 colour_bottom 0.3 0.5 0.3 206 } 207 element TextArea(Example/Visibility/TraversedNodes) 208 { 209 metrics_mode pixels 210 left 5 211 top 35 212 width 180 213 height 30 214 font_name TrebuchetMSBold 215 char_height 16 216 caption Traversed Nodes 217 colour_top 0.5 0.7 0.5 218 colour_bottom 0.3 0.5 0.3 219 } 220 element TextArea(Example/Visibility/TraversedNodesInfo) 221 { 222 metrics_mode pixels 223 left 180 224 top 35 225 width 90 226 height 30 227 font_name TrebuchetMSBold 228 char_height 16 229 caption : 230 colour_top 0.5 0.7 0.5 231 colour_bottom 0.3 0.5 0.3 232 } 233 element TextArea(Example/Visibility/HierarchyNodes) 234 { 235 metrics_mode pixels 236 left 5 237 top 50 238 width 180 239 height 30 240 font_name TrebuchetMSBold 241 char_height 16 242 caption Hierarchy Nodes 243 colour_top 0.5 0.7 0.5 244 colour_bottom 0.3 0.5 0.3 245 } 246 element TextArea(Example/Visibility/HierarchyNodesInfo) 247 { 248 metrics_mode pixels 249 left 180 250 top 50 251 width 90 252 height 30 253 font_name TrebuchetMSBold 254 char_height 16 255 caption : 256 colour_top 0.5 0.7 0.5 257 colour_bottom 0.3 0.5 0.3 258 } 259 element TextArea(Example/Visibility/RenderedNodes) 260 { 261 metrics_mode pixels 262 left 5 263 top 65 264 width 180 265 height 30 266 font_name TrebuchetMSBold 267 char_height 16 268 caption Rendered Nodes 269 colour_top 0.5 0.7 0.5 270 colour_bottom 0.3 0.5 0.3 271 } 272 element TextArea(Example/Visibility/RenderedNodesInfo) 273 { 274 metrics_mode pixels 275 left 180 276 top 65 277 width 90 278 height 30 279 font_name TrebuchetMSBold 280 char_height 16 281 caption : 282 colour_top 0.5 0.7 0.5 283 colour_bottom 0.3 0.5 0.3 284 } 285 element TextArea(Example/Visibility/Objects) 286 { 287 metrics_mode pixels 288 left 5 289 top 80 290 width 180 291 height 30 292 font_name TrebuchetMSBold 293 char_height 16 294 caption Number of objects 295 colour_top 0.5 0.7 0.5 296 colour_bottom 0.3 0.5 0.3 297 } 298 element TextArea(Example/Visibility/ObjectsInfo) 299 { 300 metrics_mode pixels 301 left 180 302 top 80 303 width 90 304 height 30 305 font_name TrebuchetMSBold 306 char_height 16 307 caption : 308 colour_top 0.5 0.7 0.5 309 colour_bottom 0.3 0.5 0.3 310 } 311 element TextArea(Example/Visibility/QueriesIssued) 312 { 313 metrics_mode pixels 314 left 5 315 top 95 316 width 180 317 height 30 318 font_name TrebuchetMSBold 319 char_height 16 320 caption Queries issued 321 colour_top 0.5 0.7 0.5 322 colour_bottom 0.3 0.5 0.3 323 } 324 element TextArea(Example/Visibility/QueriesIssuedInfo) 325 { 326 metrics_mode pixels 327 left 180 328 top 95 329 width 90 330 height 30 331 font_name TrebuchetMSBold 332 char_height 16 333 caption : 334 colour_top 0.5 0.7 0.5 335 colour_bottom 0.3 0.5 0.3 237 caption : 336 238 } 337 239 } 338 240 } 241 242 Example/Visibility/HelpOverlay 243 { 244 zorder 600 245 // Stats block 246 container BorderPanel(Example/Visibility/HelpPanel) 247 { 248 metrics_mode pixels 249 horz_align left 250 vert_align top 251 width 600 252 height 315 253 left 200 254 top 200 255 material Core/StatsBlockCenter 256 //material Example/Visibility/Helpscreen 257 border_size 1 1 1 1 258 border_material Core/StatsBlockBorder 259 border_topleft_uv 0.0000 1.0000 0.0039 0.9961 260 border_top_uv 0.0039 1.0000 0.9961 0.9961 261 border_topright_uv 0.9961 1.0000 1.0000 0.9961 262 border_left_uv 0.0000 0.9961 0.0039 0.0039 263 border_right_uv 0.9961 0.9961 1.0000 0.0039 264 border_bottomleft_uv 0.0000 0.0039 0.0039 0.0000 265 border_bottom_uv 0.0039 0.0039 0.9961 0.0000 266 border_bottomright_uv 0.9961 0.0039 1.0000 0.0000 267 268 container Panel(Example/Visibility/Help/BreakPanel) 269 { 270 metrics_mode pixels 271 left 5 272 top 22 273 width 590 274 height 1 275 material Core/StatsBreak 276 } 277 278 element TextArea(Example/Visibility/Help/Help) 279 { 280 metrics_mode pixels 281 left 5 282 top 5 283 width 90 284 height 30 285 font_name TrebuchetMSBold 286 char_height 19 287 caption Additional Options 288 colour_top 1 1 0.7 289 colour_bottom 1 1 0.7 290 } 291 292 element TextArea(Example/Visibility/Help/ShowHelpInfo): Example/Visibility/Templates/BasicText 293 { 294 left 5 295 top 40 296 width 180 297 height 30 298 caption [F1] Show / Hide this screen 299 } 300 element TextArea(Example/Visibility/Help/StatsInfo): Example/Visibility/Templates/BasicText 301 { 302 left 5 303 top 55 304 width 180 305 height 30 306 caption [F2] Show / Hide stats 307 } 308 element TextArea(Example/Visibility/Help/RecordedInfo): Example/Visibility/Templates/BasicText 309 { 310 left 5 311 top 70 312 width 180 313 height 30 314 caption [F3] Start / End frame recording 315 } 316 element TextArea(Example/Visibility/Help/AppStateInfo): Example/Visibility/Templates/BasicText 317 { 318 left 5 319 top 85 320 width 180 321 height 30 322 caption [F4] Toggle between interactive / recorded walkthrough 323 } 324 element TextArea(Example/Visibility/Help/ScreenshotsInfo): Example/Visibility/Templates/BasicText 325 { 326 left 5 327 top 115 328 width 180 329 height 30 330 caption [F11] Screenshot 331 } 332 element TextArea(Example/Visibility/Help/WriteOutInfo): Example/Visibility/Templates/BasicText 333 { 334 left 5 335 top 130 336 width 180 337 height 30 338 caption [F12] Write screen objects to file 339 } 340 //-- visualization 341 element TextArea(Example/Visibility/Help/VizInfo): Example/Visibility/Templates/BasicText 342 { 343 left 5 344 top 160 345 width 180 346 height 30 347 caption [1] Show / hide visualization 348 } 349 element TextArea(Example/Visibility/Help/NextVizModeInfo): Example/Visibility/Templates/BasicText 350 { 351 left 5 352 top 175 353 width 175 354 height 30 355 caption [2] Toggle visualization mode 356 } 357 element TextArea(Example/Visibility/Help/ZoomVizInfo): Example/Visibility/Templates/BasicText 358 { 359 left 5 360 top 190 361 width 190 362 height 30 363 caption [3][4] Zoom in / out of visualization 364 } 365 element TextArea(Example/Visibility/Help/SceneDetailInfo): Example/Visibility/Templates/BasicText 366 { 367 left 5 368 top 220 369 width 180 370 height 30 371 caption [R] Toggle between solid / wireframe / point based rendering 372 } 373 element TextArea(Example/Visibility/Help/DisplayCameraDetailsInfo): Example/Visibility/Templates/BasicText 374 { 375 left 5 376 top 235 377 width 180 378 height 30 379 caption [P] Show / hide camera details 380 } 381 element TextArea(Example/Visibility/Help/DisplayOctreeInfo): Example/Visibility/Templates/BasicText 382 { 383 left 5 384 top 250 385 width 180 386 height 30 387 caption [T] Show / hide octree 388 } 389 element TextArea(Example/Visibility/Help/UseShadowsInfo): Example/Visibility/Templates/BasicText 390 { 391 left 5 392 top 265 393 width 180 394 height 30 395 caption [S] Show / hide shadows 396 } 397 element TextArea(Example/Visibility/Help/FilterInfo): Example/Visibility/Templates/BasicText 398 { 399 left 5 400 top 280 401 width 180 402 height 30 403 caption [F] toggle filtering method (trilinear, anisotropic, bilinear) 404 } 405 } 406 } -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r118 r120 86 86 87 87 // set no depth write, no color, no lighting material 88 mSceneManager->setPass(solidBox->getTechnique()->getPass(0));89 //SetOcclusionPass();88 //mSceneManager->setPass(solidBox->getTechnique()->getPass(0)); 89 SetOcclusionPass(); 90 90 91 91 solidBox->SetupBoundingBoxVertices(*box); … … 166 166 } 167 167 //----------------------------------------------------------------------- 168 bool PlatformHierarchyInterface::UseOptimization() const169 {170 /* If camera for culling is different from camera for rendering or only solids171 will be rendereded => cannot optimize172 */173 return mUseOptimization && (mCamera == mCullCamera);174 }175 176 //-----------------------------------------------------------------------177 168 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 178 169 GtpVisibility::HierarchyNode *node, const bool wasVisible) … … 186 177 // if node is leaf and was visible => will be rendered anyway. 187 178 // In this case we can also test with the real geometry. 188 if (UseOptimization() && wasVisible && IsLeaf(node) ) 179 // If camera for culling is different from camera for rendering or only solids 180 // will be rendereded => cannot optimize 181 if (mUseOptimization && (mCamera == mCullCamera) && wasVisible && IsLeaf(node) ) 189 182 { 190 183 //LogManager::getSingleton().logMessage("render node\n"); … … 240 233 return mOnlyShadowCasters; 241 234 } 235 //----------------------------------------------------------------------- 236 bool PlatformHierarchyInterface::GetUseOptimization() 237 { 238 return mUseOptimization; 239 } 242 240 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r119 r120 16 16 : 17 17 mVisibilityManager(visManager), 18 mUseDepthPass(false),19 18 mIsDepthPass(false), 20 19 mShowVisualization(false), … … 23 22 mVisualizeCulledNodes(false), 24 23 mSkipTransparents(false), 25 mDelayRenderTransparents(true) 26 { 27 mHierarchyInterface = 28 24 mDelayRenderTransparents(true), 25 mUseDepthPass(true) 26 { 27 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 29 28 30 29 //mDisplayNodes = true; … … 60 59 VisibilityOctreeSceneManager::~VisibilityOctreeSceneManager() 61 60 { 62 delete mHierarchyInterface; 61 if (mHierarchyInterface) 62 { 63 delete mHierarchyInterface; 64 mHierarchyInterface = NULL; 65 } 63 66 } 64 67 //----------------------------------------------------------------------- … … 66 69 { 67 70 // setting vertex program is not efficient 68 //Pass *usedPass = ((mIsDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 71 Pass *usedPass = ((mIsDepthPass && pass->getDepthWriteEnabled() && !pass->hasVertexProgram()) ? mDepthPass : pass); 72 73 /* 69 74 // set depth fill pass only if depth write enabled 70 75 Pass *usedPass = (mIsDepthPass && pass->getDepthWriteEnabled() ? mDepthPass : pass); 71 76 72 if (mIsDepthPass) 73 { 74 // set vertex program of current pass 75 if (pass->hasVertexProgram()) 77 if (mIsDepthPass && pass->hasVertexProgram()) 78 { 79 // set vertex program of current pass to depth pass 80 mDepthPass->setVertexProgram(pass->getVertexProgramName()); 81 82 if (mDepthPass->hasVertexProgram()) 76 83 { 77 mDepthPass->setVertexProgram(pass->getVertexProgramName()); 78 79 if (mDepthPass->hasVertexProgram()) 80 { 81 const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 82 // Load this program if not done already 83 if (!prg->isLoaded()) 84 prg->load(); 85 // Copy params 86 mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 87 } 84 const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 85 // Load this program if not done already 86 if (!prg->isLoaded()) 87 prg->load(); 88 // Copy params 89 mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 88 90 } 89 91 else if (mDepthPass->hasVertexProgram()) … … 91 93 mDepthPass->setVertexProgram(""); 92 94 } 93 } 94 95 OctreeSceneManager::setPass(usedPass);95 }*/ 96 97 SceneManager::setPass(usedPass); 96 98 97 99 return usedPass; … … 234 236 // for depth pass: add visible nodes found with the visibility culling 235 237 if (mUseDepthPass) 236 {238 { 237 239 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 238 {240 { 239 241 (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); 240 }242 } 241 243 mIsDepthPass = false; 242 244 } 243 245 mSkipTransparents = false; 244 246 … … 249 251 SceneManager::_renderVisibleObjects(); 250 252 251 //WriteLog(); // write out stats253 WriteLog(); // write out stats 252 254 } 253 255 //----------------------------------------------------------------------- … … 351 353 std::stringstream d; 352 354 353 d << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 355 d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", " 356 << "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", " 357 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetUseOptimization()) << ", " 358 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << "\n" 354 359 << "Hierarchy nodes: " << mNumOctreeNodes << ", " 355 360 << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " … … 358 363 << "Frustum culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes() << ", " 359 364 << "Queries issued: " << mVisibilityManager->GetCullingManager()->GetNumQueriesIssued() << "\n"; 365 /*<< "avg. FPS: " << mCurrentViewport->getTarget()->getAverageFPS() << ", " 366 << "best FPS: " << mCurrentViewport->getTarget()->getBestFPS() << ", " 367 << "worst FPS: " << mCurrentViewport->getTarget()->getWorstFPS() << ", " 368 << "best frame time: " << mCurrentViewport->getTarget()->getBestFrameTime() << ", " 369 << "worst frame time: " << mCurrentViewport->getTarget()->getWorstFrameTime() << "\n";*/ 360 370 361 371 LogManager::getSingleton().logMessage(d.str()); -
trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp
r115 r120 48 48 extern "C" void dllStartPlugin(void) 49 49 { 50 //visEnv = new GtpVisibility::VisibilityEnvironment();50 visEnv = new GtpVisibility::VisibilityEnvironment(); 51 51 visManager = new GtpVisibility::VisibilityManager(visEnv); 52 52 … … 64 64 Root::getSingleton().setSceneManager(ST_EXTERIOR_CLOSE, visibilityTerrainPlugin); 65 65 //Root::getSingleton().setSceneManager(ST_GENERIC, occlusionDotPlugin); 66 67 LogManager::getSingleton().logMessage("registered akira plugins");68 66 } 69 67 //----------------------------------------------------------------------- … … 77 75 78 76 delete visManager; 79 //delete visEnv;77 delete visEnv; 80 78 } 81 79 -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r119 r120 15 15 GtpVisibility::VisibilityManager *visManager): 16 16 mVisibilityManager(visManager), 17 mUseDepthPass(false),18 17 mIsDepthPass(false), 19 18 mShowVisualization(false), … … 22 21 mVisualizeCulledNodes(false), 23 22 mSkipTransparents(false), 24 mDelayRenderTransparents(true) 25 { 26 mHierarchyInterface = 27 28 29 23 mDelayRenderTransparents(true), 24 mUseDepthPass(false) 25 { 26 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 27 28 //mDisplayNodes = true; 30 29 //mShowBoundingBoxes = true; 31 30 … … 57 56 VisibilityTerrainSceneManager::~VisibilityTerrainSceneManager() 58 57 { 59 delete mHierarchyInterface; 60 } 61 //----------------------------------------------------------------------- 62 Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 63 { 58 if (mHierarchyInterface) 59 { 60 delete mHierarchyInterface; 61 mHierarchyInterface = NULL; 62 } 63 } 64 //----------------------------------------------------------------------- 65 /*Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 66 { 67 static bool myLastUsedVertexProgram = false; 68 static bool myLastUsedFragmentProgram = false; 69 64 70 // set depth fill pass only if depth write enabled 65 Pass *usedPass = (mIsDepthPass && pass->getDepthWriteEnabled() ? mDepthPass : pass); 66 67 if (mIsDepthPass) 68 { 69 //if (pass->isTransparent()) return pass; 70 71 // set vertex program of current pass 72 if (pass->hasVertexProgram() && (pass->getVertexProgramName() != mDepthPass->getVertexProgramName())) 73 { 74 mDepthPass->setVertexProgram(pass->getVertexProgramName()); 75 76 if (mDepthPass->hasVertexProgram()) 77 { 78 const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 79 // Load this program if not done already 80 if (!prg->isLoaded()) prg->load(); 81 // Copy params 82 mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 83 } 84 } 85 else if (mDepthPass->hasVertexProgram()) 86 { 87 mDepthPass->setVertexProgram(""); 88 } 89 } 90 91 TerrainSceneManager::setPass(usedPass); 71 Pass *usedPass = pass; 72 73 if (mIsDepthPass && pass->getDepthWriteEnabled()) 74 { 75 usedPass = mDepthPass; 76 } 77 78 if (mIlluminationStage == IRS_RENDER_TO_TEXTURE) 79 { 80 // Derive a special shadow caster pass from this one 81 usedPass = deriveShadowCasterPass(usedPass); 82 } 83 else if (mIlluminationStage == IRS_RENDER_MODULATIVE_PASS) 84 { 85 usedPass = deriveShadowReceiverPass(usedPass); 86 } 87 88 bool passSurfaceAndLightParams = true; 89 90 // take original pass here 91 if (usedPass->hasVertexProgram()) 92 { 93 mDestRenderSystem->bindGpuProgram(usedPass->getVertexProgram()->_getBindingDelegate()); 94 // bind parameters later since they can be per-object 95 myLastUsedVertexProgram = true; 96 // does the vertex program want surface and light params passed to rendersystem? 97 passSurfaceAndLightParams = usedPass->getVertexProgram()->getPassSurfaceAndLightStates(); 98 } 99 else 100 { 101 // Unbind program? 102 if (myLastUsedVertexProgram) 103 { 104 mDestRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM); 105 myLastUsedVertexProgram = false; 106 } 107 // Set fixed-function vertex parameters 108 } 109 110 if (passSurfaceAndLightParams) 111 { 112 // Set surface reflectance properties, only valid if lighting is enabled 113 if (usedPass->getLightingEnabled()) 114 { 115 mDestRenderSystem->_setSurfaceParams( 116 usedPass->getAmbient(), 117 usedPass->getDiffuse(), 118 usedPass->getSpecular(), 119 usedPass->getSelfIllumination(), 120 usedPass->getShininess(), 121 usedPass->getVertexColourTracking() ); 122 } 123 124 // Dynamic lighting enabled? 125 mDestRenderSystem->setLightingEnabled(usedPass->getLightingEnabled()); 126 } 127 128 // Using a fragment program? 129 if (usedPass->hasFragmentProgram()) 130 { 131 mDestRenderSystem->bindGpuProgram( 132 usedPass->getFragmentProgram()->_getBindingDelegate()); 133 // bind parameters later since they can be per-object 134 myLastUsedFragmentProgram = true; 135 } 136 else 137 { 138 // Unbind program? 139 if (myLastUsedFragmentProgram) 140 { 141 mDestRenderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM); 142 myLastUsedFragmentProgram = false; 143 } 144 145 // Set fixed-function fragment settings 146 147 // Fog (assumes we want pixel fog which is the usual) 148 // New fog params can either be from scene or from material 149 FogMode newFogMode; 150 ColourValue newFogColour; 151 Real newFogStart, newFogEnd, newFogDensity; 152 if (usedPass->getFogOverride()) 153 { 154 // New fog params from material 155 newFogMode = usedPass->getFogMode(); 156 newFogColour = usedPass->getFogColour(); 157 newFogStart = usedPass->getFogStart(); 158 newFogEnd = usedPass->getFogEnd(); 159 newFogDensity = usedPass->getFogDensity(); 160 } 161 else 162 { 163 // New fog params from scene 164 newFogMode = mFogMode; 165 newFogColour = mFogColour; 166 newFogStart = mFogStart; 167 newFogEnd = mFogEnd; 168 newFogDensity = mFogDensity; 169 } 170 mDestRenderSystem->_setFog(newFogMode, newFogColour, newFogDensity, newFogStart, newFogEnd); 171 172 } 173 174 // The rest of the settings are the same no matter whether we use programs or not 175 176 // Set scene blending 177 mDestRenderSystem->_setSceneBlending( 178 usedPass->getSourceBlendFactor(), usedPass->getDestBlendFactor()); 179 180 181 // Texture unit settings 182 183 Pass::TextureUnitStateIterator texIter = usedPass->getTextureUnitStateIterator(); 184 size_t unit = 0; 185 while(texIter.hasMoreElements()) 186 { 187 TextureUnitState* pTex = texIter.getNext(); 188 mDestRenderSystem->_setTextureUnitSettings(unit, *pTex); 189 ++unit; 190 } 191 // Disable remaining texture units 192 mDestRenderSystem->_disableTextureUnitsFrom(usedPass->getNumTextureUnitStates()); 193 194 // Set up non-texture related material settings 195 // Depth buffer settings 196 mDestRenderSystem->_setDepthBufferFunction(usedPass->getDepthFunction()); 197 mDestRenderSystem->_setDepthBufferCheckEnabled(usedPass->getDepthCheckEnabled()); 198 mDestRenderSystem->_setDepthBufferWriteEnabled(usedPass->getDepthWriteEnabled()); 199 mDestRenderSystem->_setDepthBias(usedPass->getDepthBias()); 200 // Alpha-reject settings 201 mDestRenderSystem->_setAlphaRejectSettings( 202 usedPass->getAlphaRejectFunction(), usedPass->getAlphaRejectValue()); 203 // Set colour write mode 204 // Right now we only use on/off, not per-channel 205 bool colWrite = usedPass->getColourWriteEnabled(); 206 mDestRenderSystem->_setColourBufferWriteEnabled(colWrite, colWrite, colWrite, colWrite); 207 // Culling mode 208 mDestRenderSystem->_setCullingMode(usedPass->getCullingMode()); 209 // Shading 210 mDestRenderSystem->setShadingType(usedPass->getShadingMode()); 92 211 93 212 return usedPass; 94 } 213 }*/ 95 214 //----------------------------------------------------------------------- 96 215 void VisibilityTerrainSceneManager::ShowVisualization(Camera *cam) … … 138 257 } 139 258 //----------------------------------------------------------------------- 259 Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 260 { 261 // setting vertex program is not efficient 262 //Pass *usedPass = ((mIsDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 263 // set depth fill pass only if depth write enabled 264 Pass *usedPass = (mIsDepthPass && pass->getDepthWriteEnabled() ? mDepthPass : pass); 265 266 if (mIsDepthPass) 267 { 268 // set vertex program of current pass 269 if (pass->hasVertexProgram()) 270 { 271 mDepthPass->setVertexProgram(pass->getVertexProgramName()); 272 273 if (mDepthPass->hasVertexProgram()) 274 { 275 const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 276 // Load this program if not done already 277 if (!prg->isLoaded()) 278 prg->load(); 279 // Copy params 280 mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 281 } 282 } 283 else if (mDepthPass->hasVertexProgram()) 284 { 285 mDepthPass->setVertexProgram(""); 286 } 287 } 288 /*else if (mIsItemBufferPass) 289 { 290 usedPass = mItemBufferPass; 291 }*/ 292 SceneManager::setPass(usedPass); 293 294 return usedPass; 295 } 296 //----------------------------------------------------------------------- 140 297 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 141 298 { … … 232 389 mIsDepthPass = false; 233 390 } 391 234 392 mSkipTransparents = false; 235 393 … … 342 500 std::stringstream d; 343 501 344 d << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 502 d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", " 503 << "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", " 504 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetUseOptimization()) << ", " 505 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 345 506 << "Hierarchy nodes: " << mNumOctreeNodes << ", " 346 507 << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", "
Note: See TracChangeset
for help on using the changeset viewer.