Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw_legacy.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_interface_icons.h" | #include "UI_interface_icons.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "GPU_draw.h" | #include "GPU_draw.h" | ||||
| #include "GPU_framebuffer.h" | #include "GPU_framebuffer.h" | ||||
| #include "GPU_lamp.h" | #include "GPU_lamp.h" | ||||
| #include "GPU_legacy_stubs.h" | |||||
| #include "GPU_material.h" | #include "GPU_material.h" | ||||
| #include "GPU_compositing.h" | #include "GPU_compositing.h" | ||||
| #include "GPU_extensions.h" | #include "GPU_extensions.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "GPU_immediate_util.h" | #include "GPU_immediate_util.h" | ||||
| #include "GPU_select.h" | #include "GPU_select.h" | ||||
| #include "GPU_matrix.h" | #include "GPU_matrix.h" | ||||
| Show All 17 Lines | const unsigned int clipping_index[6][4] = { | ||||
| {7, 3, 2, 6}, | {7, 3, 2, 6}, | ||||
| {1, 5, 6, 2}, | {1, 5, 6, 2}, | ||||
| {7, 4, 0, 3} | {7, 4, 0, 3} | ||||
| }; | }; | ||||
| /* fill in zero alpha for rendering & re-projection [#31530] */ | /* fill in zero alpha for rendering & re-projection [#31530] */ | ||||
| unsigned char col[4]; | unsigned char col[4]; | ||||
| UI_GetThemeColor4ubv(TH_V3D_CLIPPING_BORDER, col); | UI_GetThemeColor4ubv(TH_V3D_CLIPPING_BORDER, col); | ||||
| glColor4ubv(col); | oldColor4ubv(col); | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glEnableClientState(GL_VERTEX_ARRAY); | oldEnableClientState(GL_VERTEX_ARRAY); | ||||
| glVertexPointer(3, GL_FLOAT, 0, bb->vec); | oldVertexPointer(3, GL_FLOAT, 0, bb->vec); | ||||
| glDrawElements(GL_QUADS, sizeof(clipping_index) / sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index); | glDrawElements(GL_QUADS, sizeof(clipping_index) / sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index); | ||||
| glDisableClientState(GL_VERTEX_ARRAY); | oldDisableClientState(GL_VERTEX_ARRAY); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| } | } | ||||
| void ED_view3d_clipping_set(RegionView3D *rv3d) | void ED_view3d_clipping_set(RegionView3D *rv3d) | ||||
| { | { | ||||
| double plane[4]; | double plane[4]; | ||||
| const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6; | const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6; | ||||
| for (unsigned a = 0; a < tot; a++) { | for (unsigned a = 0; a < tot; a++) { | ||||
| copy_v4db_v4fl(plane, rv3d->clip[a]); | copy_v4db_v4fl(plane, rv3d->clip[a]); | ||||
| glClipPlane(GL_CLIP_PLANE0 + a, plane); | oldClipPlane(GL_CLIP_PLANE0 + a, plane); | ||||
| glEnable(GL_CLIP_PLANE0 + a); | glEnable(GL_CLIP_PLANE0 + a); | ||||
| } | } | ||||
| } | } | ||||
| /* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */ | /* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */ | ||||
| void ED_view3d_clipping_disable(void) | void ED_view3d_clipping_disable(void) | ||||
| { | { | ||||
| for (unsigned a = 0; a < 6; a++) { | for (unsigned a = 0; a < 6; a++) { | ||||
| ▲ Show 20 Lines • Show All 860 Lines • ▼ Show 20 Lines | #endif | ||||
| if (is_negative_m4(dob->mat)) | if (is_negative_m4(dob->mat)) | ||||
| tbase.object->transflag |= OB_NEG_SCALE; | tbase.object->transflag |= OB_NEG_SCALE; | ||||
| else | else | ||||
| tbase.object->transflag &= ~OB_NEG_SCALE; | tbase.object->transflag &= ~OB_NEG_SCALE; | ||||
| /* should move outside the loop but possible color is set in draw_object still */ | /* should move outside the loop but possible color is set in draw_object still */ | ||||
| if ((dflag & DRAW_CONSTCOLOR) == 0) { | if ((dflag & DRAW_CONSTCOLOR) == 0) { | ||||
| glColor3ubv(color_rgb); | oldColor3ubv(color_rgb); | ||||
| } | } | ||||
| if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) { | if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) { | ||||
| bb = *bb_tmp; /* must make a copy */ | bb = *bb_tmp; /* must make a copy */ | ||||
| testbb = true; | testbb = true; | ||||
| } | } | ||||
| if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { | if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { | ||||
| ▲ Show 20 Lines • Show All 1,531 Lines • Show Last 20 Lines | |||||