diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_view3d/view3d_draw.c | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 278 |
1 files changed, 139 insertions, 139 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index b167f731852..d8247caa5c2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -124,35 +124,35 @@ extern void bl_debug_color_set(const unsigned int col); void circf(float x, float y, float rad) { - GLUquadricObj *qobj = gluNewQuadric(); - - gluQuadricDrawStyle(qobj, GLU_FILL); - - glPushMatrix(); - + GLUquadricObj *qobj = gluNewQuadric(); + + gluQuadricDrawStyle(qobj, GLU_FILL); + + glPushMatrix(); + glTranslatef(x, y, 0.0); - + gluDisk(qobj, 0.0, rad, 32, 1); - - glPopMatrix(); - + + glPopMatrix(); + gluDeleteQuadric(qobj); } void circ(float x, float y, float rad) { - GLUquadricObj *qobj = gluNewQuadric(); - - gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); - - glPushMatrix(); - + GLUquadricObj *qobj = gluNewQuadric(); + + gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); + + glPushMatrix(); + glTranslatef(x, y, 0.0); - + gluDisk(qobj, 0.0, rad, 32, 1); - - glPopMatrix(); - + + glPopMatrix(); + gluDeleteQuadric(qobj); } @@ -240,7 +240,7 @@ bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx) -{ +{ double verts[2][2]; x += (wx); @@ -306,14 +306,14 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** dx = fabs(x - (wx) * fx / fw); if (dx == 0) dx = fabs(y - (wy) * fy / fw); - + glLineWidth(1.0f); glDepthMask(GL_FALSE); /* disable write in zbuffer */ /* check zoom out */ UI_ThemeColor(TH_GRID); - + if (unit->system) { /* Use GRID_MIN_PX * 2 for units because very very small grid * items are less useful when dealing with units */ @@ -430,23 +430,23 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** UI_GetThemeColor3ubv(TH_GRID, col); setlinestyle(0); - + /* center cross */ /* horizontal line */ if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) UI_make_axis_color(col, col2, 'Y'); else UI_make_axis_color(col, col2, 'X'); glColor3ubv(col2); - - fdrawline(0.0, y, (float)ar->winx, y); - + + fdrawline(0.0, y, (float)ar->winx, y); + /* vertical line */ if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) UI_make_axis_color(col, col2, 'Y'); else UI_make_axis_color(col, col2, 'Z'); glColor3ubv(col2); - fdrawline(x, 0.0, x, (float)ar->winy); + fdrawline(x, 0.0, x, (float)ar->winy); glDepthMask(GL_TRUE); /* enable write in zbuffer */ } @@ -485,7 +485,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr const int gridlines = v3d->gridlines / 2; if (v3d->gridlines < 3) return; - + /* use 'grid_scale' instead of 'v3d->grid' from now on */ grid_scale = ED_view3d_grid_scale(scene, v3d, grid_unit); grid = gridlines * grid_scale; @@ -538,7 +538,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr glDisableClientState(GL_VERTEX_ARRAY); } - + /* draw the Z axis line */ /* check for the 'show Z axis' preference */ if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { @@ -561,7 +561,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr } glEnd(); } - + glDepthMask(GL_TRUE); } @@ -575,9 +575,9 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) const float f5 = 0.25f * U.widget_unit; const float f10 = 0.5f * U.widget_unit; const float f20 = U.widget_unit; - + glLineWidth(1); - setlinestyle(0); + setlinestyle(0); cpack(0xFF); circ((float)co[0], (float)co[1], f10); setlinestyle(4); @@ -691,7 +691,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) sub_v3_v3v3(end, o, scaled_axis); glVertex3fv(end); glEnd(); - + /* -- draw ring around rotation center -- */ { #define ROT_AXIS_DETAIL 13 @@ -757,7 +757,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) static void draw_view_icon(RegionView3D *rv3d, rcti *rect) { BIFIconID icon; - + if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) icon = ICON_AXIS_TOP; else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) @@ -765,19 +765,19 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect) else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) icon = ICON_AXIS_SIDE; else return; - + glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + UI_icon_draw(5.0 + rect->xmin, 5.0 + rect->ymin, icon); - + glDisable(GL_BLEND); } static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) { const char *name = NULL; - + switch (rv3d->view) { case RV3D_VIEW_FRONT: if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Front Ortho"); @@ -803,7 +803,7 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Left Ortho"); else name = IFACE_("Left Persp"); break; - + default: if (rv3d->persp == RV3D_CAMOB) { if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) { @@ -829,7 +829,7 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) } break; } - + return name; } @@ -857,7 +857,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) #endif } -/* draw info beside axes in bottom left-corner: +/* draw info beside axes in bottom left-corner: * framenum, object name, bone name (if available), marker name (if available) */ @@ -874,7 +874,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect) s += sprintf(s, "(%d)", cfra); - /* + /* * info can contain: * - a frame (7 + 2) * - 3 object names (MAX_NAME) @@ -885,7 +885,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect) /* get name of marker on current frame (if available) */ markern = BKE_scene_find_marker_name(scene, cfra); - + /* check if there is an object */ if (ob) { *s++ = ' '; @@ -894,7 +894,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect) /* name(s) to display depends on type of object */ if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; - + /* show name of active bone too (if possible) */ if (arm->edbo) { if (arm->act_edbone) { @@ -943,7 +943,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect) } } } - + /* color depends on whether there is a keyframe */ if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL)) UI_ThemeColor(TH_TIME_KEYFRAME); @@ -963,7 +963,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect) if (markern) { s += sprintf(s, " <%s>", markern); } - + if (U.uiflag & USER_SHOW_ROTVIEWICON) offset = U.widget_unit + (U.rvisize * 2) + rect->xmin; @@ -1107,14 +1107,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) return; if (v3d->camera->type == OB_CAMERA) ca = v3d->camera->data; - + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); /* the offsets */ x1 = viewborder.xmin; y1 = viewborder.ymin; x2 = viewborder.xmax; y2 = viewborder.ymax; - + glLineWidth(1.0f); /* apply offsets so the real 3D camera shows through */ @@ -1128,7 +1128,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y1i = (int)(y1 - 1.0001f); x2i = (int)(x2 + (1.0f - 0.0001f)); y2i = (int)(y2 + (1.0f - 0.0001f)); - + /* passepartout, specified in camera edit buttons */ if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) { const float winx = (ar->winx + 1); @@ -1151,14 +1151,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glRectf(x1i, winy, x2i, y2i); if (y2i > 0.0f) glRectf(x1i, y1i, x2i, 0.0); - + glDisable(GL_BLEND); } setlinestyle(0); UI_ThemeColor(TH_BACK); - + fdrawbox(x1i, y1i, x2i, y2i); #ifdef VIEW3D_CAMERA_BORDER_HACK @@ -1364,7 +1364,7 @@ static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d #endif if (v3d->drawtype > OB_WIRE) v3d->zbuf = true; - + /* dithering and AA break color coding, so disable */ glDisable(GL_DITHER); @@ -1411,10 +1411,10 @@ static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); } - + if (rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_set(rv3d); - + G.f |= G_BACKBUFSEL; if (obact && (obact->lay & v3d->lay)) { @@ -1481,7 +1481,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist) unsigned int ED_view3d_backbuf_sample(ViewContext *vc, int x, int y) { unsigned int col; - + if (x >= vc->ar->winx || y >= vc->ar->winy) { return 0; } @@ -1490,11 +1490,11 @@ unsigned int ED_view3d_backbuf_sample(ViewContext *vc, int x, int y) view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); glReadBuffer(GL_BACK); - + if (ENDIAN_ORDER == B_ENDIAN) { BLI_endian_switch_uint32(&col); } - + return GPU_select_to_index(col); } @@ -1529,7 +1529,7 @@ ImBuf *ED_view3d_backbuf_read(ViewContext *vc, int xmin, int ymin, int xmax, int } GPU_select_to_index_array(ibuf_clip->rect, size_clip[0] * size_clip[1]); - + if ((clip.xmin == xmin) && (clip.xmax == xmax) && (clip.ymin == ymin) && @@ -1577,19 +1577,19 @@ uint ED_view3d_backbuf_sample_rect( if (!buf) return 0; rc = 0; - + dirvec[0][0] = 1; dirvec[0][1] = 0; dirvec[1][0] = 0; dirvec[1][1] = -size; dirvec[2][0] = -1; dirvec[2][1] = 0; dirvec[3][0] = 0; dirvec[3][1] = size; - + bufmin = buf->rect; tbuf = buf->rect; bufmax = buf->rect + size * size; tbuf += amount * size + amount; - + for (nr = 1; nr <= size; nr++) { - + for (a = 0; a < 2; a++) { for (b = 0; b < nr; b++) { if (*tbuf && *tbuf >= min && *tbuf < max) { @@ -1605,9 +1605,9 @@ uint ED_view3d_backbuf_sample_rect( index = (*tbuf - min) + 1; goto exit; } - + tbuf += (dirvec[rc][0] + dirvec[rc][1]); - + if (tbuf < bufmin || tbuf >= bufmax) { goto exit; } @@ -1971,18 +1971,18 @@ void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag) static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d) { View3DAfter *v3da; - + glDepthMask(GL_FALSE); v3d->transp = true; - + while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) { draw_object(scene, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } v3d->transp = false; - + glDepthMask(GL_TRUE); - + } /* clears zbuffer and draws it over */ @@ -2014,7 +2014,7 @@ static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, const v3d->xray = true; v3d->transp = true; - + glDepthMask(GL_FALSE); while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) { @@ -2156,20 +2156,20 @@ static void draw_dupli_objects_color( tbase.object->transflag |= OB_NEG_SCALE; else tbase.object->transflag &= ~OB_NEG_SCALE; - + /* should move outside the loop but possible color is set in draw_object still */ if ((dflag & DRAW_CONSTCOLOR) == 0) { glColor3ubv(color_rgb); } - + /* generate displist, test for new object */ if (dob_prev && dob_prev->ob != dob->ob) { if (use_displist == true) glDeleteLists(displist, 1); - + use_displist = false; } - + if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) { bb = *bb_tmp; /* must make a copy */ testbb = true; @@ -2178,12 +2178,12 @@ static void draw_dupli_objects_color( if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { /* generate displist */ if (use_displist == false) { - + /* note, since this was added, its checked (dob->type == OB_DUPLIGROUP) * however this is very slow, it was probably needed for the NLA * offset feature (used in group-duplicate.blend but no longer works in 2.5) * so for now it should be ok to - campbell */ - + if ( /* if this is the last no need to make a displist */ (dob_next == NULL || dob_next->ob != dob->ob) || /* lamp drawing messes with matrices, could be handled smarter... but this works */ @@ -2199,28 +2199,28 @@ static void draw_dupli_objects_color( } else { // printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2); - + /* disable boundbox check for list creation */ BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 1); /* need this for next part of code */ unit_m4(dob->ob->obmat); /* obmat gets restored */ - + displist = glGenLists(1); glNewList(displist, GL_COMPILE); draw_object(scene, ar, v3d, &tbase, dflag_dupli); glEndList(); - + use_displist = true; BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 0); - } + } } - + if (use_displist) { glPushMatrix(); glMultMatrixf(dob->mat); glCallList(displist); glPopMatrix(); - } + } else { copy_m4_m4(dob->ob->obmat, dob->mat); GPU_begin_dupli_object(dob); @@ -2228,7 +2228,7 @@ static void draw_dupli_objects_color( GPU_end_dupli_object(); } } - + tbase.object->dt = dt; tbase.object->dtx = dtx; tbase.object->transflag = transflag; @@ -2241,7 +2241,7 @@ static void draw_dupli_objects_color( } free_object_duplilist(lb); - + if (use_displist) glDeleteLists(displist, 1); } @@ -2250,12 +2250,12 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas { /* define the color here so draw_dupli_objects_color can be called * from the set loop */ - + int color = (base->flag & SELECT) ? TH_SELECT : TH_WIRE; /* debug */ if (base->object->dup_group && base->object->dup_group->id.us < 1) color = TH_REDALERT; - + draw_dupli_objects_color(scene, ar, v3d, base, 0, color); } @@ -2304,7 +2304,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) MEM_freeN(d->depths); d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset"); - + d->damaged = true; } @@ -2320,7 +2320,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) void ED_view3d_depth_update(ARegion *ar) { RegionView3D *rv3d = ar->regiondata; - + /* Create storage for, and, if necessary, copy depth buffer */ if (!rv3d->depths) rv3d->depths = MEM_callocN(sizeof(ViewDepths), "ViewDepths"); if (rv3d->depths) { @@ -2336,11 +2336,11 @@ void ED_view3d_depth_update(ARegion *ar) d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths"); d->damaged = true; } - + if (d->damaged) { view3d_opengl_read_pixels(ar, 0, 0, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths); glGetDoublev(GL_DEPTH_RANGE, d->depth_range); - + d->damaged = false; } } @@ -2386,7 +2386,7 @@ void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) if (v3d->flag2 & V3D_SHOW_GPENCIL) { ED_gpencil_draw_view3d(NULL, scene, v3d, ar, true); } - + v3d->zbuf = zbuf; } @@ -2409,7 +2409,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d) } } } - + for (base = scene->base.first; base; base = base->next) { if (v3d->lay & base->lay) { /* dupli drawing */ @@ -2419,7 +2419,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d) draw_object(scene, ar, v3d, base, dflag_depth); } } - + /* this isn't that nice, draw xray objects as if they are normal */ if (v3d->afterdraw_transp.first || v3d->afterdraw_xray.first || @@ -2429,7 +2429,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d) int mask_orig; v3d->xray = true; - + /* transp materials can change the depth mask, see #21388 */ glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig); @@ -2464,7 +2464,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d) MEM_freeN(v3da); } - + v3d->xray = false; v3d->transp = false; @@ -2481,21 +2481,21 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover float glalphaclip = U.glalphaclip; int obcenter_dia = U.obcenter_dia; /* temp set drawtype to solid */ - + /* Setting these temporarily is not nice */ v3d->flag &= ~V3D_SELECT_OUTLINE; U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */ U.obcenter_dia = 0; - + /* Tools may request depth outside of regular drawing code. */ UI_Theme_Store(&theme_state); UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); /* Setup view matrix. */ ED_view3d_draw_setup_view(NULL, scene, ar, v3d, rv3d->viewmat, rv3d->winmat, NULL); - + glClear(GL_DEPTH_BUFFER_BIT); - + if (rv3d->rflag & RV3D_CLIPPING) { ED_view3d_clipping_set(rv3d); } @@ -2511,7 +2511,7 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover ED_view3d_clipping_disable(); } rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED; - + v3d->zbuf = zbuf; if (!v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -2588,13 +2588,13 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Lamp *la = (Lamp *)ob->data; View3DShadow *shadow; unsigned int layers; - + lamp = GPU_lamp_from_blender(scene, ob, par); - + if (lamp) { GPU_lamp_update(lamp, lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat); GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy); - + layers = lay & v3d->lay; if (srl) layers &= srl->lay; @@ -2620,28 +2620,28 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d) Object *ob; World *world = scene->world; SceneRenderLayer *srl = v3d->scenelock ? BLI_findlink(&scene->r.layers, scene->r.actlay) : NULL; - + BLI_listbase_clear(&shadows); - + /* update lamp transform and gather shadow lamps */ for (SETLOOPER(scene, sce_iter, base)) { ob = base->object; - + if (ob->type == OB_LAMP) gpu_render_lamp_update(scene, v3d, ob, NULL, ob->obmat, ob->lay, &shadows, srl); - + if (ob->transflag & OB_DUPLI) { DupliObject *dob; ListBase *lb = object_duplilist(G.main->eval_ctx, scene, ob); - + for (dob = lb->first; dob; dob = dob->next) if (dob->ob->type == OB_LAMP) gpu_render_lamp_update(scene, v3d, dob->ob, ob, dob->mat, ob->lay, &shadows, srl); - + free_object_duplilist(lb); } } - + /* render shadows after updating all lamps, nested object_duplilist * don't work correct since it's replacing object matrices */ for (shadow = shadows.first; shadow; shadow = shadow->next) { @@ -2650,15 +2650,15 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d) int drawtype, lay, winsize, flag2 = v3d->flag2; ARegion ar = {NULL}; RegionView3D rv3d = {{{0}}}; - + drawtype = v3d->drawtype; lay = v3d->lay; - + v3d->drawtype = OB_SOLID; v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp); v3d->flag2 &= ~(V3D_SOLID_TEX | V3D_SHOW_SOLID_MATCAP); v3d->flag2 |= V3D_RENDER_OVERRIDE | V3D_RENDER_SHADOW; - + GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat); ar.regiondata = &rv3d; @@ -2676,12 +2676,12 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d) false, false, true, NULL, NULL, NULL, NULL); GPU_lamp_shadow_buffer_unbind(shadow->lamp); - + v3d->drawtype = drawtype; v3d->lay = lay; v3d->flag2 = flag2; } - + BLI_freelistN(&shadows); /* update world values */ @@ -2711,7 +2711,7 @@ CustomDataMask ED_view3d_datamask(const Scene *scene, const View3D *v3d) mask |= CD_MASK_ORCO; } else { - if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) || + if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) || (drawtype == OB_MATERIAL)) { mask |= CD_MASK_ORCO; @@ -2728,7 +2728,7 @@ CustomDataMask ED_view3d_screen_datamask(const bScreen *screen) const Scene *scene = screen->scene; CustomDataMask mask = CD_MASK_BAREMESH; const ScrArea *sa; - + /* check if we need tfaces & mcols due to view mode */ for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->spacetype == SPACE_VIEW3D) { @@ -2770,7 +2770,7 @@ void ED_view3d_update_viewmat( mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); - + /* calculate GLSL view dependent values */ /* store window coordinates scaling/offset */ @@ -2779,7 +2779,7 @@ void ED_view3d_update_viewmat( ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &cameraborder, false); rv3d->viewcamtexcofac[0] = (float)ar->winx / BLI_rctf_size_x(&cameraborder); rv3d->viewcamtexcofac[1] = (float)ar->winy / BLI_rctf_size_y(&cameraborder); - + rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)ar->winx; rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)ar->winy; } @@ -2971,7 +2971,7 @@ static void view3d_draw_objects( /* must be before xray draw which clears the depth buffer */ if (v3d->flag2 & V3D_SHOW_GPENCIL) { wmWindowManager *wm = (C != NULL) ? CTX_wm_manager(C) : NULL; - + /* must be before xray draw which clears the depth buffer */ if (v3d->zbuf) glDisable(GL_DEPTH_TEST); ED_gpencil_draw_view3d(wm, scene, v3d, ar, true); @@ -3093,7 +3093,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) /* calculate full shader for background */ GPU_material_bind(gpumat, 1, 1, 1.0, false, rv3d->viewmat, rv3d->viewinv, rv3d->viewcamtexcofac, (v3d->scenelock != 0)); - + bool material_not_bound = !GPU_material_bound(gpumat); if (material_not_bound) { @@ -3124,7 +3124,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) } GPU_material_unbind(gpumat); - + glDepthFunc(GL_LEQUAL); glDisable(GL_DEPTH_TEST); } @@ -3541,18 +3541,18 @@ void ED_scene_draw_fps(Scene *scene, const rcti *rect) float fps; char printable[16]; int i, tot; - + if (!fpsi || !fpsi->lredrawtime || !fpsi->redrawtime) return; - + printable[0] = '\0'; - + #if 0 /* this is too simple, better do an average */ fps = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime)) #else fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime)); - + for (i = 0, tot = 0, fps = 0.0f; i < REDRAW_FRAME_AVERAGE; i++) { if (fpsi->redrawtimes_fps[i]) { fps += fpsi->redrawtimes_fps[i]; @@ -3561,11 +3561,11 @@ void ED_scene_draw_fps(Scene *scene, const rcti *rect) } if (tot) { fpsi->redrawtime_index = (fpsi->redrawtime_index + 1) % REDRAW_FRAME_AVERAGE; - + //fpsi->redrawtime_index++; //if (fpsi->redrawtime >= REDRAW_FRAME_AVERAGE) // fpsi->redrawtime = 0; - + fps = fps / tot; } #endif @@ -3611,7 +3611,7 @@ bool ED_view3d_calc_render_border( use_border = (scene->r.mode & R_BORDER) != 0; else use_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0; - + if (!use_border) return false; @@ -3711,7 +3711,7 @@ static void view3d_main_region_draw_engine_info(View3D *v3d, RegionView3D *rv3d, if (!rv3d->render_engine || !rv3d->render_engine->text[0]) return; - + if (render_border) { /* draw darkened background color. no alpha because border render does * partial redraw and will not redraw the region behind this info bar */ @@ -3861,10 +3861,10 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie wmWindow *win = CTX_wm_window(C); RegionView3D *rv3d = ar->regiondata; unsigned int lay_used = v3d->lay_used; - + /* post processing */ bool do_compositing = false; - + /* shadow buffers, before we setup matrices */ if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype)) gpu_update_lamps_shadows_world(scene, v3d); @@ -3895,7 +3895,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie fx_settings = v3d->fx_settings; if (!rv3d->compositor) rv3d->compositor = GPU_fx_compositor_create(); - + if (rv3d->persp == RV3D_CAMOB && v3d->camera) BKE_camera_to_gpu_dof(v3d->camera, &fx_settings); else { @@ -3904,7 +3904,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie do_compositing = GPU_fx_compositor_initialize_passes(rv3d->compositor, &ar->winrct, &ar->drawrct, &fx_settings); } - + /* clear the background */ view3d_main_region_clear(scene, v3d, ar); @@ -3985,7 +3985,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, wmWindowManager *wm = CTX_wm_manager(C); RegionView3D *rv3d = ar->regiondata; rcti rect; - + /* local coordinate visible rect inside region, to accomodate overlapping ui */ ED_region_visible_rect(ar, &rect); @@ -4070,20 +4070,20 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar) /* draw viewport using opengl */ if (v3d->drawtype != OB_RENDER || !view3d_main_region_do_render_draw(scene) || clip_border) { view3d_main_region_draw_objects(C, scene, v3d, ar, &grid_unit); - + #ifdef DEBUG_DRAW bl_debug_draw(); #endif if (G.debug & G_DEBUG_SIMDATA) draw_sim_debug_data(scene, v3d, ar); - + ED_region_pixelspace(ar); } /* draw viewport using external renderer */ if (v3d->drawtype == OB_RENDER) view3d_main_region_draw_engine(C, scene, ar, v3d, clip_border, &border_rect); - + view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border); v3d->flag |= V3D_INVALID_BACKBUF; |