Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw.c
| Context not available. | |||||
| /* ********* end custom clipping *********** */ | /* ********* end custom clipping *********** */ | ||||
| void ED_view3d_color_overlay(Scene *scene, View3D *v3d) | |||||
| { | |||||
| if (V3D_IS_WIRECOLOR(scene, v3d)) { | |||||
| cpack(0x0); | |||||
| } | |||||
| else { | |||||
| UI_ThemeColor(TH_VIEW_OVERLAY); | |||||
| } | |||||
| } | |||||
| static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx) | static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx) | ||||
| { | { | ||||
| Context not available. | |||||
| circ((float)co[0], (float)co[1], f10); | circ((float)co[0], (float)co[1], f10); | ||||
| setlinestyle(0); | setlinestyle(0); | ||||
| UI_ThemeColor(TH_VIEW_OVERLAY); | ED_view3d_color_overlay(scene, v3d); | ||||
| sdrawline(co[0] - f20, co[1], co[0] - f5, co[1]); | sdrawline(co[0] - f20, co[1], co[0] - f5, co[1]); | ||||
| sdrawline(co[0] + f5, co[1], co[0] + f20, co[1]); | sdrawline(co[0] + f5, co[1], co[0] + f20, co[1]); | ||||
| sdrawline(co[0], co[1] - f20, co[0], co[1] - f5); | sdrawline(co[0], co[1] - f20, co[0], co[1] - f5); | ||||
| Context not available. | |||||
| glRectf(x1i - 1, y1i - 1, x2i + 1, y2i + 1); | glRectf(x1i - 1, y1i - 1, x2i + 1, y2i + 1); | ||||
| } | } | ||||
| UI_ThemeColor(TH_VIEW_OVERLAY); | ED_view3d_color_overlay(scene, v3d); | ||||
| glRectf(x1i, y1i, x2i, y2i); | glRectf(x1i, y1i, x2i, y2i); | ||||
| /* border */ | /* border */ | ||||
| Context not available. | |||||
| static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int color) | static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int color) | ||||
| { | { | ||||
| const bool is_wire_color = V3D_IS_WIRECOLOR(scene, v3d); | |||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| ListBase *lb; | ListBase *lb; | ||||
| LodLevel *savedlod; | LodLevel *savedlod; | ||||
| Context not available. | |||||
| else | else | ||||
| tbase.object->transflag &= ~OB_NEG_SCALE; | tbase.object->transflag &= ~OB_NEG_SCALE; | ||||
| UI_ThemeColorBlend(color, TH_BACK, 0.5); | if (is_wire_color) { | ||||
| glColor3fv(base->object->col); | |||||
| } | |||||
| else { | |||||
| UI_ThemeColorBlend(color, TH_BACK, 0.5); | |||||
| } | |||||
| /* generate displist, test for new object */ | /* generate displist, test for new object */ | ||||
| if (dob_prev && dob_prev->ob != dob->ob) { | if (dob_prev && dob_prev->ob != dob->ob) { | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Simple #draw_object wrapper which draws an overlay. | |||||
| */ | |||||
| static void draw_object_highlight(Scene *scene, ARegion *ar, View3D *v3d, Base *base) | |||||
| { | |||||
| char c; | |||||
| BLI_assert(V3D_IS_WIRECOLOR(scene, v3d)); | |||||
| ED_view3d_polygon_offset(ar->regiondata, -1.0); | |||||
| glLineWidth(3.0f); | |||||
| c = (base == scene->basact) ? 200 : 180; | |||||
| glColor4ub(c, c, c, 255); | |||||
| draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR | DRAW_CONSTWIDTH); | |||||
| glLineWidth(1.0f); | |||||
| ED_view3d_polygon_offset(ar->regiondata, 0.0); | |||||
| } | |||||
| /** | /** | ||||
| * Shared by #ED_view3d_draw_offscreen and #view3d_main_area_draw_objects | * Shared by #ED_view3d_draw_offscreen and #view3d_main_area_draw_objects | ||||
| Context not available. | |||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| Base *base; | Base *base; | ||||
| const bool do_camera_frame = !draw_offscreen; | const bool do_camera_frame = !draw_offscreen; | ||||
| const bool is_wire_color = V3D_IS_WIRECOLOR(scene, v3d); | |||||
| if (!draw_offscreen) { | if (!draw_offscreen) { | ||||
| ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); | ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); | ||||
| Context not available. | |||||
| view3d_draw_clipping(rv3d); | view3d_draw_clipping(rv3d); | ||||
| /* set zbuffer after we draw clipping region */ | /* set zbuffer after we draw clipping region */ | ||||
| if (v3d->drawtype > OB_WIRE) { | if ((v3d->drawtype > OB_WIRE) || is_wire_color) { | ||||
| v3d->zbuf = true; | v3d->zbuf = true; | ||||
| glEnable(GL_DEPTH_TEST); | glEnable(GL_DEPTH_TEST); | ||||
| } | } | ||||
| Context not available. | |||||
| if (base->object->transflag & OB_DUPLI) | if (base->object->transflag & OB_DUPLI) | ||||
| draw_dupli_objects(scene, ar, v3d, base); | draw_dupli_objects(scene, ar, v3d, base); | ||||
| if (is_wire_color) { | |||||
| draw_object_highlight(scene, ar, v3d, base); | |||||
| } | |||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| /* mask out localview */ | /* mask out localview */ | ||||
| v3d->lay_used = lay_used & ((1 << 20) - 1); | v3d->lay_used = lay_used & ((1 << 20) - 1); | ||||
| if (is_wire_color) { | |||||
| glClear(GL_DEPTH_BUFFER_BIT); | |||||
| } | |||||
| /* draw selected and editmode */ | /* draw selected and editmode */ | ||||
| for (base = scene->base.first; base; base = base->next) { | for (base = scene->base.first; base; base = base->next) { | ||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay) { | ||||
| if (base->object == scene->obedit || (base->flag & SELECT)) { | if (base->object == scene->obedit || (base->flag & SELECT)) { | ||||
| if (is_wire_color) { | |||||
| draw_object_highlight(scene, ar, v3d, base); | |||||
| } | |||||
| draw_object(scene, ar, v3d, base, 0); | draw_object(scene, ar, v3d, base, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* must be before xray draw which clears the depth buffer */ | /* must be before xray draw which clears the depth buffer */ | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) { | if (V3D_IS_WIRECOLOR(scene, v3d)) { | ||||
| const float value = 0.18f; | |||||
| glClearColor(value, value, value, 0.0); | |||||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |||||
| } | |||||
| else if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) { | |||||
| glMatrixMode(GL_PROJECTION); | glMatrixMode(GL_PROJECTION); | ||||
| glPushMatrix(); | glPushMatrix(); | ||||
| glLoadIdentity(); | glLoadIdentity(); | ||||
| Context not available. | |||||