示例#1
0
//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

}
示例#2
0
/**
 * 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++;
}