- return Vec3(v[0], v[1], v[2]);
-}
-
-static Quat assimp_quat(const aiQuaternion &q)
-{
- return Quat(q.x, q.y, q.z, q.w);
-}
-
-static Mat4 assimp_matrix(const aiMatrix4x4 &aim)
-{
- Mat4 m;
- memcpy(m[0], &aim, 16 * sizeof(float));
- m.transpose();
- return m;
-}
-
-/* convert an assimp keyframe time (ticks) into milliseconds */
-static long assimp_time(const aiAnimation *anim, double aitime)
-{
- double sec;
- if(anim->mTicksPerSecond < 1e-6) {
- // assume time is in frames?
- sec = aitime / 30.0;
- } else {
- sec = aitime / anim->mTicksPerSecond;
- }
- return (long)(sec * 1000.0);
-}
-
-static void print_hierarchy(const aiNode *node)
-{
- static int lvl;
- static int lvlopen[256];
-
- for(int i=0; i<lvl; i++) {
- putchar(' ');
- if(lvlopen[i]) {
- putchar(i >= lvl - 1 ? '+' : '|');
- } else {
- putchar(i >= lvl - 1 ? '+' : ' ');
- }
- }
- printf("- \"%s\"\n", node->mName.data);
-
- lvlopen[lvl] = 1;
-
- lvl++;
- for(unsigned int i=0; i<node->mNumChildren; i++) {
- if(i == node->mNumChildren - 1) {
- lvlopen[lvl - 1] = 0;
- }
- print_hierarchy(node->mChildren[i]);
+ switch(type) {
+ case aiTextureType_DIFFUSE:
+ return MTL_TEX_DIFFUSE;
+ case aiTextureType_SPECULAR:
+ return MTL_TEX_SPECULAR;
+ case aiTextureType_NORMALS:
+ return MTL_TEX_NORMALMAP;
+ case aiTextureType_LIGHTMAP:
+ return MTL_TEX_LIGHTMAP;
+ case aiTextureType_REFLECTION:
+ return MTL_TEX_ENVMAP;
+ default:
+ break;