|
Blender
V2.59
|
00001 /* 00002 * $Id: DNA_view3d_types.h 38908 2011-08-02 04:28:05Z merwin $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 #ifndef DNA_VIEW3D_TYPES_H 00030 #define DNA_VIEW3D_TYPES_H 00031 00036 struct ViewDepths; 00037 struct Object; 00038 struct Image; 00039 struct Tex; 00040 struct SpaceLink; 00041 struct Base; 00042 struct BoundBox; 00043 struct RenderInfo; 00044 struct bGPdata; 00045 struct SmoothViewStore; 00046 struct wmTimer; 00047 00048 /* This is needed to not let VC choke on near and far... old 00049 * proprietary MS extensions... */ 00050 #ifdef WIN32 00051 #undef near 00052 #undef far 00053 #define near clipsta 00054 #define far clipend 00055 #endif 00056 00057 #include "DNA_listBase.h" 00058 #include "DNA_image_types.h" 00059 00060 /* ******************************** */ 00061 00062 /* The near/far thing is a Win EXCEPTION. Thus, leave near/far in the 00063 * code, and patch for windows. */ 00064 00065 /* Background Picture in 3D-View */ 00066 typedef struct BGpic { 00067 struct BGpic *next, *prev; 00068 00069 struct Image *ima; 00070 struct ImageUser iuser; 00071 float xof, yof, size, blend; 00072 short view; 00073 short flag; 00074 float pad2; 00075 } BGpic; 00076 00077 /* ********************************* */ 00078 00079 typedef struct RegionView3D { 00080 00081 float winmat[4][4]; /* GL_PROJECTION matrix */ 00082 float viewmat[4][4]; /* GL_MODELVIEW matrix */ 00083 float viewinv[4][4]; /* inverse of viewmat */ 00084 float persmat[4][4]; /* viewmat*winmat */ 00085 float persinv[4][4]; /* inverse of persmat */ 00086 00087 /* viewmat/persmat multiplied with object matrix, while drawing and selection */ 00088 float viewmatob[4][4]; 00089 float persmatob[4][4]; 00090 00091 /* transform widget matrix */ 00092 float twmat[4][4]; 00093 00094 float viewquat[4]; /* view rotation, must be kept normalized */ 00095 float dist; /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */ 00096 float zfac; /* initgrabz() result */ 00097 float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ 00098 float pixsize; /* runtime only */ 00099 float ofs[3]; /* view center & orbit pivot, negative of worldspace location, 00100 * also matches -viewinv[3][0:3] in ortho mode.*/ 00101 short camzoom; /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */ 00102 short twdrawflag; 00103 char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since 00104 * it can have cameras assigned as well. (only set in setwinmatrixview3d) */ 00105 char pad[3]; 00106 00107 short rflag, viewlock; 00108 short persp; 00109 short view; 00110 00111 /* user defined clipping planes */ 00112 float clip[6][4]; 00113 float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */ 00114 struct BoundBox *clipbb; 00115 00116 struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ 00117 00118 struct RegionView3D *localvd; /* allocated backup of its self while in localview */ 00119 struct RenderInfo *ri; 00120 struct ViewDepths *depths; 00121 00122 /* animated smooth view */ 00123 struct SmoothViewStore *sms; 00124 struct wmTimer *smooth_timer; 00125 00126 /* last view */ 00127 float lviewquat[4]; 00128 short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */ 00129 float gridview; 00130 00131 float twangle[3]; 00132 00133 /* active rotation from NDOF or elsewhere */ 00134 float rot_angle; 00135 float rot_axis[3]; 00136 00137 char pad2[4]; 00138 00139 } RegionView3D; 00140 00141 /* 3D ViewPort Struct */ 00142 typedef struct View3D { 00143 struct SpaceLink *next, *prev; 00144 ListBase regionbase; /* storage of regions for inactive spaces */ 00145 int spacetype; 00146 float blockscale; 00147 short blockhandler[8]; 00148 00149 float viewquat[4], dist, pad1; /* XXX depricated */ 00150 00151 unsigned int lay_used; /* used while drawing */ 00152 00153 short persp; /* XXX depricated */ 00154 short view; /* XXX depricated */ 00155 00156 struct Object *camera, *ob_centre; 00157 00158 struct ListBase bgpicbase; 00159 struct BGpic *bgpic; /* deprecated, use bgpicbase, only kept for do_versions(...) */ 00160 00161 struct View3D *localvd; /* allocated backup of its self while in localview */ 00162 00163 char ob_centre_bone[32]; /* optional string for armature bone to define center */ 00164 00165 unsigned int lay; 00166 int layact; 00167 00171 short drawtype; 00172 short ob_centre_cursor; /* optional bool for 3d cursor to define center */ 00173 short scenelock, around; 00174 short flag, flag2; 00175 00176 float lens, grid; 00177 float near, far; 00178 float ofs[3]; /* XXX deprecated */ 00179 float cursor[3]; 00180 00181 short modeselect; 00182 short gridlines; 00183 short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ 00184 char gridflag; 00185 00186 /* transform widget info */ 00187 char twtype, twmode, twflag, pad2[2]; 00188 00189 /* afterdraw, for xray & transparent */ 00190 struct ListBase afterdraw_transp; 00191 struct ListBase afterdraw_xray; 00192 struct ListBase afterdraw_xraytransp; 00193 00194 /* drawflags, denoting state */ 00195 short zbuf, transp, xray; 00196 00197 char pad3[2]; 00198 00199 void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */ 00200 00201 /* XXX depricated? */ 00202 struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ 00203 00204 } View3D; 00205 00206 00207 /* View3D->flag (short) */ 00208 /*#define V3D_DISPIMAGE 1*/ /*UNUSED*/ 00209 #define V3D_DISPBGPICS 2 00210 #define V3D_HIDE_HELPLINES 4 00211 #define V3D_INVALID_BACKBUF 8 00212 00213 #define V3D_ALIGN 1024 00214 #define V3D_SELECT_OUTLINE 2048 00215 #define V3D_ZBUF_SELECT 4096 00216 #define V3D_GLOBAL_STATS 8192 00217 #define V3D_DRAW_CENTERS 32768 00218 00219 /* RegionView3d->persp */ 00220 #define RV3D_ORTHO 0 00221 #define RV3D_PERSP 1 00222 #define RV3D_CAMOB 2 00223 00224 /* RegionView3d->rflag */ 00225 #define RV3D_CLIPPING 4 00226 #define RV3D_NAVIGATING 8 00227 #define RV3D_GPULIGHT_UPDATE 16 00228 00229 /* RegionView3d->viewlock */ 00230 #define RV3D_LOCKED 1 00231 #define RV3D_BOXVIEW 2 00232 #define RV3D_BOXCLIP 4 00233 00234 /* RegionView3d->view */ 00235 #define RV3D_VIEW_USER 0 00236 #define RV3D_VIEW_FRONT 1 00237 #define RV3D_VIEW_BACK 2 00238 #define RV3D_VIEW_LEFT 3 00239 #define RV3D_VIEW_RIGHT 4 00240 #define RV3D_VIEW_TOP 5 00241 #define RV3D_VIEW_BOTTOM 6 00242 #define RV3D_VIEW_PERSPORTHO 7 00243 #define RV3D_VIEW_CAMERA 8 00244 00245 /* View3d->flag2 (short) */ 00246 #define V3D_RENDER_OVERRIDE 4 00247 #define V3D_SOLID_TEX 8 00248 #define V3D_DISPGP 16 00249 #define V3D_LOCK_CAMERA 32 00250 00251 /* View3D->around */ 00252 #define V3D_CENTER 0 00253 #define V3D_CENTROID 3 00254 #define V3D_CURSOR 1 00255 #define V3D_LOCAL 2 00256 #define V3D_ACTIVE 4 00257 00258 /*View3D types (only used in tools, not actually saved)*/ 00259 #define V3D_VIEW_STEPLEFT 1 00260 #define V3D_VIEW_STEPRIGHT 2 00261 #define V3D_VIEW_STEPDOWN 3 00262 #define V3D_VIEW_STEPUP 4 00263 #define V3D_VIEW_PANLEFT 5 00264 #define V3D_VIEW_PANRIGHT 6 00265 #define V3D_VIEW_PANDOWN 7 00266 #define V3D_VIEW_PANUP 8 00267 00268 /* View3d->gridflag */ 00269 #define V3D_SHOW_FLOOR 1 00270 #define V3D_SHOW_X 2 00271 #define V3D_SHOW_Y 4 00272 #define V3D_SHOW_Z 8 00273 00274 /* View3d->twtype (bits, we can combine them) */ 00275 #define V3D_MANIP_TRANSLATE 1 00276 #define V3D_MANIP_ROTATE 2 00277 #define V3D_MANIP_SCALE 4 00278 00279 /* View3d->twmode */ 00280 #define V3D_MANIP_GLOBAL 0 00281 #define V3D_MANIP_LOCAL 1 00282 #define V3D_MANIP_NORMAL 2 00283 #define V3D_MANIP_VIEW 3 00284 #define V3D_MANIP_GIMBAL 4 00285 #define V3D_MANIP_CUSTOM 5 /* anything of value 5 or higher is custom */ 00286 00287 /* View3d->twflag */ 00288 /* USE = user setting, DRAW = based on selection */ 00289 #define V3D_USE_MANIPULATOR 1 00290 #define V3D_DRAW_MANIPULATOR 2 00291 /* #define V3D_CALC_MANIPULATOR 4 */ /*UNUSED*/ 00292 00293 /* BGPic->flag */ 00294 /* may want to use 1 for select ?*/ 00295 #define V3D_BGPIC_EXPANDED 2 00296 00297 #define RV3D_CAMZOOM_MIN -30 00298 #define RV3D_CAMZOOM_MAX 600 00299 00300 #endif 00301 00302