Blender V2.61 - r43446

DNA_view3d_types.h

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