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 CAMERA_H 45 #define CAMERA_H 46 47 #include <glib.h> 48 #include <glib-object.h> 49 #include <visu_box.h> 50 #include <coreTools/toolMatrix.h> 51 #include <coreTools/toolPhysic.h> 52 53 G_BEGIN_DECLS 54 55 typedef struct _VisuGlCamera VisuGlCamera; 56 struct _VisuGlCamera 57 { 58 /* Perspective. */ 59 double d_red; 60 /* Orientation. */ 61 double theta, phi, omega; 62 /* Position. */ 63 double xs, ys; 64 /* Zoom. */ 65 double gross; 66 /* A length reference and its unit. */ 67 double length0; 68 ToolUnits unit; 69 70 /* Up vector. */ 71 double up[3]; 72 /* Up axis. */ 73 ToolXyzDir upAxis; 74 /* Eye target and eye position. */ 75 double centre[3], eye[3]; 76 }; 77 78 GType visu_gl_camera_get_type(void); 79 /** 80 * VISU_TYPE_GL_CAMERA: 81 * 82 * The type of #VisuGlCamera objects. 83 */ 84 #define VISU_TYPE_GL_CAMERA (visu_gl_camera_get_type()) 85 86 void visu_gl_camera_copy(VisuGlCamera *to, const VisuGlCamera *from); 87 /** 88 * VISU_GL_CAMERA_THETA: 89 * 90 * Value used in the visu_gl_camera_setThetaPhiOmega() method to store the tetha angle. 91 */ 92 #define VISU_GL_CAMERA_THETA (1 << 1) 93 /** 94 * VISU_GL_CAMERA_PHI: 95 * 96 * Value used in the visu_gl_camera_setThetaPhiOmega() method to store the phi angle. 97 */ 98 #define VISU_GL_CAMERA_PHI (1 << 2) 99 /** 100 * VISU_GL_CAMERA_OMEGA: 101 * 102 * Value used in the visu_gl_camera_setThetaPhiOmega() method to store the omega angle. 103 */ 104 #define VISU_GL_CAMERA_OMEGA (1 << 3) 105 int visu_gl_camera_setThetaPhiOmega(VisuGlCamera *camera, float valueTheta, 106 float valuePhi, float valueOmega, int mask); 107 /** 108 * VISU_GL_CAMERA_XS: 109 * 110 * Value used in the visu_gl_camera_setXsYs() method to store the horizontal offset. 111 */ 112 #define VISU_GL_CAMERA_XS (1 << 1) 113 /** 114 * VISU_GL_CAMERA_YS: 115 * 116 * Value used in the visu_gl_camera_setXsYs() method to store the vertical offset. 117 */ 118 #define VISU_GL_CAMERA_YS (1 << 2) 119 int visu_gl_camera_setXsYs(VisuGlCamera *camera, 120 float valueX, float valueY, int mask); 121 gboolean visu_gl_camera_setGross(VisuGlCamera *camera, float value); 122 gboolean visu_gl_camera_setPersp(VisuGlCamera *camera, float value); 123 124 gboolean visu_gl_camera_setRefLength(VisuGlCamera *camera, float value, ToolUnits unit); 125 float visu_gl_camera_getRefLength(VisuGlCamera *camera, ToolUnits *unit); 126 void visu_gl_camera_setUpAxis(VisuGlCamera *camera, ToolXyzDir upAxis); 127 void visu_gl_camera_getScreenAxes(VisuGlCamera *camera, float xAxis[3], float yAxis[3]); 128 129 #undef near 130 #undef far 131 typedef struct _VisuGlWindow VisuGlWindow; 132 struct _VisuGlWindow 133 { 134 float extens; 135 ToolUnits unit; 136 137 guint width, height; 138 double near, far; 139 double left, right, bottom, top; 140 }; 141 gboolean visu_gl_window_setViewport(VisuGlWindow *window, guint width, guint height); 142 gboolean visu_gl_window_setAddLength(VisuGlWindow *window, float value, ToolUnits unit); 143 float visu_gl_window_getAddLength(VisuGlWindow *window, ToolUnits *unit); 144 float visu_gl_window_getFileUnitPerPixel(VisuGlWindow *window); 145 146 /***************************/ 147 /* The #VisuGlView object. */ 148 /***************************/ 149 /** 150 * VISU_TYPE_GL_VIEW: 151 * 152 * The type of #VisuGlView objects. 153 */ 154 #define VISU_TYPE_GL_VIEW (visu_gl_view_get_type()) 155 /** 156 * VISU_GL_VIEW: 157 * @obj: a #GObject to cast. 158 * 159 * Cast the given @obj into #VisuGlView type. 160 */ 161 #define VISU_GL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, VISU_TYPE_GL_VIEW, VisuGlView)) 162 /** 163 * VISU_GL_VIEW_CLASS: 164 * @klass: a #GObjectClass to cast. 165 * 166 * Cast the given @klass into #VisuGlViewClass. 167 */ 168 #define VISU_GL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, VISU_TYPE_GL_VIEW, VisuGlViewClass)) 169 /** 170 * VISU_IS_GL_VIEW: 171 * @obj: a #GObject to test. 172 * 173 * Test if the given @ogj is of the type of #VisuGlView object. 174 */ 175 #define VISU_IS_GL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, VISU_TYPE_GL_VIEW)) 176 /** 177 * VISU_IS_GL_VIEW_CLASS: 178 * @klass: a #GObjectClass to test. 179 * 180 * Test if the given @klass is of the type of #VisuGlViewClass class. 181 */ 182 #define VISU_IS_GL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE(klass, VISU_TYPE_GL_VIEW)) 183 /** 184 * VISU_GL_VIEW_GET_CLASS: 185 * @obj: a #GObject to get the class of. 186 * 187 * It returns the class of the given @obj. 188 */ 189 #define VISU_GL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, VISU_TYPE_GL_VIEW, VisuGlViewClass)) 190 191 typedef struct _VisuGlViewPrivate VisuGlViewPrivate; 192 typedef struct _VisuGlView VisuGlView; 193 194 /** 195 * VisuGlView: 196 * 197 * A container structure to deal with OpenGL observer position, size of rendering 198 * viewport... 199 */ 200 struct _VisuGlView 201 { 202 VisuObject parent; 203 204 VisuGlCamera camera; 205 VisuGlWindow window; 206 207 VisuGlViewPrivate *priv; 208 }; 209 210 typedef struct _VisuGlViewClass VisuGlViewClass; 211 /** 212 * VisuGlViewClass: 213 * @parent: the parent class. 214 * 215 * An opaque structure. 216 */ 217 struct _VisuGlViewClass 218 { 219 VisuObjectClass parent; 220 }; 221 222 GType visu_gl_view_get_type(void); 223 VisuGlView* visu_gl_view_new(void); 224 VisuGlView* visu_gl_view_new_withSize(guint w, guint h); 225 226 void visu_gl_view_initContext(VisuGlView *view); 227 gboolean visu_gl_view_setThetaPhiOmega(VisuGlView *view, float valueTheta, 228 float valuePhi, float valueOmega, int mask); 229 gboolean visu_gl_view_setXsYs(VisuGlView *view, 230 float valueX, float valueY, int mask); 231 gboolean visu_gl_view_setGross(VisuGlView *view, float value); 232 gboolean visu_gl_view_setPersp(VisuGlView *view, float value); 233 234 gboolean visu_gl_view_setRefLength(VisuGlView *view, float lg, ToolUnits units); 235 gboolean visu_gl_view_setObjectRadius(VisuGlView *view, float lg, ToolUnits units); 236 gboolean visu_gl_view_setViewport(VisuGlView *view, guint width, guint height); 237 238 gint visu_gl_view_getDetailLevel(const VisuGlView *view, float dimension); 239 void visu_gl_view_rotateBox(VisuGlView *view, float dTheta, float dPhi, float angles[2]); 240 void visu_gl_view_rotateCamera(VisuGlView *view, float dTheta, float dPhi, float angles[3]); 241 void visu_gl_view_alignToAxis(VisuGlView *view, ToolXyzDir axis); 242 float visu_gl_view_getZCoordinate(VisuGlView *view, float xyz[3]); 243 void visu_gl_view_getRealCoordinates(VisuGlView *view, float xyz[3], 244 float winx, float winy, float winz); 245 246 gboolean visu_gl_view_setPrecision(VisuGlView *view, float value); 247 float visu_gl_view_getPrecision(const VisuGlView *view); 248 249 G_END_DECLS 250 251 #endif 252