forked from nillerusr/source-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcl_renderqueue.cpp
More file actions
93 lines (75 loc) · 2.23 KB
/
cl_renderqueue.cpp
File metadata and controls
93 lines (75 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#include "cl_renderqueue.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//----------------------------------------------------------------------------------------
CRenderQueue::CRenderQueue()
{
}
CRenderQueue::~CRenderQueue()
{
Clear();
}
void CRenderQueue::Add( ReplayHandle_t hReplay, int iPerformance )
{
RenderInfo_t *pEntry = new RenderInfo_t;
pEntry->m_hReplay = hReplay;
pEntry->m_iPerformance = iPerformance;
m_vecQueue.AddToTail( pEntry );
}
void CRenderQueue::Remove( ReplayHandle_t hReplay, int iPerformance )
{
RenderInfo_t *pEntry = Find( hReplay, iPerformance );
if ( pEntry )
{
m_vecQueue.FindAndRemove( pEntry );
delete pEntry;
}
}
void CRenderQueue::Clear()
{
m_vecQueue.PurgeAndDeleteElements();
}
int CRenderQueue::GetCount() const
{
return m_vecQueue.Count();
}
bool CRenderQueue::GetEntryData( int iIndex, ReplayHandle_t *pHandleOut, int *pPerformanceOut ) const
{
if ( iIndex < 0 || iIndex >= GetCount() )
{
AssertMsg( 0, "Request for replay render queue data is out of bounds!" );
Warning( "Request for replay render queue data is out of bounds!" );
return false;
}
if ( !pHandleOut || !pPerformanceOut )
{
AssertMsg( 0, "Bad parameters" );
return false;
}
const RenderInfo_t *pEntry = m_vecQueue[ iIndex ];
*pHandleOut = pEntry->m_hReplay;
*pPerformanceOut = pEntry->m_iPerformance;
return true;
}
bool CRenderQueue::IsInQueue( ReplayHandle_t hReplay, int iPerformance ) const
{
return Find( hReplay, iPerformance ) != NULL;
}
CRenderQueue::RenderInfo_t *CRenderQueue::Find( ReplayHandle_t hReplay, int iPerformance )
{
FOR_EACH_VEC( m_vecQueue, i )
{
RenderInfo_t *pEntry = m_vecQueue[ i ];
if ( pEntry->m_hReplay == hReplay && pEntry->m_iPerformance == iPerformance )
return pEntry;
}
return NULL;
}
const CRenderQueue::RenderInfo_t *CRenderQueue::Find( ReplayHandle_t hReplay, int iPerformance ) const
{
return const_cast< CRenderQueue * >( this )->Find( hReplay, iPerformance );
}
//----------------------------------------------------------------------------------------