mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-30 11:08:34 +00:00
gltransformation: always build a valid mvp matrix
The default case is to build an identity matrix.
This commit is contained in:
parent
e8544db8cf
commit
0e928db89e
1 changed files with 61 additions and 54 deletions
|
@ -265,6 +265,14 @@ gst_gl_transformation_init (GstGLTransformation * filter)
|
|||
static void
|
||||
gst_gl_transformation_build_mvp (GstGLTransformation * transformation)
|
||||
{
|
||||
GstGLFilter *filter = GST_GL_FILTER (transformation);
|
||||
graphene_matrix_t modelview_matrix;
|
||||
|
||||
if (!filter->out_info.finfo) {
|
||||
graphene_matrix_init_identity (&transformation->model_matrix);
|
||||
graphene_matrix_init_identity (&transformation->view_matrix);
|
||||
graphene_matrix_init_identity (&transformation->projection_matrix);
|
||||
} else {
|
||||
graphene_point3d_t translation_vector =
|
||||
GRAPHENE_POINT3D_INIT (transformation->xtranslation * 2.0 *
|
||||
transformation->aspect,
|
||||
|
@ -278,12 +286,12 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation)
|
|||
|
||||
graphene_point3d_t negative_pivot_vector;
|
||||
|
||||
graphene_matrix_t modelview_matrix;
|
||||
|
||||
graphene_vec3_t eye;
|
||||
graphene_vec3_t center;
|
||||
graphene_vec3_t up;
|
||||
|
||||
gboolean passthrough;
|
||||
|
||||
graphene_vec3_init (&eye, 0.f, 0.f, 1.f);
|
||||
graphene_vec3_init (¢er, 0.f, 0.f, 0.f);
|
||||
graphene_vec3_init (&up, 0.f, 1.f, 0.f);
|
||||
|
@ -325,13 +333,7 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation)
|
|||
graphene_matrix_init_look_at (&transformation->view_matrix, &eye, ¢er,
|
||||
&up);
|
||||
|
||||
graphene_matrix_multiply (&transformation->model_matrix,
|
||||
&transformation->view_matrix, &modelview_matrix);
|
||||
graphene_matrix_multiply (&modelview_matrix,
|
||||
&transformation->projection_matrix, &transformation->mvp_matrix);
|
||||
|
||||
if (filter->in_info.finfo) {
|
||||
gboolean passthrough = transformation->xtranslation == 0.
|
||||
passthrough = transformation->xtranslation == 0.
|
||||
&& transformation->ytranslation == 0.
|
||||
&& transformation->ztranslation == 0.
|
||||
&& transformation->xrotation == 0.
|
||||
|
@ -343,6 +345,11 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation)
|
|||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (transformation),
|
||||
passthrough);
|
||||
}
|
||||
|
||||
graphene_matrix_multiply (&transformation->model_matrix,
|
||||
&transformation->view_matrix, &modelview_matrix);
|
||||
graphene_matrix_multiply (&modelview_matrix,
|
||||
&transformation->projection_matrix, &transformation->mvp_matrix);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue