/* This code is actually by Scott, based on Zaza's Maya object files. */ /* The table's raw bounding box is (-3.53, 3.75, 0.10,12.32,-3.64, 3.65) so it's about 7 units in diameter and 12 units high, but y goes from 0 to 12. */ void zkabayadTable(bool printBB) { // The following variable must be declared static, so that it doesn't // get reset to NULL every time the function is called, since this is // how we avoid reloading the OBJ file every single time. static GLMmodel* table = NULL; // the model object const char* obj_filename = "zkabayad-table.obj"; // lives in $TWHOMEDIR/objects if(NULL==table) { table = glmReadOBJ(twPathname(obj_filename,true)); if (!table) { fprintf(stderr,"error reading OBJ file %s\n",obj_filename); return; } if(printBB) { GLfloat BoundingBox[6]; // [minx,maxx,miny,maxy,minz,maxz] glmBoundingBox(table,BoundingBox); printf("Bounding Box is (%f,%f,%f,%f,%f,%f)\n", BoundingBox[0], BoundingBox[1], BoundingBox[2], BoundingBox[3], BoundingBox[4], BoundingBox[5]); } // Finish initialization glmFacetNormals(table); glmVertexNormals(table, 90.0); } // Now the actual drawing code, which is always executed glmDraw(table, GLM_SMOOTH | GLM_MATERIAL); } /* Bounding Box is (-5.01, 3.61,-9.77,26.14,-12.33,14.72) So it's about 8.6 units long, 35 units high, and 27 units deep. This object is unitized, though, so in practice it is 2 units high (on the y-axis), half a unit wide (on the x-axis) and 1.5 units deep (on z axis). */ void zkabayadSax(bool printBB) { // The following variable must be declared static, so that it doesn't // get reset to NULL every time the function is called, since this is // how we avoid reloading the OBJ file every single time. static GLMmodel* sax = NULL; // the model object const char* obj_filename = "zkabayad-sax.obj"; // lives in $TWHOMEDIR/objects if(NULL==sax) { sax = glmReadOBJ(twPathname(obj_filename,true)); if (!sax) { fprintf(stderr,"error reading OBJ file %s\n",obj_filename); return; } // Since it is taller than it is wide or deep, we know that it'll be 2 // units high after unitizing, with origin at the center. glmUnitize(sax); // It makes sense to delay printing the BB until after we've // rescaled the object. if(printBB) { GLfloat BoundingBox[6]; // [minx,maxx,miny,maxy,minz,maxz] glmBoundingBox(sax,BoundingBox); printf("Bounding Box is (%f,%f,%f,%f,%f,%f)\n", BoundingBox[0], BoundingBox[1], BoundingBox[2], BoundingBox[3], BoundingBox[4], BoundingBox[5]); } // Finish initialization glmFacetNormals(sax); glmVertexNormals(sax, 90.0); } // Now the actual drawing code, which is always executed glmDraw(sax, GLM_SMOOTH | GLM_MATERIAL); }