gltransformation: always build a valid mvp matrix
The default case is to build an identity matrix.
This commit is contained in:
parent
f721499371
commit
198d451f31
@ -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…
x
Reference in New Issue
Block a user