Blender  V2.59
view3d_intern.h
Go to the documentation of this file.
00001 /*
00002  * $Id: view3d_intern.h 38919 2011-08-02 08:12:50Z campbellbarton $
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) 2008 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s): Blender Foundation
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00033 #ifndef ED_VIEW3D_INTERN_H
00034 #define ED_VIEW3D_INTERN_H
00035 
00036 #include "ED_view3d.h"
00037 
00038 /* internal exports only */
00039 
00040 struct bScreen;
00041 struct ARegion;
00042 struct BoundBox;
00043 struct Object;
00044 struct DerivedMesh;
00045 struct wmOperatorType;
00046 struct bContext;
00047 struct wmWindowManager;
00048 struct EditMesh;
00049 struct ViewContext;
00050 struct ARegionType;
00051 struct bPoseChannel;
00052 struct bAnimVizSettings;
00053 struct bMotionPath;
00054 struct wmNDOFMotionData;
00055 
00056 #define BL_NEAR_CLIP 0.001
00057 
00058 /* drawing flags: */
00059 #define DRAW_PICKING    1
00060 #define DRAW_CONSTCOLOR 2
00061 #define DRAW_SCENESET   4
00062 
00063 /* view3d_header.c */
00064 void view3d_header_buttons(const struct bContext *C, struct ARegion *ar);
00065 void VIEW3D_OT_layers(struct wmOperatorType *ot);
00066 
00067 /* view3d_ops.c */
00068 void view3d_operatortypes(void);
00069 
00070 /* view3d_edit.c */
00071 void VIEW3D_OT_zoom(struct wmOperatorType *ot);
00072 void VIEW3D_OT_dolly(struct wmOperatorType *ot);
00073 void VIEW3D_OT_zoom_camera_1_to_1(struct wmOperatorType *ot);
00074 void VIEW3D_OT_move(struct wmOperatorType *ot);
00075 void VIEW3D_OT_rotate(struct wmOperatorType *ot);
00076 void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot);
00077 void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot);
00078 void VIEW3D_OT_view_all(struct wmOperatorType *ot);
00079 void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot);
00080 void VIEW3D_OT_view_selected(struct wmOperatorType *ot);
00081 void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot);
00082 void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot);
00083 void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
00084 void VIEW3D_OT_view_persportho(struct wmOperatorType *ot);
00085 void VIEW3D_OT_background_image_add(struct wmOperatorType *ot);
00086 void VIEW3D_OT_background_image_remove(struct wmOperatorType *ot);
00087 void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
00088 void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
00089 void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
00090 void VIEW3D_OT_manipulator(struct wmOperatorType *ot);
00091 void VIEW3D_OT_enable_manipulator(struct wmOperatorType *ot);
00092 void VIEW3D_OT_render_border(struct wmOperatorType *ot);
00093 void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
00094 void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
00095 
00096 void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
00097 void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4]);
00098 float ndof_to_axis_angle(struct wmNDOFMotionData* ndof, float axis[3]);
00099 
00100 /* view3d_fly.c */
00101 void view3d_keymap(struct wmKeyConfig *keyconf);
00102 void VIEW3D_OT_fly(struct wmOperatorType *ot);
00103 
00104 /* drawanim.c */
00105 void draw_motion_paths_init(View3D *v3d, struct ARegion *ar);
00106 void draw_motion_path_instance(Scene *scene,
00107                         struct Object *ob, struct bPoseChannel *pchan, 
00108                         struct bAnimVizSettings *avs, struct bMotionPath *mpath);
00109 void draw_motion_paths_cleanup(View3D *v3d);
00110 
00111 
00112 
00113 /* drawobject.c */
00114 void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int flag);
00115 int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, int dt);
00116 void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, int dt, int outline);
00117 void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
00118 void drawaxes(float size, char drawtype);
00119 
00120 void view3d_cached_text_draw_begin(void);
00121 void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
00122 void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4]);
00123 #define V3D_CACHE_TEXT_ZBUF                     (1<<0)
00124 #define V3D_CACHE_TEXT_WORLDSPACE       (1<<1)
00125 #define V3D_CACHE_TEXT_ASCII            (1<<2)
00126 
00127 /* drawarmature.c */
00128 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
00129 
00130 /* drawmesh.c */
00131 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
00132 
00133 /* view3d_draw.c */
00134 void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
00135 void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void *));
00136 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
00137 void view3d_clr_clipping(void);
00138 void view3d_set_clipping(RegionView3D *rv3d);
00139 void add_view3d_after(ListBase *lb, Base *base, int flag);
00140 void view3d_viewborder_size_get(struct Scene *scene, struct ARegion *ar, float size_r[2]);
00141 
00142 void circf(float x, float y, float rad);
00143 void circ(float x, float y, float rad);
00144 void view3d_update_depths_rect(struct ARegion *ar, struct ViewDepths *d, struct rcti *rect);
00145 float view3d_depth_near(struct ViewDepths *d);
00146 
00147 /* view3d_select.c */
00148 void VIEW3D_OT_select(struct wmOperatorType *ot);
00149 void VIEW3D_OT_select_extend(struct wmOperatorType *ot);
00150 void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
00151 void VIEW3D_OT_select_border(struct wmOperatorType *ot);
00152 void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
00153 
00154 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
00155 void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
00156 void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
00157 void VIEW3D_OT_localview(struct wmOperatorType *ot);
00158 void VIEW3D_OT_game_start(struct wmOperatorType *ot);
00159 
00160 
00161 int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
00162 
00163 void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
00164 
00165 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect);  /* rect: for picking */
00166 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
00167 
00168 void fly_modal_keymap(struct wmKeyConfig *keyconf);
00169 void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
00170 void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
00171 void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
00172 void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
00173 
00174 /* view3d_buttons.c */
00175 void VIEW3D_OT_properties(struct wmOperatorType *ot);
00176 void view3d_buttons_register(struct ARegionType *art);
00177 
00178 /* view3d_toolbar.c */
00179 void VIEW3D_OT_toolshelf(struct wmOperatorType *ot);
00180 void view3d_toolshelf_register(struct ARegionType *art);
00181 void view3d_tool_props_register(struct ARegionType *art);
00182 
00183 /* view3d_snap.c */
00184 int minmax_verts(struct Object *obedit, float *min, float *max);
00185 
00186 void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot);
00187 void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot);
00188 void VIEW3D_OT_snap_cursor_to_grid(struct wmOperatorType *ot);
00189 void VIEW3D_OT_snap_cursor_to_center(struct wmOperatorType *ot);
00190 void VIEW3D_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
00191 void VIEW3D_OT_snap_cursor_to_active(struct wmOperatorType *ot);
00192 
00193 /* space_view3d.c */
00194 ARegion *view3d_has_buttons_region(ScrArea *sa);
00195 ARegion *view3d_has_tools_region(ScrArea *sa);
00196 
00197 extern const char *view3d_context_dir[]; /* doc access */
00198 
00199 /* draw_volume.c */
00200 void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);
00201 
00202 /* workaround for trivial but noticable camera bug caused by imprecision
00203  * between view border calculation in 2D/3D space, workaround for bug [#28037].
00204  * without this deifne we get the old behavior which is to try and align them
00205  * both which _mostly_ works fine, but when the camera moves beyond ~1000 in
00206  * any direction it starts to fail */
00207 #define VIEW3D_CAMERA_BORDER_HACK
00208 #ifdef VIEW3D_CAMERA_BORDER_HACK
00209 extern float view3d_camera_border_hack_col[4];
00210 extern short view3d_camera_border_hack_test;
00211 #endif
00212 
00213 #endif /* ED_VIEW3D_INTERN_H */
00214