diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-29 20:42:09 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-01 16:14:46 +0300 |
commit | 781995a09c0b52ad2fd073510c2f7dc52383d461 (patch) | |
tree | f821cce3fa5f69435a20e450d709fec37cb95b4a /source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl | |
parent | a5101de6a95647d19821bde9f8d68776ce8881fa (diff) |
Edit UVs: Refactor drawing Edit UV in Image Editor
NOTE: This commit only concern edit UVs and not the "shadow" mesh displayed
when texture painting. This will be address in a future commit.
We now cache the uv mesh in the mesh batch cache and only reupload data on
changes.
Update could be more granular (and a bit faster) but it's not our main
concern ATM.
This should fix problem caused by the IMM api used to draw large meshes.
This makes performance skyrocket compared to previous implementation.
There is still a big CPU bottleneck when not in sync selection mode but it
is not related to the drawing function directly.
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl | 24 |
1 files changed, 24 insertions, 0 deletions
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 new file mode 100644 index 00000000000..82c8d3f0c4a --- /dev/null +++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl @@ -0,0 +1,24 @@ + +uniform mat4 ModelViewProjectionMatrix; +uniform vec4 faceColor; +uniform vec4 selectColor; +uniform vec4 activeColor; + +in vec2 pos; +in int flag; + +flat out vec4 finalColor; + +#define FACE_SELECT (1 << 2) +#define FACE_ACTIVE (1 << 3) + +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; + + finalColor = (is_selected) ? selectColor : faceColor; + finalColor = (is_active) ? activeColor : finalColor; +} |