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:
authorClément Foucault <foucault.clem@gmail.com>2019-02-04 03:13:51 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-02-05 17:02:15 +0300
commit86193d25dbe5470a465dd91655c6aeaabab19b21 (patch)
tree9be350eeb300a08be68c1cdcaf59ea48f5724dcb /source/blender/gpu
parentf3f2602c88d866db6052ed03bbec1c9da4183e57 (diff)
Edit Mesh: Refactor Edit cage drawing to use old style drawing
This is work in progress. Look is not final. This align data VBO data structure used for edti cage drawing to the one use for normal drawing. We no longer use barycentric coords to draw the lines an just rasterize line primitives for edge drawing. This is a bit slower than using the previous fast method but faster than the "correct" (edge artifact free) method. This also make the code way simpler. This also makes it possible to reuse possible and normal vbos used for shading if the edit cage matches the This also touches the UV batch code to share as much render data as possible. The code also prepare for edit cage "modified" drawing cage (with modifier applied) but is not enabled since selection and operators does not work with modified cage yet.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl10
4 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
index 76e9c066103..0fddbddddc5 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
@@ -12,17 +12,19 @@ noperspective out vec4 finalColor;
flat out vec4 finalColor;
#endif
-#define VERTEX_SELECT (1 << 0)
-#define EDGE_SELECT (1 << 4)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define VERT_UV_SELECT (1 << 3)
+#define EDGE_UV_SELECT (1 << 5)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
#ifdef SMOOTH_COLOR
- bool is_select = (flag & VERTEX_SELECT) != 0;
+ bool is_select = (flag & VERT_UV_SELECT) != 0;
#else
- bool is_select = (flag & EDGE_SELECT) != 0;
+ bool is_select = (flag & EDGE_UV_SELECT) != 0;
#endif
finalColor = (is_select) ? selectColor : edgeColor;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
index c5f84b976c5..e0d168e8095 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
@@ -8,10 +8,12 @@ in int flag;
out vec4 finalColor;
-#define FACE_SELECT (1 << 2)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define FACE_UV_SELECT (1 << 7)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
- finalColor = ((flag & FACE_SELECT) != 0) ? selectColor : vertColor;
+ finalColor = ((flag & FACE_UV_SELECT) != 0) ? selectColor : vertColor;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
index 82c8d3f0c4a..1d25c8fe345 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
@@ -9,15 +9,17 @@ in int flag;
flat out vec4 finalColor;
-#define FACE_SELECT (1 << 2)
-#define FACE_ACTIVE (1 << 3)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define FACE_UV_ACTIVE (1 << 6)
+#define FACE_UV_SELECT (1 << 7)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
- bool is_selected = (flag & FACE_SELECT) != 0;
- bool is_active = (flag & FACE_ACTIVE) != 0;
+ bool is_selected = (flag & FACE_UV_SELECT) != 0;
+ bool is_active = (flag & FACE_UV_ACTIVE) != 0;
finalColor = (is_selected) ? selectColor : faceColor;
finalColor = (is_active) ? activeColor : finalColor;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
index 46dd1e066c8..50166bc4e95 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
@@ -13,16 +13,18 @@ out vec4 fillColor;
out vec4 outlineColor;
out vec4 radii;
-#define VERTEX_SELECT (1 << 0)
-#define VERTEX_PINNED (1 << 1)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define VERT_UV_SELECT (1 << 3)
+#define VERT_UV_PINNED (1 << 4)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
gl_PointSize = pointSize;
- bool is_selected = (flag & VERTEX_SELECT) != 0;
- bool is_pinned = (flag & VERTEX_PINNED) != 0;
+ bool is_selected = (flag & VERT_UV_SELECT) != 0;
+ bool is_pinned = (flag & VERT_UV_PINNED) != 0;
vec4 deselect_col = (is_pinned) ? pinnedColor : vertColor;
fillColor = (is_selected) ? selectColor : deselect_col;