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