Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-09-22 14:50:05 +0300
committerJeroen Bakker <jeroen@blender.org>2021-09-22 14:50:05 +0300
commit7633548d60ccba95005efee41e836f90d0379f79 (patch)
tree77485e97d7f1f20f39858a449872132f5b73be12 /source/blender
parent2884ae971ab56301fbddb053802ff947f934bf7c (diff)
Revert "Make knife drawing anti aliased (Monkey work based on D11333)"
This reverts commit 96027b2d15b73d2b5086899425021ea4c903fa00. The patch asserts on different occasions and needs more work.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c48
1 files changed, 9 insertions, 39 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 090754a2353..3e3593d18fd 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -29,8 +29,6 @@
#include "MEM_guardedalloc.h"
-#include "DNA_userdef_types.h"
-
#include "BLI_alloca.h"
#include "BLI_array.h"
#include "BLI_linklist.h"
@@ -325,13 +323,10 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
}
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
-
- float viewport[4];
- GPU_viewport_size_get_f(viewport);
- immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- immUniform2fv("viewportSize", &viewport[2]);
- immUniform1f("lineWidth", 2 * U.pixelsize);
+ immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
+ immUniformThemeColor3(TH_TRANSFORM);
+ GPU_line_width(2.0);
immBegin(GPU_PRIM_LINES, 2);
immVertex3fv(pos, v1);
@@ -346,7 +341,6 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
{
const KnifeTool_OpData *kcd = arg;
GPU_depth_test(GPU_DEPTH_NONE);
- GPU_blend(GPU_BLEND_ALPHA);
GPU_matrix_push_projection();
GPU_polygon_offset(1.0f, 1.0f);
@@ -361,70 +355,55 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- float viewport[4];
- GPU_viewport_size_get_f(viewport);
+ immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (kcd->mode == MODE_DRAGGING) {
- immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- immUniform2fv("viewportSize", &viewport[2]);
- immUniform1f("lineWidth", 2 * U.pixelsize);
-
immUniformColor3ubv(kcd->colors.line);
+ GPU_line_width(2.0);
immBegin(GPU_PRIM_LINES, 2);
immVertex3fv(pos, kcd->prev.cage);
immVertex3fv(pos, kcd->curr.cage);
immEnd();
- immUnbindProgram();
}
if (kcd->prev.vert) {
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(kcd->colors.point);
GPU_point_size(11 * UI_DPI_FAC);
immBegin(GPU_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
immEnd();
- immUnbindProgram();
}
if (kcd->prev.bmface || kcd->prev.edge) {
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(kcd->colors.curpoint);
GPU_point_size(9 * UI_DPI_FAC);
immBegin(GPU_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
immEnd();
- immUnbindProgram();
}
if (kcd->curr.vert) {
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(kcd->colors.point);
GPU_point_size(11 * UI_DPI_FAC);
immBegin(GPU_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
immEnd();
- immUnbindProgram();
}
else if (kcd->curr.edge) {
- immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- immUniform2fv("viewportSize", &viewport[2]);
- immUniform1f("lineWidth", 2 * U.pixelsize);
immUniformColor3ubv(kcd->colors.edge);
+ GPU_line_width(2.0);
immBegin(GPU_PRIM_LINES, 2);
immVertex3fv(pos, kcd->curr.edge->v1->cageco);
immVertex3fv(pos, kcd->curr.edge->v2->cageco);
immEnd();
- immUnbindProgram();
}
if (kcd->curr.bmface || kcd->curr.edge) {
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(kcd->colors.curpoint);
GPU_point_size(9 * UI_DPI_FAC);
@@ -438,8 +417,6 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
int i, snapped_verts_count, other_verts_count;
float fcol[4];
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- immUniformThemeColor3(TH_TRANSFORM);
GPU_blend(GPU_BLEND_ALPHA);
GPUVertBuf *vert = GPU_vertbuf_create_with_format(format);
@@ -477,19 +454,14 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
GPU_batch_discard(batch);
GPU_blend(GPU_BLEND_NONE);
-
- immEnd();
- immUnbindProgram();
}
if (kcd->totkedge > 0) {
BLI_mempool_iter iter;
KnifeEdge *kfe;
- immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
- immUniform2fv("viewportSize", &viewport[2]);
- immUniform1f("lineWidth", U.pixelsize);
immUniformColor3ubv(kcd->colors.line);
+ GPU_line_width(1.0);
GPUBatch *batch = immBeginBatchAtMost(GPU_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2);
@@ -504,7 +476,6 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
}
immEnd();
- immUnbindProgram();
GPU_batch_draw(batch);
GPU_batch_discard(batch);
@@ -514,7 +485,6 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
BLI_mempool_iter iter;
KnifeVert *kfv;
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(kcd->colors.point);
GPU_point_size(5.0 * UI_DPI_FAC);
@@ -530,18 +500,18 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
}
immEnd();
- immUnbindProgram();
GPU_batch_draw(batch);
GPU_batch_discard(batch);
}
+ immUnbindProgram();
+
GPU_matrix_pop();
GPU_matrix_pop_projection();
/* Reset default */
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
- GPU_blend(GPU_BLEND_NONE);
}
/** \} */