1 /*   EXTRAITS DE LA LICENCE
2 	Copyright CEA, contributeurs : Luc BILLARD et Damien
3 	CALISTE, laboratoire L_Sim, (2001-2005)
4 
5 	Adresse mèl :
6 	BILLARD, non joignable par mèl ;
7 	CALISTE, damien P caliste AT cea P fr.
8 
9 	Ce logiciel est un programme informatique servant à visualiser des
10 	structures atomiques dans un rendu pseudo-3D.
11 
12 	Ce logiciel est régi par la licence CeCILL soumise au droit français et
13 	respectant les principes de diffusion des logiciels libres. Vous pouvez
14 	utiliser, modifier et/ou redistribuer ce programme sous les conditions
15 	de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
16 	sur le site "http://www.cecill.info".
17 
18 	Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
19 	pris connaissance de la licence CeCILL, et que vous en avez accepté les
20 	termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
21 */
22 
23 /*   LICENCE SUM UP
24 	Copyright CEA, contributors : Luc BILLARD et Damien
25 	CALISTE, laboratoire L_Sim, (2001-2005)
26 
27 	E-mail address:
28 	BILLARD, not reachable any more ;
29 	CALISTE, damien P caliste AT cea P fr.
30 
31 	This software is a computer program whose purpose is to visualize atomic
32 	configurations in 3D.
33 
34 	This software is governed by the CeCILL  license under French law and
35 	abiding by the rules of distribution of free software.  You can  use,
36 	modify and/ or redistribute the software under the terms of the CeCILL
37 	license as circulated by CEA, CNRS and INRIA at the following URL
38 	"http://www.cecill.info".
39 
40 	The fact that you are presently reading this means that you have had
41 	knowledge of the CeCILL license and that you accept its terms. You can
42 	find a copy of this licence shipped with this software at Documentation/licence.en.txt.
43 */
44 #ifndef VISU_GL_EXT_H
45 #define VISU_GL_EXT_H
46 
47 #include <glib.h>
48 #include <glib-object.h>
49 
50 #include "visu_tools.h"
51 #include "opengl.h"
52 #include "openGLFunctions/renderingMode.h"
53 #include "openGLFunctions/view.h"
54 
55 G_BEGIN_DECLS
56 
57 /***************/
58 /* Public part */
59 /***************/
60 
61 /**
62  * VISU_GL_EXT_PRIORITY_BACKGROUND
63  *
64  * An extension with this priority is drawn first.
65  */
66 #define VISU_GL_EXT_PRIORITY_BACKGROUND 0
67 /**
68  * VISU_GL_EXT_PRIORITY_NODES
69  *
70  * An extension with this priority is drawn alsmost first with the nodes.
71  */
72 #define VISU_GL_EXT_PRIORITY_NODES 2
73 /**
74  * VISU_GL_EXT_PRIORITY_NODE_DECORATIONS
75  *
76  * An extension with this priority is drawn just after the nodes.
77  */
78 #define VISU_GL_EXT_PRIORITY_NODE_DECORATIONS 5
79 /**
80  * VISU_GL_EXT_PRIORITY_HIGH
81  *
82  * An extension with this priority is drawn after the higher priorities.
83  */
84 #define VISU_GL_EXT_PRIORITY_HIGH 20
85 /**
86  * VISU_GL_EXT_PRIORITY_NORMAL
87  *
88  * An extension with this priority is drawn after the higher priorities.
89  */
90 #define VISU_GL_EXT_PRIORITY_NORMAL 50
91 /**
92  * VISU_GL_EXT_PRIORITY_LOW
93  *
94  * An extension with this priority is drawn among last extensions.
95  */
96 #define VISU_GL_EXT_PRIORITY_LOW 80
97 /**
98  * VISU_GL_EXT_PRIORITY_LAST
99  *
100  * An extension with this priority is drawn last.
101  */
102 #define VISU_GL_EXT_PRIORITY_LAST 100
103 
104 /**
105  * VISU_TYPE_GL_EXT:
106  *
107  * return the type of #VisuGlExt.
108  */
109 #define VISU_TYPE_GL_EXT	     (visu_gl_ext_get_type ())
110 /**
111  * VISU_GL_EXT:
112  * @obj: a #GObject to cast.
113  *
114  * Cast the given @obj into #VisuGlExt type.
115  */
116 #define VISU_GL_EXT(obj)	        (G_TYPE_CHECK_INSTANCE_CAST(obj, VISU_TYPE_GL_EXT, VisuGlExt))
117 /**
118  * VISU_GL_EXT_CLASS:
119  * @klass: a #GObjectClass to cast.
120  *
121  * Cast the given @klass into #VisuGlExtClass.
122  */
123 #define VISU_GL_EXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST(klass, VISU_TYPE_GL_EXT, VisuGlExtClass))
124 /**
125  * VISU_IS_GL_EXT:
126  * @obj: a #GObject to test.
127  *
128  * Test if the given @ogj is of the type of #VisuGlExt object.
129  */
130 #define VISU_IS_GL_EXT(obj)    (G_TYPE_CHECK_INSTANCE_TYPE(obj, VISU_TYPE_GL_EXT))
131 /**
132  * VISU_IS_GL_EXT_CLASS:
133  * @klass: a #GObjectClass to test.
134  *
135  * Test if the given @klass is of the type of #VisuGlExtClass class.
136  */
137 #define VISU_IS_GL_EXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE(klass, VISU_TYPE_GL_EXT))
138 /**
139  * VISU_GL_EXT_GET_CLASS:
140  * @obj: a #GObject to get the class of.
141  *
142  * It returns the class of the given @obj.
143  */
144 #define VISU_GL_EXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS(obj, VISU_TYPE_GL_EXT, VisuGlExtClass))
145 
146 
147 /**
148  * VisuGlExtPrivate:
149  *
150  * Private data for #VisuGlExt objects.
151  */
152 typedef struct _VisuGlExtPrivate VisuGlExtPrivate;
153 
154 /**
155  * VisuGlExt:
156  *
157  * Common name to refer to a #_VisuGlExt.
158  */
159 typedef struct _VisuGlExt VisuGlExt;
160 struct _VisuGlExt
161 {
162   VisuObject parent;
163 
164   VisuGlExtPrivate *priv;
165 };
166 
167 /**
168  * VisuGlExtClass:
169  * @parent: private.
170  * @setGlView: a method to attach a #VisuGlView object to this extension.
171  * @rebuild: a rebuilding function for this extension.
172  * @draw: a draw method for this extension.
173  * @allExtensions: the list of all stored #VisuGlExt objects.
174  *
175  * Common name to refer to a #_VisuGlExtClass.
176  */
177 typedef struct _VisuGlExtClass VisuGlExtClass;
178 struct _VisuGlExtClass
179 {
180   VisuObjectClass parent;
181 
182   gboolean (*setGlView)(VisuGlExt *ext, VisuGlView *view);
183   void (*rebuild)(VisuGlExt *self);
184   void (*draw)(VisuGlExt *self);
185 
186   GList *allExtensions;
187 };
188 
189 /**
190  * visu_gl_ext_get_type:
191  *
192  * This method returns the type of #VisuGlExt, use
193  * VISU_TYPE_GL_EXT instead.
194  *
195  * Since: 3.7
196  *
197  * Returns: the type of #VisuGlExt.
198  */
199 GType visu_gl_ext_get_type(void);
200 
201 gboolean visu_gl_ext_setDirty(VisuGlExt *ext, gboolean status);
202 
203 guint visu_gl_ext_getPriority(VisuGlExt *extension);
204 
205 gboolean visu_gl_ext_getActive(VisuGlExt* extension);
206 gboolean visu_gl_ext_setActive(VisuGlExt* extension, gboolean value);
207 
208 VisuGl* visu_gl_ext_getGlContext(VisuGlExt* extension);
209 gboolean visu_gl_ext_setGlContext(VisuGlExt* extension, VisuGl *gl);
210 
211 gboolean visu_gl_ext_setPreferedRenderingMode(VisuGlExt* extension,
212 						  VisuGlRenderingMode value);
213 VisuGlRenderingMode visu_gl_ext_getPreferedRenderingMode(VisuGlExt* extension);
214 
215 gboolean visu_gl_ext_setTranslation(VisuGlExt *extension, const gfloat trans[3]);
216 
217 guint visu_gl_ext_getGlList(VisuGlExt *extension);
218 const gchar* visu_gl_ext_getName(const VisuGlExt *extension);
219 
220 void visu_gl_ext_startDrawing(VisuGlExt *extension);
221 void visu_gl_ext_completeDrawing(VisuGlExt *extension);
222 
223 void visu_gl_ext_call(VisuGlExt *extension, gboolean lastOnly);
224 
225 void visu_gl_ext_rebuild(VisuGlExt *self);
226 gboolean visu_gl_ext_setGlView(VisuGlExt *ext, VisuGlView *view);
227 
228 G_END_DECLS
229 
230 #endif
231