4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
33 #include "DNA_action_types.h"
34 #include "DNA_armature_types.h"
35 #include "DNA_camera_types.h"
36 #include "DNA_group_types.h"
37 #include "DNA_key_types.h"
38 #include "DNA_object_types.h"
39 #include "DNA_space_types.h"
40 #include "DNA_scene_types.h"
41 #include "DNA_screen_types.h"
42 #include "DNA_userdef_types.h"
43 #include "DNA_view3d_types.h"
44 #include "DNA_world_types.h"
46 #include "MEM_guardedalloc.h"
48 #include "BLI_blenlib.h"
49 #include "BLI_arithb.h"
53 #include "BKE_image.h"
56 #include "BKE_object.h"
57 #include "BKE_global.h"
58 #include "BKE_scene.h"
59 #include "BKE_screen.h"
60 #include "BKE_utildefines.h"
62 #include "RE_pipeline.h" // make_stars
64 #include "IMB_imbuf_types.h"
65 #include "IMB_imbuf.h"
68 #include "BIF_glutil.h"
73 #include "ED_keyframing.h"
74 #include "ED_screen.h"
78 #include "UI_interface.h"
79 #include "UI_interface_icons.h"
80 #include "UI_resources.h"
81 #include "UI_view2d.h"
84 #include "GPU_material.h"
86 #include "view3d_intern.h" // own include
90 static void star_stuff_init_func(void)
96 static void star_stuff_vertex_func(float* i)
100 static void star_stuff_term_func(void)
105 void circf(float x, float y, float rad)
107 GLUquadricObj *qobj = gluNewQuadric();
109 gluQuadricDrawStyle(qobj, GLU_FILL);
113 glTranslatef(x, y, 0.);
115 gluDisk( qobj, 0.0, rad, 32, 1);
119 gluDeleteQuadric(qobj);
122 void circ(float x, float y, float rad)
124 GLUquadricObj *qobj = gluNewQuadric();
126 gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
130 glTranslatef(x, y, 0.);
132 gluDisk( qobj, 0.0, rad, 32, 1);
136 gluDeleteQuadric(qobj);
140 /* ********* custom clipping *********** */
142 static void view3d_draw_clipping(View3D *v3d)
144 BoundBox *bb= v3d->clipbb;
146 UI_ThemeColorShade(TH_BACK, -8);
150 glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[3]);
151 glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[1]);
152 glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[5]);
153 glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[3]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[6]);
154 glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[2]);
155 glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[3]);
160 void view3d_set_clipping(View3D *v3d)
166 QUATCOPY(plane, v3d->clip[a]);
167 glClipPlane(GL_CLIP_PLANE0+a, plane);
168 glEnable(GL_CLIP_PLANE0+a);
172 void view3d_clr_clipping(void)
177 glDisable(GL_CLIP_PLANE0+a);
181 int view3d_test_clipping(View3D *v3d, float *vec)
183 /* vec in world coordinates, returns 1 if clipped */
188 if(0.0f < v3d->clip[0][3] + INPR(view, v3d->clip[0]))
189 if(0.0f < v3d->clip[1][3] + INPR(view, v3d->clip[1]))
190 if(0.0f < v3d->clip[2][3] + INPR(view, v3d->clip[2]))
191 if(0.0f < v3d->clip[3][3] + INPR(view, v3d->clip[3]))
197 /* ********* end custom clipping *********** */
200 static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx)
209 while(fx< ar->winx) {
210 fdrawline(fx, 0.0, fx, (float)ar->winy);
218 while(fy< ar->winy) {
219 fdrawline(0.0, fy, (float)ar->winx, fy);
225 // not intern, called in editobject for constraint axis too
226 void make_axis_color(char *col, char *col2, char axis)
229 col2[0]= col[0]>219?255:col[0]+36;
230 col2[1]= col[1]<26?0:col[1]-26;
231 col2[2]= col[2]<26?0:col[2]-26;
234 col2[0]= col[0]<46?0:col[0]-36;
235 col2[1]= col[1]>189?255:col[1]+66;
236 col2[2]= col[2]<46?0:col[2]-36;
239 col2[0]= col[0]<26?0:col[0]-26;
240 col2[1]= col[1]<26?0:col[1]-26;
241 col2[2]= col[2]>209?255:col[2]+46;
246 static void drawgrid(ARegion *ar, View3D *v3d)
248 /* extern short bgpicmode; */
249 float wx, wy, x, y, fw, fx, fy, dx;
251 char col[3], col2[3];
252 short sublines = v3d->gridsubdiv;
254 vec4[0]=vec4[1]=vec4[2]=0.0;
256 Mat4MulVec4fl(v3d->persmat, vec4);
261 wx= (ar->winx/2.0); /* because of rounding errors, grid at wrong location */
267 vec4[0]=vec4[1]=v3d->grid;
270 Mat4MulVec4fl(v3d->persmat, vec4);
275 dx= fabs(x-(wx)*fx/fw);
276 if(dx==0) dx= fabs(y-(wy)*fy/fw);
278 glDepthMask(0); // disable write in zbuffer
281 UI_ThemeColor(TH_GRID);
284 v3d->gridview*= sublines;
288 v3d->gridview*= sublines;
292 v3d->gridview*= sublines;
296 UI_ThemeColor(TH_GRID);
297 drawgrid_draw(ar, wx, wy, x, y, dx);
300 else { // start blending out
301 UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
302 drawgrid_draw(ar, wx, wy, x, y, dx);
304 UI_ThemeColor(TH_GRID);
305 drawgrid_draw(ar, wx, wy, x, y, sublines*dx);
308 else { // start blending out (6 < dx < 60)
309 UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
310 drawgrid_draw(ar, wx, wy, x, y, dx);
312 UI_ThemeColor(TH_GRID);
313 drawgrid_draw(ar, wx, wy, x, y, sublines*dx);
317 if(dx>60.0) { // start blending in
318 v3d->gridview/= sublines;
320 if(dx>60.0) { // start blending in
321 v3d->gridview/= sublines;
324 UI_ThemeColor(TH_GRID);
325 drawgrid_draw(ar, wx, wy, x, y, dx);
328 UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
329 drawgrid_draw(ar, wx, wy, x, y, dx);
330 UI_ThemeColor(TH_GRID);
331 drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
335 UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
336 drawgrid_draw(ar, wx, wy, x, y, dx);
337 UI_ThemeColor(TH_GRID);
338 drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
342 UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
343 drawgrid_draw(ar, wx, wy, x, y, dx);
344 UI_ThemeColor(TH_GRID);
345 drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
351 UI_GetThemeColor3ubv(TH_GRID, col);
356 if(v3d->view==3) make_axis_color(col, col2, 'y');
357 else make_axis_color(col, col2, 'x');
358 glColor3ubv((GLubyte *)col2);
360 fdrawline(0.0, y, (float)ar->winx, y);
362 if(v3d->view==7) make_axis_color(col, col2, 'y');
363 else make_axis_color(col, col2, 'z');
364 glColor3ubv((GLubyte *)col2);
366 fdrawline(x, 0.0, x, (float)ar->winy);
368 glDepthMask(1); // enable write in zbuffer
372 static void drawfloor(View3D *v3d)
375 int a, gridlines, emphasise;
376 char col[3], col2[3];
381 if(v3d->gridlines<3) return;
383 if(v3d->zbuf && G.obedit) glDepthMask(0); // for zbuffer-select
385 gridlines= v3d->gridlines/2;
386 grid= gridlines*v3d->grid;
388 UI_GetThemeColor3ubv(TH_GRID, col);
389 UI_GetThemeColor3ubv(TH_BACK, col2);
391 /* emphasise division lines lighter instead of darker, if background is darker than grid */
392 if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 )
397 /* draw the Y axis and/or grid lines */
398 for(a= -gridlines;a<=gridlines;a++) {
400 /* check for the 'show Y axis' preference */
401 if (v3d->gridflag & V3D_SHOW_Y) {
402 make_axis_color(col, col2, 'y');
403 glColor3ubv((GLubyte *)col2);
406 } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
407 UI_ThemeColorShade(TH_GRID, emphasise);
412 /* check for the 'show grid floor' preference */
413 if (v3d->gridflag & V3D_SHOW_FLOOR) {
415 UI_ThemeColorShade(TH_GRID, emphasise);
417 else UI_ThemeColorShade(TH_GRID, 10);
426 glBegin(GL_LINE_STRIP);
427 vert[0]= a*v3d->grid;
436 /* draw the X axis and/or grid lines */
437 for(a= -gridlines;a<=gridlines;a++) {
439 /* check for the 'show X axis' preference */
440 if (v3d->gridflag & V3D_SHOW_X) {
441 make_axis_color(col, col2, 'x');
442 glColor3ubv((GLubyte *)col2);
445 } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
446 UI_ThemeColorShade(TH_GRID, emphasise);
451 /* check for the 'show grid floor' preference */
452 if (v3d->gridflag & V3D_SHOW_FLOOR) {
454 UI_ThemeColorShade(TH_GRID, emphasise);
456 else UI_ThemeColorShade(TH_GRID, 10);
465 glBegin(GL_LINE_STRIP);
466 vert[1]= a*v3d->grid;
475 /* draw the Z axis line */
476 /* check for the 'show Z axis' preference */
477 if (v3d->gridflag & V3D_SHOW_Z) {
478 make_axis_color(col, col2, 'z');
479 glColor3ubv((GLubyte *)col2);
481 glBegin(GL_LINE_STRIP);
491 if(v3d->zbuf && G.obedit) glDepthMask(1);
495 static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
500 /* we dont want the clipping for cursor */
503 project_short(ar, v3d, give_cursor(scene, v3d), co);
512 circ((float)mx, (float)my, 10.0);
515 circ((float)mx, (float)my, 10.0);
519 sdrawline(mx-20, my, mx-5, my);
520 sdrawline(mx+5, my, mx+20, my);
521 sdrawline(mx, my-20, mx, my-5);
522 sdrawline(mx, my+5, mx, my+20);
526 /* Draw a live substitute of the view icon, which is always shown */
527 static void draw_view_axis(View3D *v3d)
529 const float k = U.rvisize; /* axis size */
530 const float toll = 0.5; /* used to see when view is quasi-orthogonal */
531 const float start = k + 1.0; /* axis center in screen coordinates, x=y */
532 float ydisp = 0.0; /* vertical displacement to allow obj info text */
534 /* rvibright ranges approx. from original axis icon color to gizmo color */
535 float bright = U.rvibright / 15.0f;
537 unsigned char col[3];
538 unsigned char gridcol[3];
545 /* thickness of lines is proportional to k */
546 /* (log(k)-1) gives a more suitable thickness, but fps decreased by about 3 fps */
548 //glLineWidth(log(k)-1); // a bit slow
550 UI_GetThemeColor3ubv(TH_GRID, (char *)gridcol);
555 QuatMulVecf(v3d->viewquat, vec);
557 make_axis_color((char *)gridcol, (char *)col, 'x');
558 rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
559 s = s<0.5 ? s+0.5 : 1.0;
561 v = (v<1.0-(bright) ? v+bright : 1.0);
562 hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
567 fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
568 if (fabs(dx) > toll || fabs(dy) > toll) {
569 glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
570 BMF_DrawString(G.fonts, "x");
576 QuatMulVecf(v3d->viewquat, vec);
578 make_axis_color((char *)gridcol, (char *)col, 'y');
579 rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
580 s = s<0.5 ? s+0.5 : 1.0;
582 v = (v<1.0-(bright) ? v+bright : 1.0);
583 hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
588 fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
589 if (fabs(dx) > toll || fabs(dy) > toll) {
590 glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
591 BMF_DrawString(G.fonts, "y");
597 QuatMulVecf(v3d->viewquat, vec);
599 make_axis_color((char *)gridcol, (char *)col, 'z');
600 rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
601 s = s<0.5 ? s+0.5 : 1.0;
603 v = (v<1.0-(bright) ? v+bright : 1.0);
604 hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
609 fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
610 if (fabs(dx) > toll || fabs(dy) > toll) {
611 glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
612 BMF_DrawString(G.fonts, "z");
615 /* restore line-width */
620 static void draw_view_icon(View3D *v3d)
624 if(v3d->view==7) icon= ICON_AXIS_TOP;
625 else if(v3d->view==1) icon= ICON_AXIS_FRONT;
626 else if(v3d->view==3) icon= ICON_AXIS_SIDE;
630 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
632 UI_icon_draw(5.0, 5.0, icon);
637 char *view3d_get_name(View3D *v3d)
643 if (v3d->persp == V3D_ORTHO)
644 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Ortho" : "Front Ortho";
646 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp";
649 if (v3d->persp == V3D_ORTHO)
650 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Ortho" : "Right Ortho";
652 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp";
655 if (v3d->persp == V3D_ORTHO)
656 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Ortho" : "Top Ortho";
658 name = (v3d->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp";
661 if (v3d->persp==V3D_CAMOB) {
662 if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
664 cam = v3d->camera->data;
665 name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
667 name = "Object as Camera";
670 name = (v3d->persp == V3D_ORTHO) ? "User Ortho" : "User Persp";
678 static void draw_viewport_name(ARegion *ar, View3D *v3d)
680 char *name = view3d_get_name(v3d);
681 char *printable = NULL;
683 if (v3d->localview) {
684 printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
685 strcpy(printable, name);
686 strcat(printable, " (Local)");
692 UI_ThemeColor(TH_TEXT_HI);
693 glRasterPos2i(10, ar->winy-20);
694 BMF_DrawString(G.fonts, printable);
697 if (v3d->localview) {
703 static char *get_cfra_marker_name(Scene *scene)
705 ListBase *markers= &scene->markers;
708 /* search through markers for match */
709 for (m1=markers->first, m2=markers->last; m1 && m2; m1=m1->next, m2=m2->prev) {
723 /* draw info beside axes in bottom left-corner:
724 * framenum, object name, bone name (if available), marker name (if available)
726 static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d)
728 char info[256], *markern;
731 /* get name of marker on current frame (if available) */
732 markern= get_cfra_marker_name(scene);
734 /* check if there is an object */
736 /* name(s) to display depends on type of object */
737 if(ob->type==OB_ARMATURE) {
738 bArmature *arm= ob->data;
741 /* show name of active bone too (if possible) */
743 // XXX EditBone *ebo;
744 // for (ebo=G.edbo.first; ebo; ebo=ebo->next){
745 // if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) {
751 else if(ob->pose && (ob->flag & OB_POSEMODE)) {
753 for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
754 if((pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) {
761 sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
763 sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, name);
765 sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
767 else if(ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
772 /* try to display active shapekey too */
774 key = ob_get_key(ob);
776 kb = BLI_findlink(&key->block, ob->shapenr-1);
778 sprintf(shapes, ": %s ", kb->name);
779 if(ob->shapeflag == OB_SHAPE_LOCK){
780 sprintf(shapes, "%s (Pinned)",shapes);
786 sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
788 sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
791 /* standard object */
793 sprintf(info, "(%d) %s <%s>", CFRA, ob->id.name+2, markern);
795 sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
798 /* colour depends on whether there is a keyframe */
799 if (id_frame_has_keyframe((ID *)ob, frame_to_float(CFRA), v3d->keyflags))
800 UI_ThemeColor(TH_VERTEX_SELECT);
802 UI_ThemeColor(TH_TEXT_HI);
807 sprintf(info, "(%d) <%s>", CFRA, markern);
809 sprintf(info, "(%d)", CFRA);
811 /* colour is always white */
812 UI_ThemeColor(TH_TEXT_HI);
815 if (U.uiflag & USER_SHOW_ROTVIEWICON)
816 offset = 14 + (U.rvisize * 2);
818 glRasterPos2i(offset, 10);
819 BMF_DrawString(G.fonts, info);
822 static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2])
824 float winmax= MAX2(ar->winx, ar->winy);
825 float aspect= (float) (scene->r.xsch*scene->r.xasp)/(scene->r.ysch*scene->r.yasp);
829 size_r[1]= winmax/aspect;
831 size_r[0]= winmax*aspect;
836 void calc_viewborder(Scene *scene, ARegion *ar, View3D *v3d, rctf *viewborder_r)
838 float zoomfac, size[2];
839 float dx= 0.0f, dy= 0.0f;
841 view3d_get_viewborder_size(scene, ar, size);
843 /* magic zoom calculation, no idea what
844 * it signifies, if you find out, tell me! -zr
846 /* simple, its magic dude!
847 * well, to be honest, this gives a natural feeling zooming
848 * with multiple keypad presses (ton)
851 zoomfac= (M_SQRT2 + v3d->camzoom/50.0);
852 zoomfac= (zoomfac*zoomfac)*0.25;
854 size[0]= size[0]*zoomfac;
855 size[1]= size[1]*zoomfac;
857 /* center in window */
858 viewborder_r->xmin= 0.5*ar->winx - 0.5*size[0];
859 viewborder_r->ymin= 0.5*ar->winy - 0.5*size[1];
860 viewborder_r->xmax= viewborder_r->xmin + size[0];
861 viewborder_r->ymax= viewborder_r->ymin + size[1];
863 dx= ar->winx*v3d->camdx*zoomfac*2.0f;
864 dy= ar->winy*v3d->camdy*zoomfac*2.0f;
867 viewborder_r->xmin-= dx;
868 viewborder_r->ymin-= dy;
869 viewborder_r->xmax-= dx;
870 viewborder_r->ymax-= dy;
872 if(v3d->camera && v3d->camera->type==OB_CAMERA) {
873 Camera *cam= v3d->camera->data;
874 float w = viewborder_r->xmax - viewborder_r->xmin;
875 float h = viewborder_r->ymax - viewborder_r->ymin;
876 float side = MAX2(w, h);
878 viewborder_r->xmin+= cam->shiftx*side;
879 viewborder_r->xmax+= cam->shiftx*side;
880 viewborder_r->ymin+= cam->shifty*side;
881 viewborder_r->ymax+= cam->shifty*side;
885 void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
888 int im_width= (scene->r.size*scene->r.xsch)/100;
890 view3d_get_viewborder_size(scene, ar, size);
892 v3d->camzoom= (sqrt(4.0*im_width/size[0]) - M_SQRT2)*50.0;
893 v3d->camzoom= CLAMPIS(v3d->camzoom, -30, 300);
897 static void drawviewborder_flymode(ARegion *ar)
899 /* draws 4 edge brackets that frame the safe area where the
900 mouse can move during fly mode without spinning the view */
901 float x1, x2, y1, y2;
903 x1= 0.45*(float)ar->winx;
904 y1= 0.45*(float)ar->winy;
905 x2= 0.55*(float)ar->winx;
906 y2= 0.55*(float)ar->winy;
942 static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
944 extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad); // interface_panel.c
946 float x1, x2, y1, y2;
947 float x3, y3, x4, y4;
951 if(v3d->camera==NULL)
953 if(v3d->camera->type==OB_CAMERA)
954 ca = v3d->camera->data;
956 calc_viewborder(scene, ar, v3d, &viewborder);
962 /* passepartout, specified in camera edit buttons */
963 if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001) {
964 if (ca->passepartalpha == 1.0) {
967 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
969 glColor4f(0, 0, 0, ca->passepartalpha);
972 glRectf(0.0, (float)ar->winy, x1, 0.0);
973 if (x2 < (float)ar->winx)
974 glRectf(x2, (float)ar->winy, (float)ar->winx, 0.0);
975 if (y2 < (float)ar->winy)
976 glRectf(x1, (float)ar->winy, x2, y2);
978 glRectf(x1, y1, x2, 0.0);
984 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
987 UI_ThemeColor(TH_BACK);
988 glRectf(x1, y1, x2, y2);
991 UI_ThemeColor(TH_WIRE);
992 glRectf(x1, y1, x2, y2);
994 /* camera name - draw in highlighted text color */
995 if (ca && (ca->flag & CAM_SHOWNAME)) {
996 UI_ThemeColor(TH_TEXT_HI);
997 glRasterPos2f(x1, y1-15);
999 BMF_DrawString(G.font, v3d->camera->id.name+2);
1000 UI_ThemeColor(TH_WIRE);
1005 if(scene->r.mode & R_BORDER) {
1008 x3= x1+ scene->r.border.xmin*(x2-x1);
1009 y3= y1+ scene->r.border.ymin*(y2-y1);
1010 x4= x1+ scene->r.border.xmax*(x2-x1);
1011 y4= y1+ scene->r.border.ymax*(y2-y1);
1014 glRectf(x3, y3, x4, y4);
1018 if (ca && (ca->flag & CAM_SHOWTITLESAFE)) {
1029 UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
1032 gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
1036 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1040 static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
1045 float vec[4], fac, asp, zoomx, zoomy;
1046 float x1, y1, x2, y2, cx, cy;
1049 if(bgpic==NULL) return;
1054 ibuf= BKE_image_get_ibuf(ima, &bgpic->iuser);
1055 if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL) )
1057 if(ibuf->channels!=4)
1059 if(ibuf->rect==NULL)
1060 IMB_rect_from_float(ibuf);
1065 calc_viewborder(scene, ar, v3d, &vb);
1075 /* calc window coord */
1076 initgrabz(v3d, 0.0, 0.0, 0.0);
1077 window_to_3d(ar, v3d, vec, 1, 0);
1078 fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
1081 asp= ( (float)ibuf->y)/(float)ibuf->x;
1083 vec[0] = vec[1] = vec[2] = 0.0;
1084 view3d_project_float(ar, vec, sco, v3d->persmat);
1088 x1= cx+ fac*(bgpic->xof-bgpic->size);
1089 y1= cy+ asp*fac*(bgpic->yof-bgpic->size);
1090 x2= cx+ fac*(bgpic->xof+bgpic->size);
1091 y2= cy+ asp*fac*(bgpic->yof+bgpic->size);
1094 /* complete clip? */
1098 if(x1 > ar->winx ) return;
1099 if(y1 > ar->winy ) return;
1101 zoomx= (x2-x1)/ibuf->x;
1102 zoomy= (y2-y1)/ibuf->y;
1104 /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
1105 if(zoomx < 1.0f || zoomy < 1.0f) {
1106 float tzoom= MIN2(zoomx, zoomy);
1109 if(ibuf->mipmap[0]==NULL)
1110 IMB_makemipmap(ibuf, 0);
1112 while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
1119 ibuf= ibuf->mipmap[mip-1];
1122 if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
1124 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1126 glMatrixMode(GL_PROJECTION);
1128 glMatrixMode(GL_MODELVIEW);
1131 glaDefine2DArea(&ar->winrct);
1135 glPixelZoom(zoomx, zoomy);
1136 glColor4f(1.0, 1.0, 1.0, 1.0-bgpic->blend);
1137 glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
1139 glPixelZoom(1.0, 1.0);
1140 glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
1142 glMatrixMode(GL_PROJECTION);
1144 glMatrixMode(GL_MODELVIEW);
1147 glDisable(GL_BLEND);
1148 if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
1150 // XXX areawinset(ar->win); // restore viewport / scissor
1153 /* ****************** View3d afterdraw *************** */
1155 typedef struct View3DAfter {
1156 struct View3DAfter *next, *prev;
1161 /* temp storage of Objects that need to be drawn as last */
1162 void add_view3d_after(View3D *v3d, Base *base, int type, int flag)
1164 View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
1166 BLI_addtail(&v3d->afterdraw, v3da);
1172 /* clears zbuffer and draws it over */
1173 static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear)
1175 View3DAfter *v3da, *next;
1178 for(v3da= v3d->afterdraw.first; v3da; v3da= v3da->next)
1179 if(v3da->type==V3D_XRAY) doit= 1;
1182 if(clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT);
1185 for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
1187 if(v3da->type==V3D_XRAY) {
1188 draw_object(scene, ar, v3d, v3da->base, v3da->flag);
1189 BLI_remlink(&v3d->afterdraw, v3da);
1197 /* disables write in zbuffer and draws it over */
1198 static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
1200 View3DAfter *v3da, *next;
1205 for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
1207 if(v3da->type==V3D_TRANSP) {
1208 draw_object(scene, ar, v3d, v3da->base, v3da->flag);
1209 BLI_remlink(&v3d->afterdraw, v3da);
1219 /* *********************** */
1222 In most cases call draw_dupli_objects,
1223 draw_dupli_objects_color was added because when drawing set dupli's
1224 we need to force the color
1226 static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int color)
1233 short transflag, use_displist= -1; /* -1 is initialize */
1236 if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
1238 tbase.flag= OB_FROMDUPLI|base->flag;
1239 lb= object_duplilist(scene, base->object);
1241 for(dob= lb->first; dob; dob= dob->next) {
1244 tbase.object= dob->ob;
1246 /* extra service: draw the duplicator in drawtype of parent */
1247 /* MIN2 for the drawtype to allow bounding box objects in groups for lods */
1248 dt= tbase.object->dt; tbase.object->dt= MIN2(tbase.object->dt, base->object->dt);
1249 dtx= tbase.object->dtx; tbase.object->dtx= base->object->dtx;
1251 /* negative scale flag has to propagate */
1252 transflag= tbase.object->transflag;
1253 if(base->object->transflag & OB_NEG_SCALE)
1254 tbase.object->transflag ^= OB_NEG_SCALE;
1256 UI_ThemeColorBlend(color, TH_BACK, 0.5);
1258 /* generate displist, test for new object */
1259 if(use_displist==1 && dob->prev && dob->prev->ob!=dob->ob) {
1261 glDeleteLists(displist, 1);
1263 /* generate displist */
1264 if(use_displist == -1) {
1266 /* lamp drawing messes with matrices, could be handled smarter... but this works */
1267 if(dob->ob->type==OB_LAMP || dob->type==OB_DUPLIGROUP)
1270 /* disable boundbox check for list creation */
1271 object_boundbox_flag(dob->ob, OB_BB_DISABLED, 1);
1272 /* need this for next part of code */
1273 bb= object_get_boundbox(dob->ob);
1275 Mat4One(dob->ob->obmat); /* obmat gets restored */
1277 displist= glGenLists(1);
1278 glNewList(displist, GL_COMPILE);
1279 draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
1283 object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
1287 wmMultMatrix(dob->mat);
1288 if(boundbox_clip(v3d, dob->mat, bb))
1289 glCallList(displist);
1290 wmLoadMatrix(v3d->viewmat);
1293 Mat4CpyMat4(dob->ob->obmat, dob->mat);
1294 draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
1297 tbase.object->dt= dt;
1298 tbase.object->dtx= dtx;
1299 tbase.object->transflag= transflag;
1303 /* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */
1305 free_object_duplilist(lb); /* does restore */
1308 glDeleteLists(displist, 1);
1311 static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *base)
1313 /* define the color here so draw_dupli_objects_color can be called
1314 * from the set loop */
1316 int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
1318 if(base->object->dup_group && base->object->dup_group->id.us<1)
1321 draw_dupli_objects_color(scene, ar, v3d, base, color);
1325 void view3d_update_depths(ARegion *ar, View3D *v3d)
1327 /* Create storage for, and, if necessary, copy depth buffer */
1328 if(!v3d->depths) v3d->depths= MEM_callocN(sizeof(ViewDepths),"ViewDepths");
1330 ViewDepths *d= v3d->depths;
1331 if(d->w != ar->winx ||
1337 MEM_freeN(d->depths);
1338 d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths");
1343 glReadPixels(ar->winrct.xmin,ar->winrct.ymin,d->w,d->h,
1344 GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
1346 glGetDoublev(GL_DEPTH_RANGE,d->depth_range);
1353 /* Enable sculpting in wireframe mode by drawing sculpt object only to the depth buffer */
1354 static void draw_sculpt_depths(Scene *scene, ARegion *ar, View3D *v3d)
1358 int dt= MIN2(v3d->drawtype, ob->dt);
1359 if(v3d->zbuf==0 && dt>OB_WIRE)
1363 int orig_vdt = v3d->drawtype;
1364 int orig_zbuf = v3d->zbuf;
1365 int orig_odt = ob->dt;
1367 glGetBooleanv(GL_DEPTH_TEST, &depth_on);
1368 v3d->drawtype = ob->dt = OB_SOLID;
1371 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1372 glEnable(GL_DEPTH_TEST);
1373 draw_object(scene, ar, v3d, BASACT, 0);
1374 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1376 glDisable(GL_DEPTH_TEST);
1378 v3d->drawtype = orig_vdt;
1379 v3d->zbuf = orig_zbuf;
1384 void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
1390 /* temp set drawtype to solid */
1392 /* Setting these temporarily is not nice */
1395 glalphaclip = U.glalphaclip;
1397 U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
1398 v3d->flag &= ~V3D_SELECT_OUTLINE;
1400 setwinmatrixview3d(v3d, ar->winx, ar->winy, NULL); /* 0= no pick rect */
1401 setviewmatrixview3d(v3d); /* note: calls where_is_object for camera... */
1403 Mat4MulMat4(v3d->persmat, v3d->viewmat, v3d->winmat);
1404 Mat4Invert(v3d->persinv, v3d->persmat);
1405 Mat4Invert(v3d->viewinv, v3d->viewmat);
1407 glClear(GL_DEPTH_BUFFER_BIT);
1409 wmLoadMatrix(v3d->viewmat);
1410 // persp(PERSP_STORE); // store correct view for persp(PERSP_VIEW) calls
1412 if(v3d->flag & V3D_CLIPPING) {
1413 view3d_set_clipping(v3d);
1417 glEnable(GL_DEPTH_TEST);
1419 /* draw set first */
1421 for(SETLOOPER(scene->set, base)) {
1422 if(v3d->lay & base->lay) {
1423 if (func == NULL || func(base)) {
1424 draw_object(scene, ar, v3d, base, 0);
1425 if(base->object->transflag & OB_DUPLI) {
1426 draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
1433 for(base= scene->base.first; base; base= base->next) {
1434 if(v3d->lay & base->lay) {
1435 if (func == NULL || func(base)) {
1437 if(base->object->transflag & OB_DUPLI) {
1438 draw_dupli_objects(scene, ar, v3d, base);
1440 draw_object(scene, ar, v3d, base, 0);
1445 /* this isnt that nice, draw xray objects as if they are normal */
1446 if (v3d->afterdraw.first) {
1447 View3DAfter *v3da, *next;
1451 glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */
1452 for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
1454 if(v3da->type==V3D_XRAY) {
1455 draw_object(scene, ar, v3d, v3da->base, 0);
1458 /* dont remove this time */
1462 glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
1463 for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
1465 if(v3da->type==V3D_XRAY) {
1466 v3d->xray= TRUE; v3d->transp= FALSE;
1467 } else if (v3da->type==V3D_TRANSP) {
1468 v3d->xray= FALSE; v3d->transp= TRUE;
1471 draw_object(scene, ar, v3d, v3da->base, 0); /* Draw Xray or Transp objects normally */
1472 BLI_remlink(&v3d->afterdraw, v3da);
1480 U.glalphaclip = glalphaclip;
1484 typedef struct View3DShadow {
1485 struct View3DShadow *next, *prev;
1489 static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object *par, float obmat[][4], ListBase *shadows)
1492 View3DShadow *shadow;
1494 lamp = GPU_lamp_from_blender(scene, ob, par);
1497 GPU_lamp_update(lamp, ob->lay, obmat);
1499 if((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) {
1500 shadow= MEM_callocN(sizeof(View3DShadow), "View3DShadow");
1501 shadow->lamp = lamp;
1502 BLI_addtail(shadows, shadow);
1507 static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
1510 View3DShadow *shadow;
1515 shadows.first= shadows.last= NULL;
1517 /* update lamp transform and gather shadow lamps */
1518 for(SETLOOPER(scene, base)) {
1521 if(ob->type == OB_LAMP)
1522 gpu_render_lamp_update(scene, v3d, ob, NULL, ob->obmat, &shadows);
1524 if (ob->transflag & OB_DUPLI) {
1526 ListBase *lb = object_duplilist(scene, ob);
1528 for(dob=lb->first; dob; dob=dob->next)
1529 if(dob->ob->type==OB_LAMP)
1530 gpu_render_lamp_update(scene, v3d, dob->ob, ob, dob->mat, &shadows);
1532 free_object_duplilist(lb);
1536 /* render shadows after updating all lamps, nested object_duplilist
1537 * don't work correct since it's replacing object matrices */
1538 for(shadow=shadows.first; shadow; shadow=shadow->next) {
1539 /* this needs to be done better .. */
1540 float viewmat[4][4], winmat[4][4];
1541 int drawtype, lay, winsize, flag2;
1543 drawtype= v3d->drawtype;
1545 flag2= v3d->flag2 & V3D_SOLID_TEX;
1547 v3d->drawtype = OB_SOLID;
1548 v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp);
1549 v3d->flag2 &= ~V3D_SOLID_TEX;
1551 GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat);
1552 // XXX drawview3d_render(v3d, viewmat, winsize, winsize, winmat, 1);
1553 GPU_lamp_shadow_buffer_unbind(shadow->lamp);
1555 v3d->drawtype= drawtype;
1557 v3d->flag2 |= flag2;
1560 BLI_freelistN(&shadows);
1564 void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d)
1569 char retopo= 0, sculptparticle= 0;
1570 Object *obact = OBACT;
1572 /* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
1573 no layer check here, gets correct flushed */
1574 /* sets first, we allow per definition current scene to have dependencies on sets */
1576 for(SETLOOPER(scene->set, base))
1577 object_handle_update(base->object); // bke_object.h
1581 for(base= scene->base.first; base; base= base->next) {
1582 object_handle_update(base->object); // bke_object.h
1583 v3d->lay_used |= base->lay;
1586 /* shadow buffers, before we setup matrices */
1587 if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
1588 gpu_update_lamps_shadows(scene, v3d);
1590 setwinmatrixview3d(v3d, ar->winx, ar->winy, NULL); /* 0= no pick rect */
1591 setviewmatrixview3d(v3d); /* note: calls where_is_object for camera... */
1593 Mat4MulMat4(v3d->persmat, v3d->viewmat, v3d->winmat);
1594 Mat4Invert(v3d->persinv, v3d->persmat);
1595 Mat4Invert(v3d->viewinv, v3d->viewmat);
1597 /* calculate pixelsize factor once, is used for lamps and obcenters */
1599 float len1, len2, vec[3];
1601 VECCOPY(vec, v3d->persinv[0]);
1602 len1= Normalize(vec);
1603 VECCOPY(vec, v3d->persinv[1]);
1604 len2= Normalize(vec);
1606 v3d->pixsize= 2.0f*(len1>len2?len1:len2);
1608 /* correct for window size */
1609 if(ar->winx > ar->winy) v3d->pixsize/= (float)ar->winx;
1610 else v3d->pixsize/= (float)ar->winy;
1613 if(v3d->drawtype > OB_WIRE) {
1615 UI_GetThemeColor3fv(TH_BACK, col);
1616 glClearColor(col[0], col[1], col[2], 0.0);
1617 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
1623 UI_GetThemeColor3fv(TH_BACK, col);
1624 glClearColor(col[0], col[1], col[2], 0.0);
1625 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
1628 wmLoadMatrix(v3d->viewmat);
1630 if(v3d->flag & V3D_CLIPPING)
1631 view3d_draw_clipping(v3d);
1633 /* set zbuffer after we draw clipping region */
1634 if(v3d->drawtype > OB_WIRE) {
1636 glEnable(GL_DEPTH_TEST);
1639 // needs to be done always, gridview is adjusted in drawgrid() now
1640 v3d->gridview= v3d->grid;
1642 if(v3d->view==0 || v3d->persp!=0) {
1646 if(scene->world->mode & WO_STARS) {
1647 RE_make_stars(NULL, star_stuff_init_func, star_stuff_vertex_func,
1648 star_stuff_term_func);
1651 if(v3d->flag & V3D_DISPBGPIC) draw_bgpic(scene, ar, v3d);
1655 ED_region_pixelspace(ar);
1657 /* XXX make function? replaces persp(1) */
1658 glMatrixMode(GL_PROJECTION);
1659 wmLoadMatrix(v3d->winmat);
1660 glMatrixMode(GL_MODELVIEW);
1661 wmLoadMatrix(v3d->viewmat);
1663 if(v3d->flag & V3D_DISPBGPIC) {
1664 draw_bgpic(scene, ar, v3d);
1668 if(v3d->flag & V3D_CLIPPING)
1669 view3d_set_clipping(v3d);
1671 /* draw set first */
1673 for(SETLOOPER(scene->set, base)) {
1675 if(v3d->lay & base->lay) {
1677 UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
1678 draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
1680 if(base->object->transflag & OB_DUPLI) {
1681 draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
1686 /* Transp and X-ray afterdraw stuff for sets is done later */
1689 /* then draw not selected and the duplis, but skip editmode object */
1690 for(base= scene->base.first; base; base= base->next) {
1691 if(v3d->lay & base->lay) {
1694 if(base->object->transflag & OB_DUPLI) {
1695 draw_dupli_objects(scene, ar, v3d, base);
1697 if((base->flag & SELECT)==0) {
1698 if(base->object!=G.obedit)
1699 draw_object(scene, ar, v3d, base, 0);
1704 // retopo= retopo_mesh_check() || retopo_curve_check();
1705 // sculptparticle= (G.f & (G_SCULPTMODE|G_PARTICLEEDIT)) && !G.obedit;
1707 view3d_update_depths(ar, v3d);
1709 /* draw selected and editmode */
1710 for(base= scene->base.first; base; base= base->next) {
1711 if(v3d->lay & base->lay) {
1712 if (base->object==G.obedit || ( base->flag & SELECT) )
1713 draw_object(scene, ar, v3d, base, 0);
1717 if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) {
1718 if(G.f & G_SCULPTMODE)
1719 draw_sculpt_depths(scene, ar, v3d);
1720 view3d_update_depths(ar, v3d);
1724 // BIF_drawConstraint();
1725 // if(G.obedit || (G.f & G_PARTICLEEDIT))
1726 // BIF_drawPropCircle(); // only editmode and particles have proportional edit
1732 // if(scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
1734 /* Transp and X-ray afterdraw stuff */
1735 view3d_draw_transp(scene, ar, v3d);
1736 view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
1738 if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) {
1739 if(G.f & G_SCULPTMODE)
1740 draw_sculpt_depths(scene, ar, v3d);
1741 view3d_update_depths(ar, v3d);
1744 if(v3d->flag & V3D_CLIPPING)
1745 view3d_clr_clipping();
1747 // BIF_draw_manipulator(ar);
1751 glDisable(GL_DEPTH_TEST);
1754 /* draw grease-pencil stuff */
1755 // if (v3d->flag2 & V3D_DISPGP)
1756 // draw_gpencil_3dview(ar, 1);
1758 ED_region_pixelspace(ar);
1760 /* Draw Sculpt Mode brush XXX (removed) */
1762 // retopo_paint_view_update(v3d);
1763 // retopo_draw_paint_lines();
1765 /* Draw particle edit brush XXX (removed) */
1767 if(v3d->persp>1) drawviewborder(scene, ar, v3d);
1768 if(v3d->flag2 & V3D_FLYMODE) drawviewborder_flymode(ar);
1770 /* draw grease-pencil stuff */
1771 // if (v3d->flag2 & V3D_DISPGP)
1772 // draw_gpencil_3dview(ar, 0);
1774 if(!(G.f & G_PLAYANIM)) drawcursor(scene, ar, v3d);
1775 if(U.uiflag & USER_SHOW_ROTVIEWICON)
1776 draw_view_axis(v3d);
1778 draw_view_icon(v3d);
1780 /* XXX removed viewport fps */
1781 if(U.uiflag & USER_SHOW_VIEWPORTNAME) {
1782 draw_viewport_name(ar, v3d);
1786 if(U.uiflag & USER_DRAWVIEWINFO)
1787 draw_selected_name(scene, ob, v3d);
1789 // draw_area_emboss(ar);
1791 /* XXX here was the blockhandlers for floating panels */
1793 if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
1794 v3d->flag |= V3D_NEEDBACKBUFDRAW;
1795 // XXX addafterqueue(ar->win, BACKBUFDRAW, 1);
1797 // test for backbuf select
1798 if(G.obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) {
1800 v3d->flag |= V3D_NEEDBACKBUFDRAW;
1801 // XXX if(afterqtest(ar->win, BACKBUFDRAW)==0) {
1802 // addafterqueue(ar->win, BACKBUFDRAW, 1);
1806 #ifndef DISABLE_PYTHON
1807 /* XXX here was scriptlink */