apiMeshGeom.h
#ifndef _apiMeshGeom
#define _apiMeshGeom
#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