# HG changeset patch # User John Tsiombikas # Date 1346030044 -10800 # Node ID ddb68dc4ba074df469b83a781115857f9a5383f5 # Parent 938a6a155c9470f651e1a0b5b0acdb36c4e5258b OBJ hack diff -r 938a6a155c94 -r ddb68dc4ba07 prototype/src/material.cc --- a/prototype/src/material.cc Mon Aug 27 04:03:22 2012 +0300 +++ b/prototype/src/material.cc Mon Aug 27 04:14:04 2012 +0300 @@ -4,6 +4,8 @@ #include "opengl.h" #include "material.h" +extern bool ass_obj_hack; + Material::Material() : kd(1.0, 1.0, 1.0), ks(0.0, 0.0, 0.0) { @@ -24,11 +26,10 @@ unsigned int sz = 1; val = 60.0; aiGetMaterialFloatArray(assmat, AI_MATKEY_SHININESS, &val, &sz); - if(val > 127) { - fprintf(stderr, "Warning: shininess %f... setting to 127\n", val); - val = 127; + if(ass_obj_hack) { + val /= 4.0; } - shin = val; + shin = val > 127 ? 127 : val; sz = 1; val = 1.0; diff -r 938a6a155c94 -r ddb68dc4ba07 prototype/src/tile.cc --- a/prototype/src/tile.cc Mon Aug 27 04:03:22 2012 +0300 +++ b/prototype/src/tile.cc Mon Aug 27 04:14:04 2012 +0300 @@ -12,6 +12,8 @@ static void build_nodemap(map *nmap, const aiScene *scn, aiNode *node); static PointLight *mesh_to_light(Mesh *m); +bool ass_obj_hack; + Tile::Tile(TileSet *tileset) { tset = tileset; @@ -40,6 +42,12 @@ map nodemap; build_nodemap(&nodemap, scn, scn->mRootNode); + if(strstr(fname, ".obj") == fname + strlen(fname) - 4) { + ass_obj_hack = true; + } else { + ass_obj_hack = false; + } + //load_lights(scn); load_meshes(scn, nodemap);