示例#1
0
文件: su_draw.c 项目: Comanche93/eech
static void draw_local_3d_object (entity *en, float range)
{
	site_updatable
		*raw;

	object_3d_instance
		*inst3d;

	vec3d
		face_normal;

	day_segment_types
		day_segment_type;

	raw = (site_updatable *) get_local_entity_data (en);

	inst3d = construct_temporary_3d_object (raw->fix.object_3d_shape, raw->fix.alive);

	if (inst3d)
	{
		if (raw->fix.alive)
		{
			animate_site_radar (en, inst3d);

			animate_site_loading_doors (en, inst3d);
		}

		memcpy (&inst3d->vp.position, &raw->fix.position, sizeof (vec3d));

		if (fixed_database[raw->fix.sub_type].align_with_terrain)
		{
			get_3d_terrain_face_normal (&face_normal, raw->fix.position.x, raw->fix.position.z);

			get_3d_transformation_matrix_from_face_normal_and_heading (inst3d->vp.attitude, &face_normal, raw->fix.heading);
		}
		else
		{
			get_3d_transformation_matrix (inst3d->vp.attitude, raw->fix.heading, 0.0, 0.0);
		}

		day_segment_type = (day_segment_types) get_local_entity_int_value (get_session_entity (), INT_TYPE_DAY_SEGMENT_TYPE);

		inst3d->object_sprite_lights = ((day_segment_type == DAY_SEGMENT_TYPE_NIGHT) || (day_segment_type == DAY_SEGMENT_TYPE_DUSK));

		inst3d->object_has_shadow = FALSE;

		insert_object_into_3d_scene (OBJECT_3D_DRAW_TYPE_OBJECT, inst3d);
	}
}
示例#2
0
void draw_local_city_building_object (entity *en, float range)
{

	city_building
		*raw;

	object_3d_instance
		*inst3d;

	vec3d
		face_normal;

	raw = get_local_entity_data (en);

	if ( range < object_3d_information_database[raw->fix.object_3d_shape].maximum_distance )
	{

		inst3d = construct_temporary_3d_object (raw->fix.object_3d_shape, FALSE);

		if (inst3d)
		{
			memcpy (&inst3d->vp.position, &raw->fix.position, sizeof (vec3d));

			if (fixed_database[raw->fix.sub_type].align_with_terrain)
			{
				get_3d_terrain_face_normal (&face_normal, raw->fix.position.x, raw->fix.position.z);

				get_3d_transformation_matrix_from_face_normal_and_heading (inst3d->vp.attitude, &face_normal, raw->fix.heading);
			}
			else
			{
				get_3d_transformation_heading_matrix (inst3d->vp.attitude, raw->fix.heading);
			}

			inst3d->object_has_shadow = FALSE;
	
			insert_object_into_3d_scene (OBJECT_3D_DRAW_TYPE_OBJECT, inst3d);
		}
	}
}