blob: 1028586b4aa934c082f8d2a48c8f46d668d69f14 (
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
82
83
84
85
86
87
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// A class representing an abstract shape (ie drawable object)
//
//=============================================================================
#ifndef DMEFACESET_H
#define DMEFACESET_H
#ifdef _WIN32
#pragma once
#endif
#include "datamodel/dmelement.h"
#include "datamodel/dmattribute.h"
#include "datamodel/dmattributevar.h"
#include "tier1/utlvector.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CDmeMaterial;
//-----------------------------------------------------------------------------
// A class representing a face of a polygonal mesh
//-----------------------------------------------------------------------------
class CDmeFaceSet : public CDmElement
{
DEFINE_ELEMENT( CDmeFaceSet, CDmElement );
public:
// material accessors
CDmeMaterial *GetMaterial();
void SetMaterial( CDmeMaterial *pMaterial );
// Total number of indices in the face set including the -1 end of face designators
int NumIndices() const;
const int *GetIndices() const;
int AddIndices( int nCount );
void SetIndex( int i, int nValue );
void SetIndices( int nFirstIndex, int nCount, int *pIndices );
int GetIndex( int i ) const;
// Returns the number of vertices in the next polygon
int GetNextPolygonVertexCount( int nFirstIndex ) const;
// Returns the number of triangulated indices total
int GetTriangulatedIndexCount() const;
// Total number of indices in the face set excluding the -1 end of face designators
int GetIndexCount() const;
// Removes multiple faces from the face set
void RemoveMultiple( int elem, int num );
// Returns the number of faces in total... This should be the number of -1 indices in the face set
// Which should equal NumIndices() - GetIndexCount() but this function accounts for
// empty faces (which aren't counted as faces) and a missing -1 terminator at the end
int GetFaceCount() const;
private:
CDmaArray< int > m_indices;
CDmaElement< CDmeMaterial > m_material;
};
//-----------------------------------------------------------------------------
// Inline methods
//-----------------------------------------------------------------------------
inline int CDmeFaceSet::NumIndices() const
{
return m_indices.Count();
}
inline const int *CDmeFaceSet::GetIndices() const
{
return m_indices.Base();
}
inline int CDmeFaceSet::GetIndex( int i ) const
{
return m_indices[i];
}
#endif // DMEFACESET_H
|