1 /*
2  * GStreamer
3  * Copyright (C) 2014 Lubosz Sarnecki <lubosz@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _GST_GL_TRANSFORMATION_H_
22 #define _GST_GL_TRANSFORMATION_H_
23 
24 #include <gst/gl/gstglfilter.h>
25 #include <gst/gl/gstglfuncs.h>
26 #include <graphene.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GST_TYPE_GL_TRANSFORMATION            (gst_gl_transformation_get_type())
31 #define GST_GL_TRANSFORMATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_TRANSFORMATION,GstGLTransformation))
32 #define GST_IS_GL_TRANSFORMATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_TRANSFORMATION))
33 #define GST_GL_TRANSFORMATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_TRANSFORMATION,GstGLTransformationClass))
34 #define GST_IS_GL_TRANSFORMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_TRANSFORMATION))
35 #define GST_GL_TRANSFORMATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_TRANSFORMATION,GstGLTransformationClass))
36 
37 typedef struct _GstGLTransformation GstGLTransformation;
38 typedef struct _GstGLTransformationClass GstGLTransformationClass;
39 
40 struct _GstGLTransformation
41 {
42     GstGLFilter filter;
43 
44     GstGLShader *shader;
45     GLuint       vao;
46     GLuint       vbo_indices;
47     GLuint       vertex_buffer;
48     GLint        attr_position;
49     GLint        attr_texture;
50 
51     GstGLMemory *in_tex;
52     GstGLMemory *out_tex;
53 
54     gfloat xrotation;
55     gfloat yrotation;
56     gfloat zrotation;
57 
58     gfloat xscale;
59     gfloat yscale;
60 
61     gfloat xtranslation;
62     gfloat ytranslation;
63     gfloat ztranslation;
64 
65     gfloat xpivot;
66     gfloat ypivot;
67     gfloat zpivot;
68 
69     /* perspective */
70     gfloat fov;
71     gfloat aspect;
72     gfloat znear;
73     gfloat zfar;
74     gboolean ortho;
75 
76     graphene_matrix_t model_matrix;
77     graphene_matrix_t view_matrix;
78     graphene_matrix_t projection_matrix;
79     graphene_matrix_t inv_model_matrix;
80     graphene_matrix_t inv_view_matrix;
81     graphene_matrix_t inv_projection_matrix;
82     graphene_matrix_t mvp_matrix;
83 
84     graphene_vec3_t camera_position;
85 
86     gboolean downstream_supports_affine_meta;
87     gboolean caps_change;
88 };
89 
90 struct _GstGLTransformationClass
91 {
92     GstGLFilterClass filter_class;
93 };
94 
95 GType gst_gl_transformation_get_type (void);
96 
97 G_END_DECLS
98 
99 #endif /* _GST_GL_TRANSFORMATION_H_ */
100