/* gl_preview.h - headers for OpenGL preview * * Copyright (C) 2002 Patrice St-Gelais * patrstg@users.sourceforge.net * www.oricom.ca/patrice.st-gelais * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GLPREVIEW #define _GLPREVIEW 1 #include "globals.h" #include "camera.h" typedef struct { gfloat x; gfloat y; gfloat z; gfloat nx; gfloat ny; gfloat nz; char nb; } vertex; typedef struct { gint view_size; gint mesh_size; gint drawing_mesh_size; gint scale; gboolean direct_upd; gboolean show_subdialog; camera_struct *cameras[NBCAMERAS]; } gl_defaults_struct; typedef struct { gboolean mouse_dragging1; gboolean mouse_dragging2; gboolean mouse_dragging3; gint last_x; // Last mouse position, any button gint last_y; // (for managing mouse dragging) gint view_size; // Current size of the viewport (== size of the GL hf in pixels) // Default: 1/2 the default HF size, 2x the mesh size gint mesh_size; gint drawing_mesh_size; vertex *hf; // gint scale; // The mesh size, related to the HF size: // 4, 3, 2, 1, 0 = 6, 12, 25, 50, 100 % // mesh_size = hf_size >> scale // Default : 2 -> 25% gint mesh_size_backup; // Backup for main mesh size when using low res mesh gint hf_list; gint current_camera_id; // From 0 to NBCAMERAS-1 - updated by a radio button camera_struct *cameras[NBCAMERAS]; gboolean refresh_on_mouse_down; GtkObject *adj_rot_y; GtkObject *adj_rot_x; GtkObject *adj_distance; GtkObject *adj_translate_x; GtkObject *adj_translate_y; GtkObject *adj_angle_w; GtkWidget *gl_dialog; GtkWidget *main_box; GtkWidget *refresh_button; GtkWidget *direct_upd; GtkWidget *gl_area; GtkWidget *details_percent_lbl; } gl_preview_struct; // Private methods GtkWidget *create_glarea (gpointer callb_data, gint min_size); gint glarea_button_release (GtkWidget*, GdkEventButton*, gpointer); gint glarea_button_press (GtkWidget*, GdkEventButton*, gpointer); gint glarea_motion_notify (GtkWidget*, GdkEventMotion*, gpointer); gint glarea_draw (GtkWidget*, GdkEventExpose*,gpointer); gint glarea_reshape (GtkWidget*, GdkEventConfigure*, gpointer); gint glarea_init (GtkWidget*, gpointer); gint glarea_destroy (GtkWidget*, gpointer); gint glarea_destroy (GtkWidget*, gpointer); void refresh_gl_callb(GtkWidget *refresh_button, gpointer hfw); void gl_details_min (gpointer hfw); void gl_details_restore (gpointer hfw); gint gl_no_refresh_callb (GtkWidget *wdg, GdkEventButton *event, gpointer data); gint gl_restore_refresh_callb (GtkWidget *wdg, GdkEventButton *event, gpointer data); void gl_preview_optimize (GtkWidget *scale, gpointer data); void gl_preview_free (gl_preview_struct *gl_preview, gboolean creation_mode); /****************************************************************************************/ // Public methods void gl_area_update(gpointer hfw) ; // hf_wrapper_struct * gl_defaults_struct *gl_defaults_init( ); gl_preview_struct *create_preview_dialog (gl_defaults_struct *gl_def, gpointer callb_data); #endif // _GLPREVIEW