本文整理汇总了C++中SubMesh::load方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::load方法的具体用法?C++ SubMesh::load怎么用?C++ SubMesh::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubMesh
的用法示例。
在下文中一共展示了SubMesh::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
MStatus Mesh::load(MDagPath& meshDag,MDagPath *pDagPath)
{
MStatus stat;
std::vector<MFloatArray> weights;
std::vector<MIntArray> Ids;
std::vector<MIntArray> jointIds;
unsigned int numJoints = 0;
std::vector<vertexInfo> vertices;
MFloatPointArray points;
MFloatVectorArray normals;
if (!meshDag.hasFn(MFn::kMesh))
return MS::kFailure;
MFnMesh mesh(meshDag);
/*{
mesh.getPoints(points,MSpace::kWorld);
MPoint pos;
mesh.getPoint(1,pos,MSpace::kWorld);
for(unsigned i = 0;i < points.length();i++)
{
MFloatPoint fp = points[i];
float x = fp.x;
float y = fp.y;
float z = fp.z;
fp = fp;
}
}*/
int numVertices = mesh.numVertices();
vertices.resize(numVertices);
weights.resize(numVertices);
Ids.resize(numVertices);
jointIds.resize(numVertices);
// 获取UV坐标集的名称
MStringArray uvsets;
int numUVSets = mesh.numUVSets();
if (numUVSets > 0)
{
stat = mesh.getUVSetNames(uvsets);
if (MS::kSuccess != stat)
{
std::cout << "Error retrieving UV sets names\n";
return MS::kFailure;
}
}
// 保存UV集信息
for (int i=m_uvsets.size(); i<uvsets.length(); i++)
{
uvset uv;
uv.size = 2;
uv.name = uvsets[i].asChar();
m_uvsets.push_back(uv);
}
MStringArray colorSetsNameArray;
m_colorSets.clear();
int numColorSets = mesh.numColorSets();
if (numColorSets > 0)
{
mesh.getColorSetNames(colorSetsNameArray);
}
for (int i = 0; i != colorSetsNameArray.length(); ++i)
{
std::string name = colorSetsNameArray[i].asChar();
m_colorSets.push_back(name);
}
// 检查法线是否反
bool opposite = false;
mesh.findPlug("opposite",true).getValue(opposite);
// get connected skin cluster (if present)
bool foundSkinCluster = false;
MItDependencyNodes kDepNodeIt( MFn::kSkinClusterFilter );
for( ;!kDepNodeIt.isDone() && !foundSkinCluster; kDepNodeIt.next())
{
MObject kObject = kDepNodeIt.item();
m_pSkinCluster = new MFnSkinCluster(kObject);
unsigned int uiNumGeometries = m_pSkinCluster->numOutputConnections();
for(unsigned int uiGeometry = 0; uiGeometry < uiNumGeometries; ++uiGeometry )
{
unsigned int uiIndex = m_pSkinCluster->indexForOutputConnection(uiGeometry);
MObject kOutputObject = m_pSkinCluster->outputShapeAtIndex(uiIndex);
if(kOutputObject == mesh.object())
{
foundSkinCluster = true;
}
else
{
delete m_pSkinCluster;
m_pSkinCluster = NULL;
}
}
// load connected skeleton (if present)
if (m_pSkinCluster)
{
if (!m_pSkeleton)
m_pSkeleton = new skeleton();
stat = m_pSkeleton->load(m_pSkinCluster);
//.........这里部分代码省略.........