//start the frame // Pass true for zbuffer_flag to turn on zbuffering void g3_start_frame_func(int zbuffer_flag, char * filename, int lineno) { float s; int width, height; float aspect; //Uncomment this to figure out who called g3_start_frame without calling g3_end_frame. // mprintf(( "g3_start_frame called from %s, line %d\n", filename, lineno )); Assert( G3_count == 0 ); G3_count++; // Clear any user-defined clip planes g3_stop_user_clip_plane(); // Get the values from the 2d... width = gr_screen.clip_width; height = gr_screen.clip_height; aspect = gr_screen.aspect; //set int w,h & fixed-point w,h/2 Canvas_width = width; Canv_w2 = (float)width / 2.0f; Canvas_height = height; Canv_h2 = (float)height / 2.0f; //compute aspect ratio for this canvas s = aspect*(float)Canvas_height/(float)Canvas_width; if (s <= 0) { //scale x Window_scale.xyz.x = s; Window_scale.xyz.y = 1.0f; } else { Window_scale.xyz.y = 1.0f / s; Window_scale.xyz.x = 1.0f; } Window_scale.xyz.z = 1.0f; //always 1 init_free_points(); if (zbuffer_flag) { gr_zbuffer_clear(TRUE); } else { gr_zbuffer_clear(FALSE); } G3_frame_count++; //init_interface_vars_to_assembler(); //for the texture-mapper }
void gr_opengl_post_process_save_zbuffer() { if (Post_initialized) { glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, Cockpit_depth_texture, 0); gr_zbuffer_clear(TRUE); zbuffer_saved = true; } else { // If we can't save the z-buffer then just clear it so cockpits are still rendered correctly when // post-processing isn't available/enabled. gr_zbuffer_clear(TRUE); } }
/** * Start the frame * Pass true for zbuffer_flag to turn on zbuffering */ void g3_start_frame_func(int zbuffer_flag, const char *filename, int lineno) { float s; int width, height; float aspect; Assert( G3_count == 0 ); G3_count++; // Clear any user-defined clip planes g3_stop_user_clip_plane(); // Get the values from the 2d... width = gr_screen.clip_width; height = gr_screen.clip_height; aspect = gr_screen.aspect; //set int w,h & fixed-point w,h/2 Canvas_width = width; Canv_w2 = (float)width / 2.0f; Canvas_height = height; Canv_h2 = (float)height / 2.0f; //compute aspect ratio for this canvas s = aspect*(float)Canvas_height/(float)Canvas_width; if ( !Cmdline_nohtl || (s <= 0.0f) ) { //scale x Window_scale.xyz.x = s; Window_scale.xyz.y = 1.0f; } else { Window_scale.xyz.y = 1.0f / s; Window_scale.xyz.x = 1.0f; } Window_scale.xyz.z = 1.0f; //always 1 init_free_points(); if (zbuffer_flag) { gr_zbuffer_clear(TRUE); } else { gr_zbuffer_clear(FALSE); } G3_frame_count++; }
// Play one movie bool movie_play(char *name) { // mark the movie as viewable to the player when in a campaign // do this before anything else so that we're sure the movie is available // to the player even if it's not going to play right now if (Game_mode & GM_CAMPAIGN_MODE) { cutscene_mark_viewable(name); } extern int Mouse_hidden; extern int Is_standalone; if (Cmdline_nomovies || Is_standalone) return false; char full_name[MAX_PATH]; int rc = 0; memset(full_name, 0, sizeof(full_name)); rc = movie_find(name, full_name); if (rc == MOVIE_NONE) { strcpy_s(full_name, name); char *p = strrchr(full_name, '.'); if ( p ) *p = 0; mprintf(("Movie Error: Unable to open '%s' movie in any supported format.\n", full_name)); return false; } // clear the screen and hide the mouse cursor Mouse_hidden++; gr_reset_clip(); gr_set_color(255, 255, 255); gr_set_clear_color(0, 0, 0); gr_zbuffer_clear(0); // clear first buffer gr_clear(); gr_flip(); // clear second buffer (may not be one, but that's ok) gr_clear(); gr_flip(); // clear third buffer (may not be one, but that's ok) gr_clear(); if (rc == MOVIE_OGG) { THEORAFILE *movie_ogg = theora_open(name); if (movie_ogg) { // start playing ... theora_play(movie_ogg); // ... done playing, close the movie theora_close(movie_ogg); } else { // uh-oh, movie is invalid... Abory, Retry, Fail? mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name)); Mouse_hidden--; // show the mouse cursor! return false; } } else if (rc == MOVIE_MVE) { MVESTREAM *movie_mve = mve_open(name); if (movie_mve) { // start playing ... mve_init(movie_mve); mve_play(movie_mve); // ... done playing, close the movie mve_shutdown(); mve_close(movie_mve); } else { // uh-oh, movie is invalid... Abory, Retry, Fail? mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name)); Mouse_hidden--; // show the mouse cursor! return false; } } // show the mouse cursor again Mouse_hidden--; return true; }