本文整理汇总了C++中ofMesh::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ ofMesh::setName方法的具体用法?C++ ofMesh::setName怎么用?C++ ofMesh::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofMesh
的用法示例。
在下文中一共展示了ofMesh::setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aiMeshToOfMesh
//--------------------------------------------------------------
static void aiMeshToOfMesh(const aiMesh* aim, ofMesh& ofm, ofxAssimpMeshHelper * helper = NULL){
// default to triangle mode
ofm.setMode(OF_PRIMITIVE_TRIANGLES);
// copy vertices
for (int i=0; i < (int)aim->mNumVertices;i++){
ofm.addVertex(ofVec3f(aim->mVertices[i].x,aim->mVertices[i].y,aim->mVertices[i].z));
}
if(aim->HasNormals()){
for (int i=0; i < (int)aim->mNumVertices;i++){
ofm.addNormal(ofVec3f(aim->mNormals[i].x,aim->mNormals[i].y,aim->mNormals[i].z));
}
}
// aiVector3D * mTextureCoords [AI_MAX_NUMBER_OF_TEXTURECOORDS]
// just one for now
if(aim->GetNumUVChannels()>0){
for (int i=0; i < (int)aim->mNumVertices;i++){
if( helper != NULL && helper->texture.getWidth() > 0.0 ){
ofVec2f texCoord = helper->texture.getCoordFromPercent(aim->mTextureCoords[0][i].x ,aim->mTextureCoords[0][i].y);
ofm.addTexCoord(texCoord);
}else{
ofm.addTexCoord(ofVec2f(aim->mTextureCoords[0][i].x ,aim->mTextureCoords[0][i].y));
}
}
}
//aiColor4D * mColors [AI_MAX_NUMBER_OF_COLOR_SETS]
// just one for now
if(aim->GetNumColorChannels()>0){
for (int i=0; i < (int)aim->mNumVertices;i++){
ofm.addColor(aiColorToOfColor(aim->mColors[0][i]));
}
}
for (int i=0; i <(int) aim->mNumFaces;i++){
if(aim->mFaces[i].mNumIndices>3){
ofLog(OF_LOG_WARNING,"non-triangular face found: model face # " + ofToString(i));
}
for (int j=0; j<(int)aim->mFaces[i].mNumIndices; j++){
ofm.addIndex(aim->mFaces[i].mIndices[j]);
}
}
ofm.setName(string(aim->mName.data));
// ofm.materialId = aim->mMaterialIndex;
}