wined3d: Introduce a get_modelview_matrix() function.

This commit is contained in:
Matteo Bruni 2015-03-18 21:07:35 +01:00 committed by Alexandre Julliard
parent fe4a226bfa
commit 50861156e2
3 changed files with 15 additions and 12 deletions

View File

@ -3844,6 +3844,7 @@ static void shader_bumpenv(struct wined3d_context *context, const struct wined3d
void transform_world(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_matrix mat;
/* This function is called by transform_view below if the view matrix was changed too
*
@ -3855,18 +3856,10 @@ void transform_world(struct wined3d_context *context, const struct wined3d_state
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode");
if (context->last_was_rhw)
{
gl_info->gl_ops.gl.p_glLoadIdentity();
checkGLcall("glLoadIdentity()");
}
else
{
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(0)].u.m[0][0]);
checkGLcall("glMultMatrixf");
}
get_modelview_matrix(context, state, &mat);
gl_info->gl_ops.gl.p_glLoadMatrixf((GLfloat *)&mat);
checkGLcall("glLoadMatrixf");
}
void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)

View File

@ -3130,6 +3130,14 @@ void get_identity_matrix(struct wined3d_matrix *mat)
*mat = identity;
}
void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_matrix *mat)
{
if (context->last_was_rhw)
get_identity_matrix(mat);
else
multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(0)]);
}
/* Setup this textures matrix according to the texture flags. */
/* Context activation is done by the caller (state handler). */
void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags,

View File

@ -3038,6 +3038,8 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
}
void get_identity_matrix(struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state,
struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
/* Using additional shader constants (uniforms in GLSL / program environment
* or local parameters in ARB) is costly: