unsigned short CPixelVisibilitySystem::FindOrCreateQueryForView( CPixelVisSet *pSet, int viewID ) { unsigned short node = FindQueryForView( pSet, viewID ); if ( node != m_queryList.InvalidIndex() ) return node; node = AllocQuery(); m_queryList.LinkToHead( pSet->queryList, node ); m_queryList[node].SetView( viewID ); return node; }
void CPixelVisibilitySystem::DeleteUnusedQueries( CPixelVisSet *pSet, bool bDeleteAll ) { unsigned short node = m_queryList.Head( pSet->queryList ); while ( node != m_queryList.InvalidIndex() ) { unsigned short next = m_queryList.Next( node ); if ( bDeleteAll || !m_queryList[node].IsActive() ) { m_queryList.Unlink( pSet->queryList, node); m_queryList.LinkToHead( m_freeQueriesList, node ); } node = next; } }
unsigned short CPixelVisibilitySystem::AllocSet() { unsigned short node = m_setList.Head(m_freeSetsList); if ( node != m_setList.InvalidIndex() ) { m_setList.Unlink( m_freeSetsList, node ); } else { node = m_setList.Alloc(); m_setList[node].queryList = m_queryList.CreateList(); } m_setList.LinkToHead( m_activeSetsList, node ); return node; }
void CPixelVisibilitySystem::FreeSet( unsigned short node ) { m_setList.Unlink( m_activeSetsList, node ); m_setList.LinkToHead( m_freeSetsList, node ); m_setList[node].serial++; }