]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/camera/camera.h
Wrap more GTK
[xonotic/netradiant.git] / contrib / camera / camera.h
1 /*
2    Copyright (C) 1999-2006 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 typedef unsigned char byte;
31
32 #include "mathlib.h"
33 #include <string.h>
34 #include "qertypes.h"
35 #include <stdio.h>
36
37 #define USE_QERTABLE_DEFINE
38 #include "iscenegraph.h"
39 #include "qerplugin.h"
40
41 #define USE_QGLTABLE_DEFINE
42 #include "igl.h"
43 extern _QERQglTable __QGLTABLENAME;
44
45 #include "iui.h"
46 #include "icamera.h"
47
48 #include "bytebool.h"
49
50 class CCamera;
51
52 #include "str.h"
53
54
55 #include "misc.h"
56 #include "dialogs.h"
57 #include "funchandlers.h"
58 #include "renderer.h"
59 #include "listener.h"
60
61 extern _QERFuncTable_1 g_FuncTable;
62 extern _QERQglTable g_QglTable;
63 extern _QERUITable g_UITable;
64 extern _QERCameraTable g_CameraTable;
65
66 extern CRenderer          *Renderer;
67 extern CListener          *Listener;
68
69 // splinelib
70 #define CAMERA_PLUGIN
71 #define DotProduct( a,b )         ( ( a )[0] * ( b )[0] + ( a )[1] * ( b )[1] + ( a )[2] * ( b )[2] )
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 #ifndef PATH_MAX
82 #define PATH_MAX 260
83 #endif
84
85 //
86 // CCamera
87 //
88
89 class CCamera {
90 public:
91 CCamera( int i ) {
92         cam = &camera[i];
93         camnum = i;
94         Init();
95 }
96 ~CCamera();
97
98 void Init() {
99         next = prev = NULL;
100         fileName[0] = '\0';
101         hasbeensaved = 0;
102 }
103
104 idCameraDef *GetCam() {
105         return( cam );
106 }
107 int GetCamNum() {
108         return( camnum );
109 }
110
111 char *GetFileName() {
112         return( fileName );
113 }
114 void SetFileName( const char *name, bool save ) {
115         strcpy( fileName, name );
116         if ( save ) {
117                 hasbeensaved = 1;
118         }
119 }
120
121 CCamera *GetNext() {
122         return( next );
123 }
124
125 CCamera *GetPrev() {
126         return( prev );
127 }
128
129 void SetNext( CCamera *camera ) {
130         next = camera;
131 }
132 void SetPrev( CCamera *camera ) {
133         prev = camera;
134 }
135
136 int HasBeenSaved() {
137         return( hasbeensaved );
138 }
139 void HasBeenModified() {
140         if ( hasbeensaved ) {
141                 hasbeensaved = 2;
142         }
143 }
144
145 protected:
146 idCameraDef *cam;
147 int camnum;
148 CCamera *next, *prev;
149 char fileName[PATH_MAX];
150 int hasbeensaved;       // 0:never saved 1:saved 2:saved, but modified
151 };
152
153 CCamera *AllocCam();
154 void FreeCam( CCamera *cam );
155 void SetCurrentCam( CCamera *cam );
156 CCamera *GetCurrentCam();
157
158 // globals
159 extern ui::Window g_pRadiantWnd;
160 extern ui::Window g_pCameraInspectorWnd;
161 extern CCamera *firstCam;
162 extern bool g_bEditOn;
163 extern int g_iEditMode;
164 extern int g_iActiveTarget;
165 extern int g_iPreviewRunning;
166 extern CCamera *g_pCurrentEditCam;
167
168 #endif // _CAMERA_H_