//------------------------------------------- ofMesh ofxAssimpModelLoader::getCurrentAnimatedMesh(int num){ if((int)modelMeshes.size()<=num){ ofLog(OF_LOG_ERROR,"couldn't find mesh " + ofToString(num) + " there's only " + ofToString(scene->mNumMeshes)); return ofMesh(); } if(!modelMeshes[num].validCache){ modelMeshes[num].cachedMesh.clearVertices(); modelMeshes[num].cachedMesh.clearNormals(); modelMeshes[num].cachedMesh.addVertices(aiVecVecToOfVecVec(modelMeshes[num].animatedPos)); modelMeshes[num].cachedMesh.addNormals(aiVecVecToOfVecVec(modelMeshes[num].animatedNorm)); modelMeshes[num].validCache = true; } return modelMeshes[num].cachedMesh; }
//------------------------------------------- ofMesh ofxAssimpModelLoader::getCurrentAnimatedMesh(int num){ if((int)modelMeshes.size()<=num){ ofLogError("ofxAssimpModelLoader") << "getCurrentAnimatedMesh(): mesh id: " << num << "out of range for total num meshes: " << scene->mNumMeshes; return ofMesh(); } if(!modelMeshes[num].validCache){ modelMeshes[num].cachedMesh.clearVertices(); modelMeshes[num].cachedMesh.clearNormals(); modelMeshes[num].cachedMesh.addVertices(aiVecVecToOfVecVec(modelMeshes[num].animatedPos)); modelMeshes[num].cachedMesh.addNormals(aiVecVecToOfVecVec(modelMeshes[num].animatedNorm)); modelMeshes[num].validCache = true; } return modelMeshes[num].cachedMesh; }
//------------------------------------------- ofMesh ofxAssimpModelLoader::getCurrentAnimatedMesh(string name){ for(int i=0; i<(int)modelMeshes.size(); i++){ if(string(modelMeshes[i].mesh->mName.data)==name){ if(!modelMeshes[i].validCache){ modelMeshes[i].cachedMesh.clearVertices(); modelMeshes[i].cachedMesh.clearNormals(); modelMeshes[i].cachedMesh.addVertices(aiVecVecToOfVecVec(modelMeshes[i].animatedPos)); modelMeshes[i].cachedMesh.addNormals(aiVecVecToOfVecVec(modelMeshes[i].animatedNorm)); modelMeshes[i].validCache = true; } return modelMeshes[i].cachedMesh; } } ofLogError("ofxAssimpModelLoader") << "getCurrentAnimatedMesh(): couldn't find mesh: \"" + name << "\""; return ofMesh(); }