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