---------------------------------------------------------------------------- */
| 296 | |
| 297 | /* ---------------------------------------------------------------------------- */ |
| 298 | void display(void) |
| 299 | { |
| 300 | float tmp; |
| 301 | |
| 302 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 303 | |
| 304 | glMatrixMode(GL_MODELVIEW); |
| 305 | glLoadIdentity(); |
| 306 | gluLookAt(0.f,0.f,3.f,0.f,0.f,-5.f,0.f,1.f,0.f); |
| 307 | |
| 308 | /* rotate it around the y axis */ |
| 309 | glRotatef(angle,0.f,1.f,0.f); |
| 310 | |
| 311 | /* scale the whole asset to fit into our view frustum */ |
| 312 | tmp = scene_max.x-scene_min.x; |
| 313 | tmp = aisgl_max(scene_max.y - scene_min.y,tmp); |
| 314 | tmp = aisgl_max(scene_max.z - scene_min.z,tmp); |
| 315 | tmp = 1.f / tmp; |
| 316 | glScalef(tmp, tmp, tmp); |
| 317 | |
| 318 | /* center the model */ |
| 319 | glTranslatef( -scene_center.x, -scene_center.y, -scene_center.z ); |
| 320 | |
| 321 | /* if the display list has not been made yet, create a new one and |
| 322 | fill it with scene contents */ |
| 323 | if(scene_list == 0) { |
| 324 | scene_list = glGenLists(1); |
| 325 | glNewList(scene_list, GL_COMPILE); |
| 326 | /* now begin at the root node of the imported data and traverse |
| 327 | the scenegraph by multiplying subsequent local transforms |
| 328 | together on GL's matrix stack. */ |
| 329 | recursive_render(scene, scene->mRootNode); |
| 330 | glEndList(); |
| 331 | } |
| 332 | |
| 333 | glCallList(scene_list); |
| 334 | |
| 335 | glutSwapBuffers(); |
| 336 | |
| 337 | do_motion(); |
| 338 | } |
| 339 | |
| 340 | /* ---------------------------------------------------------------------------- */ |
| 341 | int loadasset (const char* path) |
nothing calls this directly
no test coverage detected