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. | |||||
| Scene *scene, ARegion *ar, View3D *v3d, Base *base, | Scene *scene, ARegion *ar, View3D *v3d, Base *base, | ||||
| const short dflag, const int color) | const short dflag, const int color) | ||||
| { | { | ||||
| const bool is_wire_color = (dflag & DRAW_CONSTCOLOR) ? V3D_IS_WIRECOLOR(scene, v3d) : false; | |||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| ListBase *lb; | ListBase *lb; | ||||
| LodLevel *savedlod; | LodLevel *savedlod; | ||||
| Context not available. | |||||
| BLI_assert(color == TH_UNDEFINED); | BLI_assert(color == TH_UNDEFINED); | ||||
| } | } | ||||
| else { | else { | ||||
| UI_GetThemeColorBlend3ubv(color, TH_BACK, 0.5f, color_rgb); | if (is_wire_color) { | ||||
| copy_v3_v3_char((char *)color_rgb, (char *)base->object->draw_color); | |||||
| } | |||||
| else { | |||||
| UI_GetThemeColorBlend3ubv(color, TH_BACK, 0.5f, color_rgb); | |||||
| } | |||||
| } | } | ||||
| tbase.flag = OB_FROMDUPLI | base->flag; | tbase.flag = OB_FROMDUPLI | base->flag; | ||||
| Context not available. | |||||
| glDeleteLists(displist, 1); | glDeleteLists(displist, 1); | ||||
| } | } | ||||
| static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *base) | static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const bool is_wire_color) | ||||
| { | { | ||||
| /* define the color here so draw_dupli_objects_color can be called | /* define the color here so draw_dupli_objects_color can be called | ||||
| * from the set loop */ | * from the set loop */ | ||||
| short dflag; | |||||
| int color = (base->flag & SELECT) ? TH_SELECT : TH_WIRE; | int color; | ||||
| /* debug */ | |||||
| if (base->object->dup_group && base->object->dup_group->id.us < 1) | if (is_wire_color) { | ||||
| color = TH_REDALERT; | glColor3ubv(base->object->draw_color); | ||||
| color = TH_UNDEFINED; | |||||
| draw_dupli_objects_color(scene, ar, v3d, base, 0, color); | dflag = DRAW_CONSTCOLOR; | ||||
| } | |||||
| else { | |||||
| color = (base->flag & SELECT) ? TH_SELECT : TH_WIRE; | |||||
| /* debug */ | |||||
| if (base->object->dup_group && base->object->dup_group->id.us < 1) | |||||
| color = TH_REDALERT; | |||||
| dflag = 0; | |||||
| } | |||||
| draw_dupli_objects_color(scene, ar, v3d, base, dflag, color); | |||||
| } | } | ||||
| /* XXX warning, not using gpu offscreen here */ | /* XXX warning, not using gpu offscreen here */ | ||||
| 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. | |||||
| if (v3d->lay & base->lay) { | if (v3d->lay & base->lay) { | ||||
| /* dupli drawing */ | /* dupli drawing */ | ||||
| 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, is_wire_color); | ||||
| 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. | |||||
| /* dupli drawing */ | /* dupli drawing */ | ||||
| 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, is_wire_color); | ||||
| } | } | ||||
| if ((base->flag & SELECT) == 0) { | if ((base->flag & SELECT) == 0) { | ||||
| if (base->object != scene->obedit) | if (base->object != scene->obedit) | ||||
| 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); | ||||
| } | } | ||||
| } | } | ||||
| 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. | |||||