]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/camera/camera.h
Backing out r347 and r345. Keeping r346.
[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
40 #include "str.h"
41
42 #define USE_QERTABLE_DEFINE
43 #include "qerplugin.h"
44
45 #include "igl.h"
46 #include "iui.h"
47 #include "icamera.h"
48
49 #include "misc.h"
50 #include "dialogs.h"
51 #include "funchandlers.h"
52 #include "renderer.h"
53 #include "listener.h"
54
55 extern _QERFuncTable_1    g_FuncTable;
56 extern _QERQglTable       g_QglTable;
57 extern _QERUITable        g_UITable;
58 extern _QERCameraTable          g_CameraTable;
59
60 extern CRenderer          *Renderer;
61 extern CListener          *Listener;
62
63 // splinelib
64 #define CAMERA_PLUGIN
65 #define DotProduct(a,b)                 ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
66
67 extern void ( APIENTRY * qglBegin )(GLenum mode);
68 extern void ( APIENTRY * qglEnd )(void);
69 extern void ( APIENTRY * qglVertex3fv )(const GLfloat *v);
70
71 extern "C" void InitIglToQgl( _QERQglTable *g_QglTable );
72
73 #include "splines/splines.h"
74
75 // this needs to match splines.cpp
76 #define MAX_CAMERAS 64
77 extern idCameraDef camera[MAX_CAMERAS];
78
79 extern "C" qboolean loadCamera(int camNum, const        char *name);
80
81 //
82 // CCamera
83 //
84
85 class CCamera {
86 public:
87   CCamera( int i ) {
88     cam = &camera[i];
89     camnum = i;
90     Init();
91   }
92   ~CCamera();
93
94   void Init() {
95     next = prev = NULL;
96     fileName[0] = '\0';
97                 hasbeensaved = 0;
98   }
99
100   idCameraDef *GetCam() {
101     return( cam );
102   }
103   int GetCamNum() {
104     return( camnum );
105   }
106
107   char *GetFileName() {
108     return( fileName );
109   }
110   void SetFileName( const char *name, bool save ) {
111     strcpy( fileName, name );
112     if( save )
113       hasbeensaved = 1;
114   }
115
116   CCamera *GetNext() {
117     return( next );
118   }
119
120   CCamera *GetPrev() {
121     return( prev );
122   }
123
124   void SetNext( CCamera *camera ) {
125     next = camera;
126   }
127   void SetPrev( CCamera *camera ) {
128     prev = camera;
129   }
130
131         int HasBeenSaved() {
132                 return( hasbeensaved );
133         }
134         void HasBeenModified() {
135                 if( hasbeensaved )
136                         hasbeensaved = 2;
137         }
138
139 protected:
140   idCameraDef *cam;
141   int camnum;
142   CCamera *next, *prev;
143   char fileName[PATH_MAX];
144         int hasbeensaved;       // 0:never saved 1:saved 2:saved, but modified
145 };
146
147 CCamera *AllocCam();
148 void FreeCam( CCamera *cam );
149 void SetCurrentCam( CCamera *cam );
150 CCamera *GetCurrentCam();
151
152 // globals
153 extern GtkWidget *g_pRadiantWnd;
154 extern GtkWidget *g_pCameraInspectorWnd;
155 extern CCamera *firstCam;
156 extern bool g_bEditOn;
157 extern int g_iEditMode;
158 extern int g_iActiveTarget;
159 extern int g_iPreviewRunning;
160 extern CCamera *g_pCurrentEditCam;
161
162 #endif // _CAMERA_H_