Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-shader-effect.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2010  Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * Author:
22  *   Emmanuele Bassi <ebassi@linux.intel.com>
23  */
24
25 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
26 #error "Only <clutter/clutter.h> can be included directly."
27 #endif
28
29 #ifndef __CLUTTER_SHADER_EFFECT_H__
30 #define __CLUTTER_SHADER_EFFECT_H__
31
32 #include <clutter/clutter-offscreen-effect.h>
33
34 G_BEGIN_DECLS
35
36 #define CLUTTER_TYPE_SHADER_EFFECT              (clutter_shader_effect_get_type ())
37 #define CLUTTER_SHADER_EFFECT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffect))
38 #define CLUTTER_IS_SHADER_EFFECT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SHADER_EFFECT))
39 #define CLUTTER_SHADER_EFFECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffectClass))
40 #define CLUTTER_IS_SHADER_EFFECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SHADER_EFFECT))
41 #define CLUTTER_SHADER_EFFECT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffectClass))
42
43 typedef struct _ClutterShaderEffect             ClutterShaderEffect;
44 typedef struct _ClutterShaderEffectPrivate      ClutterShaderEffectPrivate;
45 typedef struct _ClutterShaderEffectClass        ClutterShaderEffectClass;
46
47 /**
48  * ClutterShaderEffect:
49  *
50  * The <structname>ClutterShaderEffect</structname> structure contains
51  * only private data and should be accessed using the provided API
52  *
53  * Since: 1.4
54  */
55 struct _ClutterShaderEffect
56 {
57   /*< private >*/
58   ClutterOffscreenEffect parent_instance;
59
60   ClutterShaderEffectPrivate *priv;
61 };
62
63 /**
64  * ClutterShaderEffectClass:
65  * @get_static_shader_source: Returns the GLSL source code to use for
66  *  instances of this shader effect. Note that this function is only
67  *  called once per subclass of #ClutterShaderEffect regardless of how
68  *  many instances are used. It is expected that subclasses will return
69  *  a copy of a static string from this function.
70  *
71  * The <structname>ClutterShaderEffectClass</structname> structure contains
72  * only private data
73  *
74  * Since: 1.4
75  */
76 struct _ClutterShaderEffectClass
77 {
78   /*< private >*/
79   ClutterOffscreenEffectClass parent_class;
80
81   /*< public >*/
82   gchar * (* get_static_shader_source) (ClutterShaderEffect *effect);
83
84   /*< private >*/
85   /* padding */
86   void (*_clutter_shader1) (void);
87   void (*_clutter_shader2) (void);
88   void (*_clutter_shader3) (void);
89   void (*_clutter_shader4) (void);
90   void (*_clutter_shader5) (void);
91 };
92
93 GType clutter_shader_effect_get_type (void) G_GNUC_CONST;
94
95 ClutterEffect * clutter_shader_effect_new               (ClutterShaderType    shader_type);
96
97 gboolean        clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
98                                                          const gchar         *source);
99
100 void            clutter_shader_effect_set_uniform       (ClutterShaderEffect *effect,
101                                                          const gchar         *name,
102                                                          GType                gtype,
103                                                          gsize                n_values,
104                                                          ...);
105 void            clutter_shader_effect_set_uniform_value (ClutterShaderEffect *effect,
106                                                          const gchar         *name,
107                                                          const GValue        *value);
108
109 CoglHandle      clutter_shader_effect_get_shader        (ClutterShaderEffect *effect);
110 CoglHandle      clutter_shader_effect_get_program       (ClutterShaderEffect *effect);
111
112 G_END_DECLS
113
114 #endif /* __CLUTTER_SHADER_EFFECT_H__ */