示例#1
0
文件: view_draw.c 项目: rzel/dim3
void view_draw_dim3rtl(void)
{
    obj_type		*obj,*camera_obj;
    weapon_type		*weap;

    // get player object and held weapon

    obj=server.obj_list.objs[server.player_obj_idx];
    weap=weapon_find_current(obj);

    // use the camera render

    view.render=&view_camera_render;

    // set view camera

    camera_view_draw_run();

    camera_obj=server.obj_list.objs[camera.obj_idx];
    memmove(&view.render->camera.pnt,&camera.cur_pos.pnt,sizeof(d3pnt));
    memmove(&view.render->camera.ang,&camera.cur_pos.ang,sizeof(d3ang));

    view.render->camera.fov=map.camera.plane.fov;
    view.render->camera.flip=FALSE;
    view.render->camera.under_liquid_idx=camera_check_liquid(obj,&view.render->camera.pnt);

    view.render->cull_idx=0;
    view.render->force_camera_obj=FALSE;

    // camera adjustments

    if (map.camera.camera_mode==cv_fpp) {
        view_calculate_scope(obj,camera_obj);
        view_calculate_recoil(obj);
    }

    view_calculate_shakes(obj);
    view_calculate_sways(obj);

    // build the scene

    view_draw_dim3rtl_scene_build();

    // we setup the 2D elements before
    // rendering because we get the last
    // frame so we want to use the last
    // frames eye point

    label_draw_setup();
    halo_draw_setup();

    if ((obj!=NULL) && (weap!=NULL)) {
        crosshair_setup(obj,weap);
        zoom_setup(obj,weap);
    }

    // dim3rtl rendering

    view_dim3rtl_render();

    // draw 2D opengl elements

    gl_2D_view_screen();

    label_draw_render();
    halo_draw_render();

    if (!view.cinema.on) {
        if ((obj!=NULL) && (weap!=NULL)) {
            crosshair_draw(obj,weap);
            zoom_draw(obj,weap);
        }
    }

    // draw tints and fades

    view_draw_liquid_tint(view.render->camera.under_liquid_idx);
    view_draw_effect_tint();
    view_fade_draw();
}
示例#2
0
文件: view_draw.c 项目: prophile/dim3
void view_draw_scene_render(int tick,obj_type *obj,weapon_type *weap)
{
		// setup projection

	gl_3D_view();
	gl_3D_rotate(&view.render->camera.pnt,&view.render->camera.ang);
	gl_setup_project();

		// draw background and sky
		// unless obscured by fog
	
	if (!fog_solid_on()) {
		draw_background();
		draw_sky(tick);
	}
	else {
		fog_solid_start();
	}

		// setup per-scene shader variables

	gl_shader_draw_scene_initialize();

		// compile meshes for drawing
	
	if (!view_compile_mesh_gl_lists(tick)) return;

		// setup some map polygon drawing flags

	render_map_setup();

		// draw opaque scene items

	render_map_mesh_opaque();
	render_map_liquid_opaque(tick);
	view_draw_model_opaque(tick);
	
		// additional mesh and model drawing
		// shadows, remote names, etc

	view_draw_mesh_shadows();
	view_draw_models_final();
	
		// draw transparent scene items

	render_map_mesh_transparent();
	view_draw_model_transparent(tick);
	render_map_liquid_transparent(tick);

		// draw decals

	decal_render();

		// effects

	effect_draw(tick);
	
		// draw rain
		
	rain_draw(tick);

		// draw fog

	fog_draw_textured(tick);
	
	if (fog_solid_on()) fog_solid_end();
	
		// setup halos, crosshairs, zoom masks
		
	remote_draw_names_setup();
	halo_draw_setup();
	
	if ((obj!=NULL) && (weap!=NULL)) {
		crosshair_setup(tick,obj,weap);
		zoom_setup(tick,obj,weap);
	
			// draw the weapons in hand

		if (camera.mode==cv_fpp) draw_weapon_hand(tick,obj,weap);
	}

		// draw the remote names, halos, crosshairs, and zoom masks
	
	remote_draw_names_render();
	halo_draw_render();
	
	if ((obj!=NULL) && (weap!=NULL)) {
		crosshair_draw(obj,weap);
		zoom_draw(obj,weap);
	}
}