Exemple #1
0
void updatePointsPos()
{
    // transform 3D point
    M3D_transform(&transformation, cube_coord, pts_3D, 8);
    // project 3D point (f16) to 2D point (s16)
    M3D_project_s16(pts_3D, pts_2D, 8);
}
void RSE_Logo3DScreen(void)
{
	u16 zsort_switch;

	const Vect3D_f16 *mesh_coord;
	const short *mesh_poly_ind;
	const u16 *mesh_line_ind;
	const Vect3D_f16 *mesh_face_norm;
	u16 vtx_count;
	u16 poly_count;

	u16 logo_state;

	/* Full white palette */
	const u16 palette_white[] = {	0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,
									0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,
									0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,
									0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE	}; 

	/*	2D poly caches */
	/* 	The result of the 3D transformation
		and 2D projection will be stored in an array
		of 2D polygons, along with the color of each
		polygon. Hence, we can display still letters
		without harming the framerate that much. */
	u16 poly_cache_size[3];

	Vect2D_s16 poly_cache_pt_r[logo_r_FACE_COUNT << 2];
	u16 poly_cache_is_quad_r[logo_r_FACE_COUNT];
	u16 poly_cache_col_r[logo_r_FACE_COUNT];

	Vect2D_s16 poly_cache_pt_s[logo_s_FACE_COUNT << 2];
	u16 poly_cache_is_quad_s[logo_s_FACE_COUNT];
	u16 poly_cache_col_s[logo_s_FACE_COUNT];

	Vect2D_s16 poly_cache_pt_e[logo_e_FACE_COUNT << 2];
	u16 poly_cache_is_quad_e[logo_e_FACE_COUNT];
	u16 poly_cache_col_e[logo_e_FACE_COUNT];

	/* Rotation easing */
	u16 easing_index;

	/* Polygon zsort array */
	struct  QSORT_ENTRY poly_zsort[RSE_LOGO_3D_MAX_POINTS];

    Rotation3D rotation;
	Translation3D translation;
	Transformation3D transformation;

    fix16 camdist;

	char str[16];

	Vect3D_f16 pts_3D[RSE_LOGO_3D_MAX_POINTS];
	Vect2D_s16 pts_2D[RSE_LOGO_3D_MAX_POINTS];

	/* 3D Transformation */
	void inline updatePointsPos()
	{
		// transform 3D point
		M3D_transform(&(transformation), mesh_coord, pts_3D, vtx_count);
		// project 3D point (f16) to 2D point (s16)
		M3D_project_s16(pts_3D, pts_2D, vtx_count);
	}