Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_preselect_edgering.c
| Show All 14 Lines | |||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup edmesh | * \ingroup edmesh | ||||
| */ | */ | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_userdef_types.h" | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_stack.h" | #include "BLI_stack.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "GPU_matrix.h" | #include "GPU_matrix.h" | ||||
| #include "GPU_state.h" | #include "GPU_state.h" | ||||
| ▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | |||||
| void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const float matrix[4][4]) | void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const float matrix[4][4]) | ||||
| { | { | ||||
| if ((psel->edges_len == 0) && (psel->verts_len == 0)) { | if ((psel->edges_len == 0) && (psel->verts_len == 0)) { | ||||
| return; | return; | ||||
| } | } | ||||
| GPU_depth_test(GPU_DEPTH_NONE); | GPU_depth_test(GPU_DEPTH_NONE); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | |||||
| GPU_matrix_push(); | GPU_matrix_push(); | ||||
| GPU_matrix_mul(matrix); | GPU_matrix_mul(matrix); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | |||||
| immUniformThemeColor3(TH_GIZMO_PRIMARY); | |||||
| if (psel->edges_len > 0) { | if (psel->edges_len > 0) { | ||||
| float viewport[4]; | |||||
| GPU_viewport_size_get_f(viewport); | |||||
| immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); | |||||
| immUniform2fv("viewportSize", &viewport[2]); | |||||
| immUniformThemeColor3(TH_GIZMO_PRIMARY); | |||||
| immUniform1f("lineWidth", U.pixelsize); | |||||
| immBegin(GPU_PRIM_LINES, psel->edges_len * 2); | immBegin(GPU_PRIM_LINES, psel->edges_len * 2); | ||||
| for (int i = 0; i < psel->edges_len; i++) { | for (int i = 0; i < psel->edges_len; i++) { | ||||
| immVertex3fv(pos, psel->edges[i][0]); | immVertex3fv(pos, psel->edges[i][0]); | ||||
| immVertex3fv(pos, psel->edges[i][1]); | immVertex3fv(pos, psel->edges[i][1]); | ||||
| } | } | ||||
| immEnd(); | immEnd(); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| if (psel->verts_len > 0) { | if (psel->verts_len > 0) { | ||||
| GPU_point_size(3.0f); | GPU_program_point_size(true); | ||||
| immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); | |||||
| immUniformThemeColor3(TH_GIZMO_PRIMARY); | |||||
| /* Same size as an edit mode vertex */ | |||||
| immUniform1f("size", | |||||
| 2.0 * U.pixelsize * | |||||
| (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f))); | |||||
| immBegin(GPU_PRIM_POINTS, psel->verts_len); | immBegin(GPU_PRIM_POINTS, psel->verts_len); | ||||
| for (int i = 0; i < psel->verts_len; i++) { | for (int i = 0; i < psel->verts_len; i++) { | ||||
| immVertex3fv(pos, psel->verts[i]); | immVertex3fv(pos, psel->verts[i]); | ||||
| } | } | ||||
| immEnd(); | immEnd(); | ||||
| } | |||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_program_point_size(false); | |||||
| } | |||||
| GPU_matrix_pop(); | GPU_matrix_pop(); | ||||
| /* Reset default */ | /* Reset default */ | ||||
| GPU_depth_test(GPU_DEPTH_LESS_EQUAL); | GPU_depth_test(GPU_DEPTH_LESS_EQUAL); | ||||
| GPU_blend(GPU_BLEND_NONE); | |||||
| } | } | ||||
| static void view3d_preselect_mesh_edgering_update_verts_from_edge( | static void view3d_preselect_mesh_edgering_update_verts_from_edge( | ||||
| struct EditMesh_PreSelEdgeRing *psel, | struct EditMesh_PreSelEdgeRing *psel, | ||||
| BMesh *UNUSED(bm), | BMesh *UNUSED(bm), | ||||
| BMEdge *eed_start, | BMEdge *eed_start, | ||||
| int previewlines, | int previewlines, | ||||
| const float (*coords)[3]) | const float (*coords)[3]) | ||||
| ▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines | |||||