2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2008 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/editors/space_view3d/view3d_intern.h
31 #ifndef __VIEW3D_INTERN_H__
32 #define __VIEW3D_INTERN_H__
34 #include "ED_view3d.h"
36 /* internal exports only */
44 struct bAnimVizSettings;
49 struct wmNDOFMotionData;
50 struct wmOperatorType;
51 struct wmWindowManager;
53 #define BL_NEAR_CLIP 0.001
57 DRAW_PICKING = (1 << 0),
58 DRAW_CONSTCOLOR = (1 << 1),
59 DRAW_SCENESET = (1 << 2)
62 /* draw_mesh_fancy/draw_mesh_textured draw_flags */
64 DRAW_MODIFIERS_PREVIEW = (1 << 0),
65 DRAW_FACE_SELECT = (1 << 1)
69 void VIEW3D_OT_layers(struct wmOperatorType *ot);
72 void view3d_operatortypes(void);
75 void VIEW3D_OT_zoom(struct wmOperatorType *ot);
76 void VIEW3D_OT_dolly(struct wmOperatorType *ot);
77 void VIEW3D_OT_zoom_camera_1_to_1(struct wmOperatorType *ot);
78 void VIEW3D_OT_move(struct wmOperatorType *ot);
79 void VIEW3D_OT_rotate(struct wmOperatorType *ot);
80 void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot);
81 void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot);
82 void VIEW3D_OT_ndof_all(struct wmOperatorType *ot);
83 void VIEW3D_OT_view_all(struct wmOperatorType *ot);
84 void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot);
85 void VIEW3D_OT_view_selected(struct wmOperatorType *ot);
86 void VIEW3D_OT_view_lock_clear(struct wmOperatorType *ot);
87 void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot);
88 void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot);
89 void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot);
90 void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
91 void VIEW3D_OT_view_persportho(struct wmOperatorType *ot);
92 void VIEW3D_OT_background_image_add(struct wmOperatorType *ot);
93 void VIEW3D_OT_background_image_remove(struct wmOperatorType *ot);
94 void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
95 void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
96 void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
97 void VIEW3D_OT_manipulator(struct wmOperatorType *ot);
98 void VIEW3D_OT_enable_manipulator(struct wmOperatorType *ot);
99 void VIEW3D_OT_render_border(struct wmOperatorType *ot);
100 void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
102 void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
103 void ndof_to_quat(struct wmNDOFMotionData *ndof, float q[4]);
104 float ndof_to_axis_angle(struct wmNDOFMotionData *ndof, float axis[3]);
107 void view3d_keymap(struct wmKeyConfig *keyconf);
108 void VIEW3D_OT_fly(struct wmOperatorType *ot);
111 void draw_motion_paths_init(View3D *v3d, struct ARegion *ar);
112 void draw_motion_path_instance(Scene *scene,
113 struct Object *ob, struct bPoseChannel *pchan,
114 struct bAnimVizSettings *avs, struct bMotionPath *mpath);
115 void draw_motion_paths_cleanup(View3D *v3d);
120 void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, const short dflag);
121 int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const short dt);
122 void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const short dt, int outline);
123 void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
124 void drawaxes(float size, char drawtype);
126 void view3d_cached_text_draw_begin(void);
127 void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
128 void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, float mat[][4]);
131 V3D_CACHE_TEXT_ZBUF = (1 << 0),
132 V3D_CACHE_TEXT_WORLDSPACE = (1 << 1),
133 V3D_CACHE_TEXT_ASCII = (1 << 2),
134 V3D_CACHE_TEXT_GLOBALSPACE = (1 << 3),
135 V3D_CACHE_TEXT_LOCALCLIP = (1 << 4)
139 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
140 const short dt, const short dflag, const unsigned char ob_wire_col[4],
141 const short is_outline);
144 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
145 struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
146 void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
147 struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
150 void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
151 void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *));
152 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
153 void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag);
155 void circf(float x, float y, float rad);
156 void circ(float x, float y, float rad);
157 void view3d_update_depths_rect(struct ARegion *ar, struct ViewDepths *d, struct rcti *rect);
158 float view3d_depth_near(struct ViewDepths *d);
160 /* view3d_select.c */
161 void VIEW3D_OT_select(struct wmOperatorType *ot);
162 void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
163 void VIEW3D_OT_select_border(struct wmOperatorType *ot);
164 void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
165 void VIEW3D_OT_select_menu(struct wmOperatorType *ot);
167 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
168 void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot);
169 void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot);
170 void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
171 void VIEW3D_OT_localview(struct wmOperatorType *ot);
172 void VIEW3D_OT_game_start(struct wmOperatorType *ot);
175 int ED_view3d_boundbox_clip(RegionView3D * rv3d, float obmat[][4], struct BoundBox *bb);
177 void view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
178 float *ofs, float *quat, float *dist, float *lens);
180 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
181 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
183 void fly_modal_keymap(struct wmKeyConfig *keyconf);
184 void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
185 void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
186 void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
187 void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
189 /* view3d_buttons.c */
190 void VIEW3D_OT_properties(struct wmOperatorType *ot);
191 void view3d_buttons_register(struct ARegionType *art);
193 /* view3d_toolbar.c */
194 void VIEW3D_OT_toolshelf(struct wmOperatorType *ot);
195 void view3d_toolshelf_register(struct ARegionType *art);
196 void view3d_tool_props_register(struct ARegionType *art);
199 int ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
201 void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot);
202 void VIEW3D_OT_snap_selected_to_cursor(struct wmOperatorType *ot);
203 void VIEW3D_OT_snap_cursor_to_grid(struct wmOperatorType *ot);
204 void VIEW3D_OT_snap_cursor_to_center(struct wmOperatorType *ot);
205 void VIEW3D_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
206 void VIEW3D_OT_snap_cursor_to_active(struct wmOperatorType *ot);
209 ARegion *view3d_has_buttons_region(ScrArea *sa);
210 ARegion *view3d_has_tools_region(ScrArea *sa);
212 extern const char *view3d_context_dir[]; /* doc access */
215 void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float min[3], float max[3], int res[3], float dx, struct GPUTexture *tex_shadow);
217 /* workaround for trivial but noticeable camera bug caused by imprecision
218 * between view border calculation in 2D/3D space, workaround for bug [#28037].
219 * without this deifne we get the old behavior which is to try and align them
220 * both which _mostly_ works fine, but when the camera moves beyond ~1000 in
221 * any direction it starts to fail */
222 #define VIEW3D_CAMERA_BORDER_HACK
223 #ifdef VIEW3D_CAMERA_BORDER_HACK
224 extern unsigned char view3d_camera_border_hack_col[3];
225 extern short view3d_camera_border_hack_test;
228 #endif /* __VIEW3D_INTERN_H__ */