Lines Matching refs:transformation
115 transformation);
287 GstGLTransformation *transformation; in gst_gl_transformation_finalize() local
291 transformation = GST_GL_TRANSFORMATION (object); in gst_gl_transformation_finalize()
293 graphene_matrix_free (transformation->model_matrix); in gst_gl_transformation_finalize()
294 graphene_matrix_free (transformation->view_matrix); in gst_gl_transformation_finalize()
295 graphene_matrix_free (transformation->projection_matrix); in gst_gl_transformation_finalize()
296 graphene_matrix_free (transformation->inv_model_matrix); in gst_gl_transformation_finalize()
297 graphene_matrix_free (transformation->inv_view_matrix); in gst_gl_transformation_finalize()
298 graphene_matrix_free (transformation->inv_projection_matrix); in gst_gl_transformation_finalize()
299 graphene_matrix_free (transformation->mvp_matrix); in gst_gl_transformation_finalize()
301 graphene_vec3_free (transformation->camera_position); in gst_gl_transformation_finalize()
307 gst_gl_transformation_build_mvp (GstGLTransformation * transformation) in gst_gl_transformation_build_mvp() argument
309 GstGLFilter *filter = GST_GL_FILTER (transformation); in gst_gl_transformation_build_mvp()
313 graphene_matrix_init_identity (transformation->model_matrix); in gst_gl_transformation_build_mvp()
314 graphene_matrix_init_identity (transformation->view_matrix); in gst_gl_transformation_build_mvp()
315 graphene_matrix_init_identity (transformation->projection_matrix); in gst_gl_transformation_build_mvp()
318 GRAPHENE_POINT3D_INIT (transformation->xtranslation * 2.0 * in gst_gl_transformation_build_mvp()
319 transformation->aspect, in gst_gl_transformation_build_mvp()
320 transformation->ytranslation * 2.0, in gst_gl_transformation_build_mvp()
321 transformation->ztranslation * 2.0); in gst_gl_transformation_build_mvp()
324 GRAPHENE_POINT3D_INIT (-transformation->xpivot * transformation->aspect, in gst_gl_transformation_build_mvp()
325 transformation->ypivot, in gst_gl_transformation_build_mvp()
326 -transformation->zpivot); in gst_gl_transformation_build_mvp()
336 graphene_vec3_init (transformation->camera_position, 0.f, 0.f, 1.f); in gst_gl_transformation_build_mvp()
341 graphene_matrix_init_translate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
345 graphene_matrix_scale (transformation->model_matrix, in gst_gl_transformation_build_mvp()
346 transformation->xscale, transformation->yscale, 1.0f); in gst_gl_transformation_build_mvp()
349 graphene_matrix_rotate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
350 transformation->xrotation, graphene_vec3_x_axis ()); in gst_gl_transformation_build_mvp()
351 graphene_matrix_rotate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
352 transformation->yrotation, graphene_vec3_y_axis ()); in gst_gl_transformation_build_mvp()
353 graphene_matrix_rotate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
354 transformation->zrotation, graphene_vec3_z_axis ()); in gst_gl_transformation_build_mvp()
358 graphene_matrix_translate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
362 graphene_matrix_translate (transformation->model_matrix, in gst_gl_transformation_build_mvp()
365 if (transformation->ortho) { in gst_gl_transformation_build_mvp()
366 graphene_matrix_init_ortho (transformation->projection_matrix, in gst_gl_transformation_build_mvp()
367 -transformation->aspect, transformation->aspect, in gst_gl_transformation_build_mvp()
368 -1, 1, transformation->znear, transformation->zfar); in gst_gl_transformation_build_mvp()
370 graphene_matrix_init_perspective (transformation->projection_matrix, in gst_gl_transformation_build_mvp()
371 transformation->fov, in gst_gl_transformation_build_mvp()
372 transformation->aspect, transformation->znear, transformation->zfar); in gst_gl_transformation_build_mvp()
375 graphene_matrix_init_look_at (transformation->view_matrix, in gst_gl_transformation_build_mvp()
376 transformation->camera_position, ¢er, &up); in gst_gl_transformation_build_mvp()
379 gst_base_transform_is_passthrough (GST_BASE_TRANSFORM (transformation)); in gst_gl_transformation_build_mvp()
380 passthrough = transformation->xtranslation == 0. in gst_gl_transformation_build_mvp()
381 && transformation->ytranslation == 0. in gst_gl_transformation_build_mvp()
382 && transformation->ztranslation == 0. && transformation->xrotation == 0. in gst_gl_transformation_build_mvp()
383 && transformation->yrotation == 0. && transformation->zrotation == 0. in gst_gl_transformation_build_mvp()
384 && transformation->xscale == 1. && transformation->yscale == 1. in gst_gl_transformation_build_mvp()
386 gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (transformation), in gst_gl_transformation_build_mvp()
389 gst_base_transform_reconfigure_src (GST_BASE_TRANSFORM (transformation)); in gst_gl_transformation_build_mvp()
393 graphene_matrix_multiply (transformation->model_matrix, in gst_gl_transformation_build_mvp()
394 transformation->view_matrix, &modelview_matrix); in gst_gl_transformation_build_mvp()
396 transformation->projection_matrix, transformation->mvp_matrix); in gst_gl_transformation_build_mvp()
398 graphene_matrix_inverse (transformation->model_matrix, in gst_gl_transformation_build_mvp()
399 transformation->inv_model_matrix); in gst_gl_transformation_build_mvp()
400 graphene_matrix_inverse (transformation->view_matrix, in gst_gl_transformation_build_mvp()
401 transformation->inv_view_matrix); in gst_gl_transformation_build_mvp()
402 graphene_matrix_inverse (transformation->projection_matrix, in gst_gl_transformation_build_mvp()
403 transformation->inv_projection_matrix); in gst_gl_transformation_build_mvp()
519 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter); in gst_gl_transformation_set_caps() local
521 transformation->aspect = in gst_gl_transformation_set_caps()
525 transformation->caps_change = TRUE; in gst_gl_transformation_set_caps()
527 gst_gl_transformation_build_mvp (transformation); in gst_gl_transformation_set_caps()
542 _screen_coord_to_world_ray (GstGLTransformation * transformation, float x, in _screen_coord_to_world_ray() argument
545 GstGLFilter *filter = GST_GL_FILTER (transformation); in _screen_coord_to_world_ray()
554 graphene_vec2_init (&screen_coord, (2. * x / w - 1.) / transformation->aspect, in _screen_coord_to_world_ray()
559 graphene_matrix_transform_point3d (transformation->inv_projection_matrix, in _screen_coord_to_world_ray()
564 if (transformation->ortho) { in _screen_coord_to_world_ray()
570 graphene_matrix_transform_vec3 (transformation->inv_view_matrix, in _screen_coord_to_world_ray()
574 ray_origin = transformation->camera_position; in _screen_coord_to_world_ray()
580 GST_TRACE_OBJECT (transformation, "Calculated ray origin: " VEC3_FORMAT in _screen_coord_to_world_ray()
585 transformation->ortho ? "ortho" : "perspection"); in _screen_coord_to_world_ray()
589 _init_world_video_plane (GstGLTransformation * transformation, in _init_world_video_plane() argument
596 graphene_point3d_init (&top_left, -transformation->aspect, 1., 0.); in _init_world_video_plane()
597 graphene_point3d_init (&top_right, transformation->aspect, 1., 0.); in _init_world_video_plane()
598 graphene_point3d_init (&bottom_left, -transformation->aspect, -1., 0.); in _init_world_video_plane()
599 graphene_point3d_init (&bottom_right, transformation->aspect, -1., 0.); in _init_world_video_plane()
601 graphene_matrix_transform_point3d (transformation->model_matrix, in _init_world_video_plane()
603 graphene_matrix_transform_point3d (transformation->model_matrix, in _init_world_video_plane()
605 graphene_matrix_transform_point3d (transformation->model_matrix, in _init_world_video_plane()
607 graphene_matrix_transform_point3d (transformation->model_matrix, in _init_world_video_plane()
615 _screen_coord_to_model_coord (GstGLTransformation * transformation, in _screen_coord_to_model_coord() argument
618 GstGLFilter *filter = GST_GL_FILTER (transformation); in _screen_coord_to_model_coord()
626 _init_world_video_plane (transformation, &video_plane); in _screen_coord_to_model_coord()
627 _screen_coord_to_world_ray (transformation, x, y, &ray); in _screen_coord_to_model_coord()
629 graphene_matrix_transform_point3d (transformation->inv_model_matrix, in _screen_coord_to_model_coord()
641 GST_DEBUG_OBJECT (transformation, "converted %f,%f to %f,%f", x, y, new_x, in _screen_coord_to_model_coord()
656 _ndc_to_viewport (GstGLTransformation * transformation, graphene_vec3_t * ndc,
659 GstGLFilter *filter = GST_GL_FILTER (transformation);
679 _vertex_to_screen_coord (GstGLTransformation * transformation,
682 GstGLFilter *filter = GST_GL_FILTER (transformation);
688 graphene_matrix_transform_vec4 (transformation->mvp_matrix, vertex, &clip);
690 _ndc_to_viewport (transformation, &ndc, 0, 0, w, h, 0., 1., view);
697 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (trans); in gst_gl_transformation_src_event() local
714 if (!_screen_coord_to_model_coord (transformation, x, y, &new_x, in gst_gl_transformation_src_event()
751 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (trans); in gst_gl_transformation_decide_allocation() local
759 transformation->downstream_supports_affine_meta = TRUE; in gst_gl_transformation_decide_allocation()
761 transformation->downstream_supports_affine_meta = FALSE; in gst_gl_transformation_decide_allocation()
770 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (base_filter); in gst_gl_transformation_gl_stop() local
773 if (transformation->vao) { in gst_gl_transformation_gl_stop()
774 gl->DeleteVertexArrays (1, &transformation->vao); in gst_gl_transformation_gl_stop()
775 transformation->vao = 0; in gst_gl_transformation_gl_stop()
778 if (transformation->vertex_buffer) { in gst_gl_transformation_gl_stop()
779 gl->DeleteBuffers (1, &transformation->vertex_buffer); in gst_gl_transformation_gl_stop()
780 transformation->vertex_buffer = 0; in gst_gl_transformation_gl_stop()
783 if (transformation->vbo_indices) { in gst_gl_transformation_gl_stop()
784 gl->DeleteBuffers (1, &transformation->vbo_indices); in gst_gl_transformation_gl_stop()
785 transformation->vbo_indices = 0; in gst_gl_transformation_gl_stop()
788 if (transformation->shader) { in gst_gl_transformation_gl_stop()
789 gst_object_unref (transformation->shader); in gst_gl_transformation_gl_stop()
790 transformation->shader = NULL; in gst_gl_transformation_gl_stop()
799 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (base_filter); in gst_gl_transformation_gl_start() local
816 frag_str, &transformation->shader); in gst_gl_transformation_gl_start()
829 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (trans); in gst_gl_transformation_prepare_output_buffer() local
832 if (transformation->downstream_supports_affine_meta && in gst_gl_transformation_prepare_output_buffer()
851 graphene_matrix_init_scale (&inv_aspect, transformation->aspect, -1., 1.); in gst_gl_transformation_prepare_output_buffer()
857 graphene_matrix_multiply (&tmp2, transformation->mvp_matrix, &tmp); in gst_gl_transformation_prepare_output_buffer()
875 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter); in gst_gl_transformation_filter() local
877 if (transformation->downstream_supports_affine_meta && in gst_gl_transformation_filter()
889 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter); in gst_gl_transformation_filter_texture() local
891 transformation->in_tex = in_tex; in gst_gl_transformation_filter_texture()
894 (GstGLFramebufferFunc) gst_gl_transformation_callback, transformation); in gst_gl_transformation_filter_texture()
902 _upload_vertices (GstGLTransformation * transformation) in _upload_vertices() argument
905 GST_GL_BASE_FILTER (transformation)->context->gl_vtable; in _upload_vertices()
909 -transformation->aspect, -1.0, 0.0, 1.0, 0.0, 0.0, in _upload_vertices()
910 transformation->aspect, -1.0, 0.0, 1.0, 1.0, 0.0, in _upload_vertices()
911 transformation->aspect, 1.0, 0.0, 1.0, 1.0, 1.0, in _upload_vertices()
912 -transformation->aspect, 1.0, 0.0, 1.0, 0.0, 1.0, in _upload_vertices()
916 gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer); in _upload_vertices()
923 _bind_buffer (GstGLTransformation * transformation) in _bind_buffer() argument
926 GST_GL_BASE_FILTER (transformation)->context->gl_vtable; in _bind_buffer()
928 gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, transformation->vbo_indices); in _bind_buffer()
929 gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer); in _bind_buffer()
932 gl->VertexAttribPointer (transformation->attr_position, 4, GL_FLOAT, in _bind_buffer()
936 gl->VertexAttribPointer (transformation->attr_texture, 2, GL_FLOAT, GL_FALSE, in _bind_buffer()
939 gl->EnableVertexAttribArray (transformation->attr_position); in _bind_buffer()
940 gl->EnableVertexAttribArray (transformation->attr_texture); in _bind_buffer()
944 _unbind_buffer (GstGLTransformation * transformation) in _unbind_buffer() argument
947 GST_GL_BASE_FILTER (transformation)->context->gl_vtable; in _unbind_buffer()
952 gl->DisableVertexAttribArray (transformation->attr_position); in _unbind_buffer()
953 gl->DisableVertexAttribArray (transformation->attr_texture); in _unbind_buffer()
960 GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter); in gst_gl_transformation_callback() local
971 gst_gl_shader_use (transformation->shader); in gst_gl_transformation_callback()
974 gl->BindTexture (GL_TEXTURE_2D, transformation->in_tex->tex_id); in gst_gl_transformation_callback()
975 gst_gl_shader_set_uniform_1i (transformation->shader, "texture", 0); in gst_gl_transformation_callback()
977 graphene_matrix_to_float (transformation->mvp_matrix, temp_matrix); in gst_gl_transformation_callback()
978 gst_gl_shader_set_uniform_matrix_4fv (transformation->shader, in gst_gl_transformation_callback()
981 if (!transformation->vertex_buffer) { in gst_gl_transformation_callback()
982 transformation->attr_position = in gst_gl_transformation_callback()
983 gst_gl_shader_get_attribute_location (transformation->shader, in gst_gl_transformation_callback()
986 transformation->attr_texture = in gst_gl_transformation_callback()
987 gst_gl_shader_get_attribute_location (transformation->shader, in gst_gl_transformation_callback()
991 gl->GenVertexArrays (1, &transformation->vao); in gst_gl_transformation_callback()
992 gl->BindVertexArray (transformation->vao); in gst_gl_transformation_callback()
995 gl->GenBuffers (1, &transformation->vertex_buffer); in gst_gl_transformation_callback()
997 gl->GenBuffers (1, &transformation->vbo_indices); in gst_gl_transformation_callback()
998 gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, transformation->vbo_indices); in gst_gl_transformation_callback()
1002 transformation->caps_change = TRUE; in gst_gl_transformation_callback()
1006 gl->BindVertexArray (transformation->vao); in gst_gl_transformation_callback()
1008 if (transformation->caps_change) in gst_gl_transformation_callback()
1009 _upload_vertices (transformation); in gst_gl_transformation_callback()
1010 _bind_buffer (transformation); in gst_gl_transformation_callback()
1017 _unbind_buffer (transformation); in gst_gl_transformation_callback()
1020 transformation->caps_change = FALSE; in gst_gl_transformation_callback()