2 * blenlib/DNA_view3d_types.h (mar-2001 nzc)
6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
31 #ifndef DNA_VIEW3D_TYPES_H
32 #define DNA_VIEW3D_TYPES_H
42 struct RetopoViewData;
44 struct SmoothViewStore;
47 /* This is needed to not let VC choke on near and far... old
48 * proprietary MS extensions... */
56 #include "DNA_listBase.h"
57 #include "DNA_image_types.h"
59 /* ******************************** */
61 /* The near/far thing is a Win EXCEPTION. Thus, leave near/far in the
62 * code, and patch for windows. */
64 /* Background Picture in 3D-View */
65 typedef struct BGpic {
66 struct BGpic *next, *prev;
69 struct ImageUser iuser;
70 float xof, yof, size, blend;
76 /* ********************************* */
78 typedef struct RegionView3D {
80 float winmat[4][4]; /* GL_PROJECTION matrix */
81 float viewmat[4][4]; /* GL_MODELVIEW matrix */
82 float viewinv[4][4]; /* inverse of viewmat */
83 float persmat[4][4]; /* viewmat*winmat */
84 float persinv[4][4]; /* inverse of persmat */
86 /* viewmat/persmat multiplied with object matrix, while drawing and selection */
87 float viewmatob[4][4];
88 float persmatob[4][4];
90 /* transform widget matrix */
93 float viewquat[4], dist, zfac; /* zfac is initgrabz() result */
94 float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */
97 short camzoom, viewbut;
101 short rflag, viewlock;
105 /* user defined clipping planes */
107 float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */
108 struct BoundBox *clipbb;
110 struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */
112 struct RegionView3D *localvd;
113 struct RenderInfo *ri;
114 struct RetopoViewData *retopo_view_data;
115 struct ViewDepths *depths;
117 /* animated smooth view */
118 struct SmoothViewStore *sms;
119 struct wmTimer *smooth_timer;
123 short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
132 /* 3D ViewPort Struct */
133 typedef struct View3D {
134 struct SpaceLink *next, *prev;
135 ListBase regionbase; /* storage of regions for inactive spaces */
138 short blockhandler[8];
140 float viewquat[4], dist, pad1; /* XXX depricated */
142 unsigned int lay_used; /* used while drawing */
144 short persp; /* XXX depricated */
145 short view; /* XXX depricated */
147 struct Object *camera, *ob_centre;
149 struct ListBase bgpicbase;
150 struct BGpic *bgpic; /* deprecated, use bgpicbase, only kept for do_versions(...) */
152 struct View3D *localvd;
154 char ob_centre_bone[32]; /* optional string for armature bone to define center */
160 * The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID,
161 * OB_SHADED or OB_TEXTURE */
163 short ob_centre_cursor; /* optional bool for 3d cursor to define center */
164 short scenelock, around, pad3;
167 short pivot_last; /* pivot_last is for rotating around the last edited element */
170 float gridview; /* XXX deprecated, now in RegionView3D */
171 float padf, near, far;
172 float ofs[3]; /* XXX deprecated */
175 short gridlines, pad4;
177 short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */
179 short keyflags; /* flags for display of keyframes */
181 /* transform widget info */
182 short twtype, twmode, twflag;
183 short twdrawflag; /* XXX deprecated */
185 /* customdata flags from modes */
186 unsigned int customdata_mask;
188 /* afterdraw, for xray & transparent */
189 struct ListBase afterdraw_transp;
190 struct ListBase afterdraw_xray;
191 struct ListBase afterdraw_xraytransp;
193 /* drawflags, denoting state */
194 short zbuf, transp, xray;
196 char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */
197 char ndoffilter; /* filter for 6DOF devices 0 normal, 1 dominant */
199 void *properties_storage; /* Nkey panel stores stuff here, not in file */
201 /* XXX depricated? */
202 struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */
206 /* XXX this needs cleaning */
208 /* View3D->flag (short) */
209 #define V3D_MODE (16+32+64+128+256+512)
210 #define V3D_DISPIMAGE 1
211 #define V3D_DISPBGPICS 2
212 #define V3D_HIDE_HELPLINES 4
213 #define V3D_INVALID_BACKBUF 8
214 #define V3D_EDITMODE 16
215 #define V3D_VERTEXPAINT 32
216 #define V3D_FACESELECT 64
217 #define V3D_POSEMODE 128
218 #define V3D_TEXTUREPAINT 256
219 #define V3D_WEIGHTPAINT 512
220 #define V3D_ALIGN 1024
221 #define V3D_SELECT_OUTLINE 2048
222 #define V3D_ZBUF_SELECT 4096
223 #define V3D_GLOBAL_STATS 8192
224 #define V3D_DRAW_CENTERS 32768
226 /* RegionView3d->persp */
231 /* RegionView3d->rflag */
232 #define RV3D_CLIPPING 4
233 #define RV3D_NAVIGATING 8
234 #define RV3D_GPULIGHT_UPDATE 16
236 /* RegionView3d->viewlock */
237 #define RV3D_LOCKED 1
238 #define RV3D_BOXVIEW 2
239 #define RV3D_BOXCLIP 4
241 /* RegionView3d->view */
242 #define RV3D_VIEW_FRONT 1
243 #define RV3D_VIEW_BACK 2
244 #define RV3D_VIEW_LEFT 3
245 #define RV3D_VIEW_RIGHT 4
246 #define RV3D_VIEW_TOP 5
247 #define RV3D_VIEW_BOTTOM 6
248 #define RV3D_VIEW_PERSPORTHO 7
249 #define RV3D_VIEW_CAMERA 8
251 /* View3d->flag2 (short) */
252 #define V3D_RENDER_OVERRIDE 4
253 #define V3D_SOLID_TEX 8
254 #define V3D_DISPGP 16
258 #define V3D_CENTROID 3
263 /*View3D types (only used in tools, not actually saved)*/
264 #define V3D_VIEW_STEPLEFT 1
265 #define V3D_VIEW_STEPRIGHT 2
266 #define V3D_VIEW_STEPDOWN 3
267 #define V3D_VIEW_STEPUP 4
268 #define V3D_VIEW_PANLEFT 5
269 #define V3D_VIEW_PANRIGHT 6
270 #define V3D_VIEW_PANDOWN 7
271 #define V3D_VIEW_PANUP 8
273 /* View3d->gridflag */
274 #define V3D_SHOW_FLOOR 1
279 /* View3d->twtype (bits, we can combine them) */
280 #define V3D_MANIP_TRANSLATE 1
281 #define V3D_MANIP_ROTATE 2
282 #define V3D_MANIP_SCALE 4
285 #define V3D_MANIP_GLOBAL 0
286 #define V3D_MANIP_LOCAL 1
287 #define V3D_MANIP_NORMAL 2
288 #define V3D_MANIP_VIEW 3
289 #define V3D_MANIP_GIMBAL 4
290 #define V3D_MANIP_CUSTOM 5 /* anything of value 5 or higher is custom */
293 /* USE = user setting, DRAW = based on selection */
294 #define V3D_USE_MANIPULATOR 1
295 #define V3D_DRAW_MANIPULATOR 2
296 #define V3D_CALC_MANIPULATOR 4
299 /* may want to use 1 for select ?*/
300 #define V3D_BGPIC_EXPANDED 2
302 #define RV3D_CAMZOOM_MIN -30
303 #define RV3D_CAMZOOM_MAX 600