static void *menu_display_d3d_get_default_mvp(video_frame_info_t *video_info) { static math_matrix_4x4 id; matrix_4x4_identity(id); return &id; }
static void *menu_display_d3d_get_default_mvp(void) { static math_matrix_4x4 id; matrix_4x4_identity(id); return &id; }
/* * Builds a translation matrix. All other elements in * the matrix will be set to zero except for the * diagonal which is set to 1.0 */ void matrix_4x4_translate(math_matrix_4x4 *out, float x, float y, float z) { matrix_4x4_identity(out); MAT_ELEM_4X4(*out, 0, 3) = x; MAT_ELEM_4X4(*out, 1, 3) = y; MAT_ELEM_4X4(*out, 2, 3) = z; }
/* * Builds a rotation matrix using the * rotation around the Z-axis. */ void matrix_4x4_rotate_z(math_matrix_4x4 *mat, float rad) { float cosine = cosf(rad); float sine = sinf(rad); matrix_4x4_identity(mat); MAT_ELEM_4X4(*mat, 0, 0) = cosine; MAT_ELEM_4X4(*mat, 1, 1) = cosine; MAT_ELEM_4X4(*mat, 0, 1) = -sine; MAT_ELEM_4X4(*mat, 1, 0) = sine; }
static void gl1_renderchain_ff_matrix(const void *data) { math_matrix_4x4 ident; const math_matrix_4x4 *mat = (const math_matrix_4x4*)data; /* Fall back to fixed function-style if needed and possible. */ glMatrixMode(GL_PROJECTION); glLoadMatrixf(mat->data); glMatrixMode(GL_MODELVIEW); matrix_4x4_identity(ident); glLoadMatrixf(ident.data); }
void gl_ff_matrix(const math_matrix_4x4 *mat) { #ifndef NO_GL_FF_MATRIX math_matrix_4x4 ident; /* Fall back to fixed function-style if needed and possible. */ glMatrixMode(GL_PROJECTION); glLoadMatrixf(mat->data); glMatrixMode(GL_MODELVIEW); matrix_4x4_identity(&ident); glLoadMatrixf(ident.data); #endif }
/* * Creates an orthographic projection matrix. */ void matrix_4x4_ortho(math_matrix_4x4 *mat, float left, float right, float bottom, float top, float znear, float zfar) { float rl = right - left; float tb = top - bottom; float fn = zfar - znear; matrix_4x4_identity(mat); MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / rl; MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / tb; MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / fn; MAT_ELEM_4X4(*mat, 0, 3) = -(left + right) / rl; MAT_ELEM_4X4(*mat, 1, 3) = -(top + bottom) / tb; MAT_ELEM_4X4(*mat, 2, 3) = -(zfar + znear) / fn; }
/* * Creates an orthographic projection matrix. */ void matrix_4x4_ortho(math_matrix_4x4 *mat, float left, float right, float bottom, float top, float znear, float zfar) { float tx, ty, tz; matrix_4x4_identity(mat); tx = -(right + left) / (right - left); ty = -(top + bottom) / (top - bottom); tz = -(zfar + znear) / (zfar - znear); MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / (right - left); MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / (top - bottom); MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / (zfar - znear); MAT_ELEM_4X4(*mat, 0, 3) = tx; MAT_ELEM_4X4(*mat, 1, 3) = ty; MAT_ELEM_4X4(*mat, 2, 3) = tz; }