render_external_scene(fix eye_offset) { Viewer_eye = Viewer->pos; if (eye_offset) vm_vec_scale_add2(&Viewer_eye,&Viewer->orient.rvec,eye_offset); g3_set_view_matrix(&Viewer->pos,&Viewer->orient,Render_zoom); //g3_draw_horizon(BM_XRGB(0,0,0),BM_XRGB(16,16,16)); //,-1); gr_clear_canvas(BM_XRGB(0,0,0)); g3_start_instance_matrix(&vmd_zero_vector,&surface_orient); draw_stars(); g3_done_instance(); { //draw satellite vms_vector delta; g3s_point p,top_pnt; g3_rotate_point(&p,&satellite_pos); g3_rotate_delta_vec(&delta,&satellite_upvec); g3_add_delta_vec(&top_pnt,&p,&delta); if (! (p.p3_codes & CC_BEHIND)) { int save_im = Interpolation_method; //p.p3_flags &= ~PF_PROJECTED; //g3_project_point(&p); if (! (p.p3_flags & PF_OVERFLOW)) { Interpolation_method = 0; //gr_bitmapm(f2i(p.p3_sx)-32,f2i(p.p3_sy)-32,satellite_bitmap); g3_draw_rod_tmap(satellite_bitmap,&p,SATELLITE_WIDTH,&top_pnt,SATELLITE_WIDTH,f1_0); Interpolation_method = save_im; } } } #ifdef STATION_ENABLED draw_polygon_model(&station_pos,&vmd_identity_matrix,NULL,station_modelnum,0,f1_0,NULL,NULL); #endif render_terrain(&mine_ground_exit_point,exit_point_bmx,exit_point_bmy); draw_exit_model(); if (ext_expl_playing) draw_fireball(&external_explosion); Lighting_on=0; render_object(ConsoleObject); Lighting_on=1; }
// Render the terrain as wireframe void terrain::render_wireframe_terrain() { // Set the line width to be 1 pixel glLineWidth(1.0); // Set the draw mode to draw outlines of polygons glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // Set the color to black glColor3d(0, 0, 0); // Render the terrain render_terrain(); // Set the draw mode to fill polygons glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); }
// Render the terrain as solid void terrain::render_solid_terrain() { // Enable lighting glEnable(GL_LIGHTING); // This is a trick which is neccessary in order to draw lines // later on. Otherwise there would be artifacts due to a z-fight. glPolygonOffset(1, 1); glEnable(GL_POLYGON_OFFSET_FILL); /******** Task 2.2.4. Activate 2D texture mapping and bind the texture that is identified by the handle "texture_handle". Do not remove any of the code in this method. Aufgabe 2.2.4. Aktivieren Sie 2D-Texturierung und binden Sie die Textur, die ueber das Handle "texture_handle" identifiziert ist. Entfernen Sie keinen Code in dieser Methode. ************/ // Set the material color to white glColor3d(1, 1, 1); // Render the terrain render_terrain(); // Disable texture mapping glDisable(GL_TEXTURE_2D); // Disable support for depth buffer offsets glDisable(GL_POLYGON_OFFSET_FILL); // Disable lighting glDisable(GL_LIGHTING); }