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>2020-09-11 08:59:48 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-11 09:08:46 +0300
commitd6525e8d133b787655bdb2c2fcef218591a457c3 (patch)
treeb4dbb06b75005deee918d7816c074a5735be930c /source/blender/draw/engines/overlay/overlay_private.h
parentd023c4104cb642c839d5868411a3b719f3528421 (diff)
Use DrawManager for Image/UV Editor
This project moves the current UV/Image editor drawing to the draw manager. Why would we do this: **Performance**: Current implementation would draw each texel per time. Multiple texels could be drawn per pixel what would overwrite the previous result. You can notice this when working with large textures. Repeat image drawing made this visible by drawing for a small period of time and stop drawing the rest. Now the rendering is fast and all repeated images are drawn. **Alpha drawing**: Current implementation would draw directly in display space. Giving incorrect results when displaying alpha transparent images. This addresses {T52680}, {T74709}, {T79518} The image editor now can show emission only colors. See {D8234} for examples. **Current Limitations** Using images that are larger than supported by your GPU are resized (eg larger than 16000x16000 are resized to 8k). This leaves some blurring artifacts. It is a low priority to add support back of displaying individual pixels of huge images. There is a design task {T80113} with more detail. **Implementation overview** Introduced an Image Engine in the draw module. this engine is responsible for drawing the texture in the main area of the UV/Image editor. The overlay engine has a edit_uv overlay which is responsible to draw the UV's, shadows and overlays specifically for the UV Image editor. The background + checker pattern is drawn by the overlay_background. The patch will allow us to share overlays between the 3d viewport and UV/Image editor more easily. In most cases we just need to switch the `pos` with the `u` attribute in the vertex shader. The project can be activated in the user preferences as experimental features. In a later commit this will be reversed. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D8234
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_private.h')
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index c9d29af91e6..c8b29c6bbbb 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -34,6 +34,9 @@ extern "C" {
# define USE_GEOM_SHADER_WORKAROUND 0
#endif
+/* Needed for eSpaceImage_UVDT_Stretch */
+#include "DNA_space_types.h"
+
typedef struct OVERLAY_FramebufferList {
struct GPUFrameBuffer *overlay_default_fb;
struct GPUFrameBuffer *overlay_line_fb;
@@ -55,6 +58,14 @@ typedef struct OVERLAY_TextureList {
#define NOT_IN_FRONT 0
#define IN_FRONT 1
+typedef enum OVERLAY_UVLineStyle {
+ OVERLAY_UV_LINE_STYLE_OUTLINE = 0,
+ OVERLAY_UV_LINE_STYLE_DASH = 1,
+ OVERLAY_UV_LINE_STYLE_BLACK = 2,
+ OVERLAY_UV_LINE_STYLE_WHITE = 3,
+ OVERLAY_UV_LINE_STYLE_SHADOW = 4,
+} OVERLAY_UVLineStyle;
+
typedef struct OVERLAY_PassList {
DRWPass *antialiasing_ps;
DRWPass *armature_ps[2];
@@ -78,6 +89,11 @@ typedef struct OVERLAY_PassList {
DRWPass *edit_text_overlay_ps;
DRWPass *edit_text_darken_ps;
DRWPass *edit_text_wire_ps[2];
+ DRWPass *edit_uv_edges_ps;
+ DRWPass *edit_uv_verts_ps;
+ DRWPass *edit_uv_faces_ps;
+ DRWPass *edit_uv_stretching_ps;
+ DRWPass *edit_uv_tiled_image_borders_ps;
DRWPass *extra_ps[2];
DRWPass *extra_blend_ps;
DRWPass *extra_centers_ps;
@@ -244,6 +260,12 @@ typedef struct OVERLAY_PrivateData {
DRWShadingGroup *edit_particle_point_grp;
DRWShadingGroup *edit_text_overlay_grp;
DRWShadingGroup *edit_text_wire_grp[2];
+ DRWShadingGroup *edit_uv_verts_grp;
+ DRWShadingGroup *edit_uv_edges_grp;
+ DRWShadingGroup *edit_uv_shadow_edges_grp;
+ DRWShadingGroup *edit_uv_faces_grp;
+ DRWShadingGroup *edit_uv_face_dots_grp;
+ DRWShadingGroup *edit_uv_stretching_grp;
DRWShadingGroup *extra_grid_grp;
DRWShadingGroup *facing_grp[2];
DRWShadingGroup *motion_path_lines_grp;
@@ -286,6 +308,7 @@ typedef struct OVERLAY_PrivateData {
View3DOverlay overlay;
enum eContextObjectMode ctx_mode;
+ bool is_image_editor;
bool clear_in_front;
bool use_in_front;
bool wireframe_mode;
@@ -325,6 +348,29 @@ typedef struct OVERLAY_PrivateData {
int select_mode;
} edit_particle;
struct {
+ bool do_uv_overlay;
+ bool do_uv_shadow_overlay;
+ bool do_uv_stretching_overlay;
+ bool do_tiled_image_overlay;
+
+ bool do_faces;
+ bool do_face_dots;
+
+ float uv_opacity;
+ /* edge drawing */
+ OVERLAY_UVLineStyle line_style;
+ float dash_length;
+ int do_smooth_wire;
+
+ /* stretching overlay */
+ float aspect[2];
+ eSpaceImage_UVDT_Stretch draw_type;
+ ListBase totals;
+ float total_area_ratio;
+ float total_area_ratio_inv;
+
+ } edit_uv;
+ struct {
bool transparent;
bool show_relations;
bool do_pose_xray;
@@ -472,6 +518,11 @@ void OVERLAY_edit_particle_cache_init(OVERLAY_Data *vedata);
void OVERLAY_edit_particle_cache_populate(OVERLAY_Data *vedata, Object *ob);
void OVERLAY_edit_particle_draw(OVERLAY_Data *vedata);
+void OVERLAY_edit_uv_init(OVERLAY_Data *vedata);
+void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata);
+void OVERLAY_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob);
+void OVERLAY_edit_uv_draw(OVERLAY_Data *vedata);
+
void OVERLAY_extra_cache_init(OVERLAY_Data *vedata);
void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob);
void OVERLAY_extra_blend_draw(OVERLAY_Data *vedata);
@@ -570,6 +621,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
void OVERLAY_wireframe_draw(OVERLAY_Data *vedata);
void OVERLAY_wireframe_in_front_draw(OVERLAY_Data *vedata);
+void OVERLAY_shader_library_ensure(void);
GPUShader *OVERLAY_shader_antialiasing(void);
GPUShader *OVERLAY_shader_armature_degrees_of_freedom_wire(void);
GPUShader *OVERLAY_shader_armature_degrees_of_freedom_solid(void);
@@ -599,6 +651,13 @@ GPUShader *OVERLAY_shader_edit_mesh_skin_root(void);
GPUShader *OVERLAY_shader_edit_mesh_vert(void);
GPUShader *OVERLAY_shader_edit_particle_strand(void);
GPUShader *OVERLAY_shader_edit_particle_point(void);
+GPUShader *OVERLAY_shader_edit_uv_edges_get(void);
+GPUShader *OVERLAY_shader_edit_uv_face_get(void);
+GPUShader *OVERLAY_shader_edit_uv_face_dots_get(void);
+GPUShader *OVERLAY_shader_edit_uv_verts_get(void);
+GPUShader *OVERLAY_shader_edit_uv_stretching_area_get(void);
+GPUShader *OVERLAY_shader_edit_uv_stretching_angle_get(void);
+GPUShader *OVERLAY_shader_edit_uv_tiled_image_borders_get(void);
GPUShader *OVERLAY_shader_extra(bool is_select);
GPUShader *OVERLAY_shader_extra_groundline(void);
GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select);
@@ -607,6 +666,7 @@ GPUShader *OVERLAY_shader_extra_point(void);
GPUShader *OVERLAY_shader_facing(void);
GPUShader *OVERLAY_shader_gpencil_canvas(void);
GPUShader *OVERLAY_shader_grid(void);
+GPUShader *OVERLAY_shader_grid_image(void);
GPUShader *OVERLAY_shader_image(void);
GPUShader *OVERLAY_shader_motion_path_line(void);
GPUShader *OVERLAY_shader_motion_path_vert(void);