-
Notifications
You must be signed in to change notification settings - Fork 3
/
apiMeshGeom.h
101 lines (83 loc) · 2.26 KB
/
apiMeshGeom.h
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
93
94
95
96
97
98
99
100
101
//-
// ==========================================================================
// Copyright 1995,2006,2008 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk
// license agreement provided at the time of installation or download,
// or which otherwise accompanies this software in either electronic
// or hard copy form.
// ==========================================================================
//+
#ifndef _apiMeshGeom
#define _apiMeshGeom
////////////////////////////////////////////////////////////////////////////////
//
// This class holds the underlying geometry for the shape or data.
// This is where geometry specific data and methods should go.
//
////////////////////////////////////////////////////////////////////////////////
#include <maya/MPointArray.h>
#include <maya/MIntArray.h>
#include <maya/MFloatArray.h>
#include <maya/MVectorArray.h>
class apiMeshGeomUV;
class apiMeshGeomUV {
public:
apiMeshGeomUV() { reset(); }
~apiMeshGeomUV() {}
int uvId( int faceVertexIndex ) const;
void getUV( int uvId, float &u, float &v ) const;
float u( int uvId ) const;
float v( int uvId ) const;
int uvcount() const;
void append_uv( float u, float v );
void reset();
MIntArray faceVertexIndex;
MFloatArray ucoord;
MFloatArray vcoord;
};
inline void apiMeshGeomUV::reset()
{
ucoord.clear(); vcoord.clear(); faceVertexIndex.clear();
}
inline void apiMeshGeomUV::append_uv( float u, float v )
{
ucoord.append( u );
vcoord.append( v );
}
inline int apiMeshGeomUV::uvId( int fvi ) const
{
return faceVertexIndex[fvi];
}
inline void apiMeshGeomUV::getUV( int uvId, float &u, float &v ) const
{
u = ucoord[uvId];
v = vcoord[uvId];
}
inline float apiMeshGeomUV::u( int uvId ) const
{
return ucoord[uvId];
}
inline float apiMeshGeomUV::v( int uvId ) const
{
return vcoord[uvId];
}
inline int apiMeshGeomUV::uvcount( ) const
{
return ucoord.length();
}
class apiMeshGeom
{
public:
apiMeshGeom();
~apiMeshGeom();
apiMeshGeom& operator=( const apiMeshGeom& );
public:
MPointArray vertices;
MIntArray face_counts;
MIntArray face_connects;
MVectorArray normals;
apiMeshGeomUV uvcoords;
int faceCount;
};
#endif /* _apiMeshGeom */