blob: 6de00f61684219993f3ac411a15247a4636f2955 (
plain) (
blame)
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Dme version of a hitbox
//
//===========================================================================//
#include "mdlobjects/dmelodlist.h"
#include "datamodel/dmelementfactoryhelper.h"
#include "mdlobjects/dmelod.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Expose this class to the scene database
//-----------------------------------------------------------------------------
IMPLEMENT_ELEMENT_FACTORY( DmeLODList, CDmeLODList );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDmeLODList::OnConstruction()
{
m_LODs.Init( this, "lods" );
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmeLODList::OnDestruction()
{
}
//-----------------------------------------------------------------------------
// Returns the number of LODs in this body part, can be 0
//-----------------------------------------------------------------------------
int CDmeLODList::LODCount() const
{
return m_LODs.Count();
}
//-----------------------------------------------------------------------------
// Returns the root LOD. This is the one with the switch metric 0
//-----------------------------------------------------------------------------
CDmeLOD* CDmeLODList::GetRootLOD()
{
int nCount = m_LODs.Count();
int nMinIndex = -1;
float flMinMetric = FLT_MAX;
for ( int i = 0; i < nCount; ++i )
{
if ( m_LODs[i]->m_flSwitchMetric < flMinMetric )
{
nMinIndex = i;
flMinMetric = m_LODs[i]->m_flSwitchMetric;
if ( flMinMetric == 0.0f )
break;
}
}
return ( nMinIndex >= 0 ) ? m_LODs[nMinIndex] : NULL;
}
//-----------------------------------------------------------------------------
// Returns the shadow LOD
//-----------------------------------------------------------------------------
CDmeLOD* CDmeLODList::GetShadowLOD()
{
int nCount = m_LODs.Count();
for ( int i = 0; i < nCount; ++i )
{
if ( m_LODs[i]->m_bIsShadowLOD )
return m_LODs[i];
}
return NULL;
}
|