Use replacement D3DXMatrix functions

This commit is contained in:
twinaphex 2017-10-02 19:01:23 +02:00
parent 6eb23efb54
commit bceb8000dd
3 changed files with 17 additions and 23 deletions

View File

@ -48,11 +48,11 @@ static void renderchain_set_mvp(void *data, unsigned vp_width,
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
D3DXMATRIX p_out, p_rotate, mat;
D3DMATRIX p_out, p_rotate, mat;
D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
D3DXMatrixIdentity(&p_out);
D3DXMatrixRotationZ(&p_rotate, rotation * (M_PI / 2.0));
d3d_matrix_ortho_off_center_lh(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
d3d_matrix_identity(&p_out);
d3d_matrix_rotation_z(&p_rotate, rotation * (M_PI / 2.0));
d3d_set_transform(d3dr, D3DTS_WORLD, &p_rotate);
d3d_set_transform(d3dr, D3DTS_VIEW, &p_out);

View File

@ -225,7 +225,7 @@ error:
static void d3d9_cg_renderchain_set_shader_mvp(cg_renderchain_t *chain, void *shader_data, void *matrix_data)
{
CGprogram *vPrg = (CGprogram*)shader_data;
const D3DXMATRIX *matrix = (const D3DXMATRIX*)matrix_data;
const D3DMATRIX *matrix = (const D3DMATRIX*)matrix_data;
CGparameter cgpModelViewProj = cgGetNamedParameter(*vPrg, "modelViewProj");
if (cgpModelViewProj)
cgD3D9SetUniformMatrix(cgpModelViewProj, matrix);
@ -787,12 +787,12 @@ static bool d3d9_cg_renderchain_create_first_pass(
{
unsigned i;
Pass pass;
D3DXMATRIX ident;
D3DMATRIX ident;
if (!chain)
return false;
D3DXMatrixIdentity(&ident);
d3d_matrix_identity(&ident);
d3d_set_transform(chain->dev, D3DTS_WORLD, &ident);
d3d_set_transform(chain->dev, D3DTS_VIEW, &ident);
@ -1137,15 +1137,15 @@ static void d3d9_cg_renderchain_set_mvp(
unsigned vp_width, unsigned vp_height,
unsigned rotation)
{
D3DXMATRIX proj, ortho, rot, tmp;
D3DMATRIX proj, ortho, rot, tmp;
CGprogram vPrg = (CGprogram)vertex_program;
D3DXMatrixOrthoOffCenterLH(&ortho, 0, vp_width, 0, vp_height, 0, 1);
D3DXMatrixIdentity(&rot);
D3DXMatrixRotationZ(&rot, rotation * (D3D_PI / 2.0));
d3d_matrix_ortho_off_center_lh(&ortho, 0, vp_width, 0, vp_height, 0, 1);
d3d_matrix_identity(&rot);
d3d_matrix_rotation_z(&rot, rotation * (D3D_PI / 2.0));
D3DXMatrixMultiply(&proj, &ortho, &rot);
D3DXMatrixTranspose(&tmp, &proj);
d3d_matrix_multiply(&proj, &ortho, &rot);
d3d_matrix_transpose(&tmp, &proj);
d3d9_cg_renderchain_set_shader_mvp(chain, &vPrg, &tmp);
}

View File

@ -63,24 +63,18 @@ static const float *menu_display_d3d_get_default_tex_coords(void)
static void *menu_display_d3d_get_default_mvp(void)
{
#ifndef _XBOX
static math_matrix_4x4 default_mvp;
D3DXMATRIX ortho, mvp;
#endif
D3DMATRIX ortho, mvp;
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
if (!d3d)
return NULL;
#ifdef _XBOX
return NULL; /* TODO/FIXME */
#else
D3DXMatrixOrthoOffCenterLH(&ortho, 0,
d3d_matrix_ortho_off_center_lh(&ortho, 0,
d3d->final_viewport.Width, 0, d3d->final_viewport.Height, 0, 1);
D3DXMatrixTranspose(&mvp, &ortho);
memcpy(default_mvp.data, (FLOAT*)mvp, sizeof(default_mvp.data));
d3d_matrix_transpose(&mvp, &ortho);
memcpy(default_mvp.data, (float*)&mvp, sizeof(default_mvp.data));
return &default_mvp;
#endif
}
static unsigned menu_display_prim_to_d3d_enum(