-------------------------------------------------------------------------------------- Description: Issues a visibility query and stores the results in the given visibility results set. This function returns early and issues a log error message if the results set is NULL. The interior scene holds a pointer to the results set, so it can be reused elsewhere. Arguments: results - The results set pop
| 509 | // results - The results set populated by the visibility query |
| 510 | // -------------------------------------------------------------------------------------- |
| 511 | void Tr2InteriorScene::VisibilityQuery( Tr2VisibilityResults* results, Tr2RenderContext& renderContext ) |
| 512 | { |
| 513 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 514 | |
| 515 | if( !results ) |
| 516 | { |
| 517 | CCP_LOGERR( "Attempt to issue a visibility query on an interior scene with a NULL " |
| 518 | "result set!" ); |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | m_visibilityResults = results; |
| 523 | m_visibilityResults->Clear(); |
| 524 | |
| 525 | // Choose LOD for dynamics |
| 526 | TriFrustum frustum; |
| 527 | frustum.DeriveFrustum( |
| 528 | &Tr2Renderer::GetViewTransform(), |
| 529 | &Tr2Renderer::GetViewPosition(), |
| 530 | &Tr2Renderer::GetProjectionTransform(), |
| 531 | renderContext.m_esm.GetViewport() ); |
| 532 | |
| 533 | //this is to assist in tracking down the crash that's been popping up in this function. |
| 534 | //The bools are here just in case logging breaks during the crash |
| 535 | const size_t dynamicsSize = m_dynamics.size(); |
| 536 | |
| 537 | for( PITr2InteriorDynamicVector::iterator it = m_dynamics.begin(); it != m_dynamics.end(); ++it ) |
| 538 | { |
| 539 | if( dynamicsSize != m_dynamics.size() ) |
| 540 | { |
| 541 | CCP_LOGERR( "VisibilityQuery-m_dynamics changed size while we iterated over it! (before setlod)" ); |
| 542 | } |
| 543 | if( !*it ) |
| 544 | { |
| 545 | CCP_LOGERR( "VisibilityQuery-null pointer in m_dynamics" ); |
| 546 | } |
| 547 | ( *it )->SetLOD( &frustum ); |
| 548 | if( dynamicsSize != m_dynamics.size() ) |
| 549 | { |
| 550 | CCP_LOGERR( "VisibilityQuery-m_dynamics changed size while we iterated over it! (after setlod)" ); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | m_visibilityQueryType = PRIMARY_QUERY; |
| 555 | |
| 556 | ResolveVisibility( Tr2Renderer::GetViewTransform(), Tr2Renderer::GetProjectionTransform(), true ); |
| 557 | } |
| 558 | |
| 559 | void Tr2InteriorScene::ResolveVisibility( const Matrix& view, const Matrix& projection, size_t maxDepth ) |
| 560 | { |
nothing calls this directly
no test coverage detected