# HG changeset patch # User John Tsiombikas # Date 1345347018 -10800 # Node ID 67ae9fcb802c3ec94ec128e70895a8e929f75978 # Parent 6a650b3b7084a9e5ee6ebaa53426d1090aadd290 loading normal map diff -r 6a650b3b7084 -r 67ae9fcb802c prototype/Makefile --- a/prototype/Makefile Sun Aug 19 05:50:58 2012 +0300 +++ b/prototype/Makefile Sun Aug 19 06:30:18 2012 +0300 @@ -6,7 +6,7 @@ CFLAGS = -pedantic -Wall -g -Ivmath CXXFLAGS = $(CFLAGS) -std=c++11 -LDFLAGS = $(libgl) -lm -lassimp -limago +LDFLAGS = $(libgl) -lm -lassimpD -limago ifeq ($(shell uname -s), Darwin) libgl = -framework OpenGL -framework GLUT -lglew @@ -14,7 +14,7 @@ libgl = -lGL -lGLU -lglut -lGLEW endif -$(bin): $(obj) +$(bin): $(obj) Makefile $(CXX) -o $@ $(obj) $(LDFLAGS) -include $(dep) diff -r 6a650b3b7084 -r 67ae9fcb802c prototype/src/material.cc --- a/prototype/src/material.cc Sun Aug 19 05:50:58 2012 +0300 +++ b/prototype/src/material.cc Sun Aug 19 06:30:18 2012 +0300 @@ -36,18 +36,21 @@ ks *= val; // must match TEXTYPE enum in material.h - unsigned int asstypes[] = { - aiTextureType_DIFFUSE, - aiTextureType_NORMALS, - aiTextureType_SPECULAR + unsigned int asstypes[][2] = { + {aiTextureType_DIFFUSE, 0}, + {aiTextureType_NORMALS, aiTextureType_HEIGHT}, + {aiTextureType_SPECULAR, 0} }; for(int i=0; iget_texture(tex_name.data); - } else { - tex[i] = 0; + for(int j=0; j<2; j++) { + aiString tex_name; + if(asstypes[i][j] > 0 && aiGetMaterialString(assmat, AI_MATKEY_TEXTURE(asstypes[i][j], 0), &tex_name) == 0) { + tex[i] = texset->get_texture(tex_name.data); + break; + } else { + tex[i] = 0; + } } } } diff -r 6a650b3b7084 -r 67ae9fcb802c prototype/src/tile.cc --- a/prototype/src/tile.cc Sun Aug 19 05:50:58 2012 +0300 +++ b/prototype/src/tile.cc Sun Aug 19 06:30:18 2012 +0300 @@ -22,6 +22,9 @@ return false; } + char *saved_fname = (char*)alloca(strlen(fname) + 1); + strcpy(saved_fname, fname); + unsigned int proc_flags = aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType | @@ -39,7 +42,7 @@ load_lights(scn); load_meshes(scn, nodemap); - printf("loaded tile %s: %d meshes, %d lights\n", fname, scn->mNumMeshes, scn->mNumLights); + printf("loaded tile %s: %d meshes, %d lights\n", saved_fname, scn->mNumMeshes, scn->mNumLights); return true; }