]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/camera/camera.h
05a2aeaf001d812f897834477c03cd487e5ba8be
[xonotic/netradiant.git] / contrib / camera / camera.h
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 /*
23 Camera plugin for GtkRadiant
24 Copyright (C) 2002 Splash Damage Ltd.
25 */
26
27 #ifndef _CAMERA_H_
28 #define _CAMERA_H_
29
30 #ifdef _WIN32
31         #pragma warning(disable : 4267)
32 #else
33         typedef unsigned char byte;
34 #endif
35
36 class CCamera;
37
38 #include <gtk/gtk.h>
39 #include <glib/gi18n.h>
40
41 #include "str.h"
42
43 #define USE_QERTABLE_DEFINE
44 #include "qerplugin.h"
45
46 #include "igl.h"
47 #include "iui.h"
48 #include "icamera.h"
49
50 #include "misc.h"
51 #include "dialogs.h"
52 #include "funchandlers.h"
53 #include "renderer.h"
54 #include "listener.h"
55
56 extern _QERFuncTable_1    g_FuncTable;
57 extern _QERQglTable       g_QglTable;
58 extern _QERUITable        g_UITable;
59 extern _QERCameraTable          g_CameraTable;
60
61 extern CRenderer          *Renderer;
62 extern CListener          *Listener;
63
64 // splinelib
65 #define CAMERA_PLUGIN
66 #define DotProduct(a,b)                 ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
67
68 extern void ( APIENTRY * qglBegin )(GLenum mode);
69 extern void ( APIENTRY * qglEnd )(void);
70 extern void ( APIENTRY * qglVertex3fv )(const GLfloat *v);
71
72 extern "C" void InitIglToQgl( _QERQglTable *g_QglTable );
73
74 #include "splines/splines.h"
75
76 // this needs to match splines.cpp
77 #define MAX_CAMERAS 64
78 extern idCameraDef camera[MAX_CAMERAS];
79
80 extern "C" qboolean loadCamera(int camNum, const        char *name);
81
82 //
83 // CCamera
84 //
85
86 class CCamera {
87 public:
88   CCamera( int i ) {
89     cam = &camera[i];
90     camnum = i;
91     Init();
92   }
93   ~CCamera();
94
95   void Init() {
96     next = prev = NULL;
97     fileName[0] = '\0';
98                 hasbeensaved = 0;
99   }
100
101   idCameraDef *GetCam() {
102     return( cam );
103   }
104   int GetCamNum() {
105     return( camnum );
106   }
107
108   char *GetFileName() {
109     return( fileName );
110   }
111   void SetFileName( const char *name, bool save ) {
112     strcpy( fileName, name );
113     if( save )
114       hasbeensaved = 1;
115   }
116
117   CCamera *GetNext() {
118     return( next );
119   }
120
121   CCamera *GetPrev() {
122     return( prev );
123   }
124
125   void SetNext( CCamera *camera ) {
126     next = camera;
127   }
128   void SetPrev( CCamera *camera ) {
129     prev = camera;
130   }
131
132         int HasBeenSaved() {
133                 return( hasbeensaved );
134         }
135         void HasBeenModified() {
136                 if( hasbeensaved )
137                         hasbeensaved = 2;
138         }
139
140 protected:
141   idCameraDef *cam;
142   int camnum;
143   CCamera *next, *prev;
144   char fileName[PATH_MAX];
145         int hasbeensaved;       // 0:never saved 1:saved 2:saved, but modified
146 };
147
148 CCamera *AllocCam();
149 void FreeCam( CCamera *cam );
150 void SetCurrentCam( CCamera *cam );
151 CCamera *GetCurrentCam();
152
153 // globals
154 extern GtkWidget *g_pRadiantWnd;
155 extern GtkWidget *g_pCameraInspectorWnd;
156 extern CCamera *firstCam;
157 extern bool g_bEditOn;
158 extern int g_iEditMode;
159 extern int g_iActiveTarget;
160 extern int g_iPreviewRunning;
161 extern CCamera *g_pCurrentEditCam;
162
163 #endif // _CAMERA_H_