Open Asset Import Library(assimp) 를 이용해서 blender를 읽어오고 openGL로 그릴수 있는 것으로 보인다.
Features
- Reads more than 30 3D file formats, including Collada, X, 3DS, Blend, Obj
- Converts them to a hierarchical in-memory data structure
- Provides 'post-processing steps' to improve the input data, i.e. generate normals and tangents or fix import issues.
- Provides APIs for both C and C++
- Imports skeleton animations and skinning weights
- Supports complex multi-layer materials
- www.open3mod.com/ is an Open-Source viewer that is based off assimp to view models (Windows only)
|
[링크 : https://sourceforge.net/projects/assimp/]
Assimp::Importer importer; const aiScene *scene = importer.ReadFile(filename,aiProcessPreset_TargetRealtime_Fast); aiMesh *mesh = scene->mMeshes[0]; //assuming you only want the first mesh
float *vertexArray; float *normalArray; float *uvArray;
int numVerts; next extract the data
numVerts = mesh->mNumFaces*3;
vertexArray = new float[mesh->mNumFaces*3*3]; normalArray = new float[mesh->mNumFaces*3*3]; uvArray = new float[mesh->mNumFaces*3*2];
for(unsigned int i=0;i<mesh->mNumFaces;i++) { const aiFace& face = mesh->mFaces[i];
for(int j=0;j<3;j++) { aiVector3D uv = mesh->mTextureCoords[0][face.mIndices[j]]; memcpy(uvArray,&uv,sizeof(float)*2); uvArray+=2;
aiVector3D normal = mesh->mNormals[face.mIndices[j]]; memcpy(normalArray,&normal,sizeof(float)*3); normalArray+=3;
aiVector3D pos = mesh->mVertices[face.mIndices[j]]; memcpy(vertexArray,&pos,sizeof(float)*3); vertexArray+=3; } }
uvArray-=mesh->mNumFaces*3*2; normalArray-=mesh->mNumFaces*3*3; vertexArray-=mesh->mNumFaces*3*3; |
[링크 : https://nickthecoder.wordpress.com/2013/01/20/mesh-loading-with-assimp/]
[링크 : https://stackoverflow.com/questions/35111681/make-a-model-in-blender-and-load-in-opengl]