本文整理汇总了C++中assimp::Importer::GetOrphanedScene方法的典型用法代码示例。如果您正苦于以下问题:C++ Importer::GetOrphanedScene方法的具体用法?C++ Importer::GetOrphanedScene怎么用?C++ Importer::GetOrphanedScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assimp::Importer
的用法示例。
在下文中一共展示了Importer::GetOrphanedScene方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
Scene::Scene(int argc, char ** argv)
{
dist = -6.0f;
Assimp::Importer importer;
(importer.ReadFile( "C:\\Users\\abrajoe\\Documents\\Visual Studio 2010\\Projects\\Piano-Scene\\Debug\\lung.blend",
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType));
scene = importer.GetOrphanedScene();
// If the import failed, report it
if( !scene)
{
printf( importer.GetErrorString());
return;
}
glutInit(&argc, argv);
dir = argv[0];
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutInitWindowPosition(0, 0);
window = glutCreateWindow("foo");
glutDisplayFunc(&display);
glutReshapeFunc(&resize);
glutKeyboardFunc(&keyPressed);
}
示例2: import_from_file
bool mesh::import_from_file(const std::string& filepath) {
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(filepath,
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_GenNormals |
aiProcess_PreTransformVertices | // TODO: figure out the node graph
aiProcess_FixInfacingNormals |
aiProcess_FindDegenerates
);
if(!scene)
{
std::cerr << importer.GetErrorString() << std::endl;
return false;
}
this->scene = importer.GetOrphanedScene();
if (scene->mNumMeshes != 1){
std::cerr << "Scene contains does not contain exactly one mesh(" << scene->mNumMeshes << ")." << std::endl;
return false;
}
return true;
}
示例3: LoadModel
/**
* Load an MD2 model from file.
*
* Note: MD2 format stores model's data in little-endian ordering. On
* big-endian machines, you'll have to perform proper conversions.
*
* @params filename the name of the model to be loaded
* @params TransformationMatrix a Matrix with all the transformations to be made to the model
*
*/
void DynamicModelLoader::LoadModel(const char *filename, const glm::mat4 &TransformationMatrix)
{
cout << "Loading " << filename << endl;
Assimp::Importer importer;
// Read file via ASSIMP
importer.ReadFile(filename, aiProcess_Triangulate | aiProcess_FlipUVs | aiProcess_GenSmoothNormals);
scene = importer.GetOrphanedScene();
// Check for errors
if (!scene || scene->mFlags == AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero
{
cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << endl;
return;
}
string pFile = filename;
// Retrieve the directory path of the filepath
m_directory = pFile.substr(0, pFile.find_last_of('/'));
m_userTransform = TransformationMatrix;
m_GlobalInverseTransform = aiMatrix4x4ToGlm(scene->mRootNode->mTransformation);
m_GlobalInverseTransform = glm::inverse(m_GlobalInverseTransform);
// Process ASSIMP's root node recursively
ProcessNode(scene->mRootNode, scene, glm::mat4(1.0f));
//init Vertex buffer object with the information
for (GLuint i = 0; i < m_vMeshes.size(); ++i) m_vMeshes[i].setupMesh();
//popullate the auxiliar array of transformations
for (GLuint i = 0; i < m_originalBoneTransform.size(); ++i){
glm::mat4 m = glm::mat4(1.0f);
m_finalBoneTransforms.push_back(m);
}
}