# HG changeset patch # User John Tsiombikas # Date 1346191441 -10800 # Node ID 84a56fb2485052262efcc00228ede95ff42e75e9 # Parent 80dab40004134d39e3b11ff45eca94f0118f99ac fuck that uninitialized variable diff -r 80dab4000413 -r 84a56fb24850 prototype/data/deftile.mtl --- a/prototype/data/deftile.mtl Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/data/deftile.mtl Wed Aug 29 01:04:01 2012 +0300 @@ -31,6 +31,7 @@ d 1.000000 illum 2 map_Kd /home/nuclear/3ddata/dung_crawl_prot/rustiron.jpg +map_Bump /home/nuclear/3ddata/dung_crawl_prot/stonewall_normal.jpg newmtl wall_material_stonewall_diffuse.jpg diff -r 80dab4000413 -r 84a56fb24850 prototype/data/test.level --- a/prototype/data/test.level Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/data/test.level Wed Aug 29 01:04:01 2012 +0300 @@ -17,6 +17,7 @@ ################################################################ ################################################################ ################################################################ +############################### ################################ ################################################################ ################################################################ ################################################################ @@ -29,8 +30,8 @@ ################################################################ ################################################################ ################################################################ +################################ ############# ################# ################################################################ -################################ ############################### ################################################################ ################################################################ ################################################################ @@ -62,4 +63,3 @@ ################################################################ ################################################################ ################################################################ -################################################################ diff -r 80dab4000413 -r 84a56fb24850 prototype/sdr/mrt.p.glsl --- a/prototype/sdr/mrt.p.glsl Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/sdr/mrt.p.glsl Wed Aug 29 01:04:01 2012 +0300 @@ -25,7 +25,7 @@ // grab normal from the normal map, remap it and transform it to view space n = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0; - n = tbn_mat * normalize(n); + n = normalize(tbn_mat * n); float fog = clamp((fog_end + pos.z) / (fog_end - fog_start), 0.0, 1.0); diff -r 80dab4000413 -r 84a56fb24850 prototype/src/mesh.cc --- a/prototype/src/mesh.cc Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/src/mesh.cc Wed Aug 29 01:04:01 2012 +0300 @@ -16,6 +16,8 @@ } ibo = 0; tang_loc = -1; + + bsph_valid = false; } Mesh::~Mesh() @@ -35,6 +37,11 @@ bool Mesh::create(const aiScene *scn, aiMesh *aim) { + if(aim->mPrimitiveTypes != aiPrimitiveType_TRIANGLE) { + fprintf(stderr, "%s: non-triangle mesh!? primtype mask: %x\n", __func__, aim->mPrimitiveTypes); + return false; + } + if(vbo[MESH_ATTR_VERTEX]) { destroy(); } @@ -66,7 +73,7 @@ glGenBuffers(1, &ibo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, nfaces * 3 * sizeof *aim->mFaces[0].mIndices, 0, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, nfaces * 3 * sizeof(unsigned int), 0, GL_STATIC_DRAW); /* map the buffer and fill it up */ unsigned int *iptr = (unsigned int*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); diff -r 80dab4000413 -r 84a56fb24850 prototype/src/renderer.cc --- a/prototype/src/renderer.cc Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/src/renderer.cc Wed Aug 29 01:04:01 2012 +0300 @@ -12,7 +12,7 @@ #undef DBG_VIS_MRT #ifdef DBG_VIS_MRT -static void deferred_debug(); +static void draw_deferred_debug(); #endif static bool create_fbo(int xsz, int ysz); @@ -154,7 +154,7 @@ glBindFramebufferEXT(GL_FRAMEBUFFER, 0); #ifdef DBG_VIS_MRT - deferred_debug(); + draw_deferred_debug(); #else // post-process lighting @@ -280,7 +280,7 @@ #ifdef DBG_VIS_MRT // visualize the MRT buffers -static void deferred_debug() +static void draw_deferred_debug() { glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT); glUseProgram(deferred_debug); diff -r 80dab4000413 -r 84a56fb24850 prototype/src/tile.cc --- a/prototype/src/tile.cc Tue Aug 28 06:36:20 2012 +0300 +++ b/prototype/src/tile.cc Wed Aug 29 01:04:01 2012 +0300 @@ -119,6 +119,11 @@ } for(int i=0; i<(int)scn->mNumMeshes; i++) { + // ignore any lines or other crap + if(scn->mMeshes[i]->mPrimitiveTypes != aiPrimitiveType_TRIANGLE) { + continue; + } + Mesh *mesh = new Mesh; if(!mesh->create(scn, scn->mMeshes[i])) { delete mesh;