-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.h
27 lines (26 loc) · 966 Bytes
/
demo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
model_t model(const char* filename, int flags) {
int aiFlags = 0
//| aiProcess_FlipUVs
| aiProcessPreset_TargetRealtime_MaxQuality
//| aiProcessPreset_TargetRealtime_Quality
//| aiProcessPreset_TargetRealtime_Fast
//| aiProcess_ConvertToLeftHanded // D3D
| aiProcess_LimitBoneWeights //(4, defined as AI_LMW_MAX_WEIGHTS in config.h)
| aiProcess_JoinIdenticalVertices
| aiProcess_RemoveRedundantMaterials
| aiProcess_ImproveCacheLocality
| aiProcess_OptimizeGraph
| aiProcess_OptimizeMeshes
| aiProcess_SplitLargeMeshes;
model_t mo = {0};
const struct aiScene* scene = aiImportFile(filename, flags);
if( scene ) {
mo.mesh = REALLOC(0, sizeof(mesh_t) * (mo.mesh_count = scene->mNumMeshes) );
for( int i = 0; i < mo.mesh_count; ++i ) {
const struct aiMesh* m = scene->mMeshes[i];
mo.mesh[i] = mesh(m, flags);
}
aiReleaseImport(scene);
}
return mo;
}