diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 14:20:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 14:20:58 +0300 |
commit | 5c8f8a74030c96e07a0ce719f37ed7958b6c3fb8 (patch) | |
tree | 6ef48627addb8acf00f2cff7cde50592dd730d98 /source/blender | |
parent | 04ec64b251f155581b6bd2a6bc0d55c4381ba12d (diff) | |
parent | 3dde6360ff6ae002002472f7b5a155e3d119230f (diff) |
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c | 18 | ||||
-rw-r--r-- | source/blender/gpu/GPU_matrix.h | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_matrix.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_subwindow.c | 7 |
6 files changed, 48 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 91adbf2301d..f35aebbae16 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -2432,6 +2432,11 @@ static void update_flowsfluids(struct Depsgraph *depsgraph, int subframes = mfs->subframes; EmissionMap *em = &emaps[flow_index]; + /* Optimization: Skip flow objects with disabled inflow flag. */ + if (mfs->behavior == FLUID_FLOW_BEHAVIOR_INFLOW && + (mfs->flags & FLUID_FLOW_USE_INFLOW) == 0) { + continue; + } /* Optimization: No need to compute emission value if it won't be applied. */ if (mfs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY && !is_first_frame) { continue; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 31cbd2a3831..0250900759f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1736,7 +1736,7 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec /* sphere color */ float diffuse[3] = {1.0f, 1.0f, 1.0f}; float light[3]; - float size; + const float size = 0.5f * min_ff(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* backdrop */ UI_draw_roundbox_corner_set(UI_CNR_ALL); @@ -1752,11 +1752,10 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec /* transform to button */ GPU_matrix_push(); - if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect)) { - size = 0.5f * BLI_rcti_size_x(rect); - } - else { - size = 0.5f * BLI_rcti_size_y(rect); + bool use_project_matrix = (size >= -GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT); + if (use_project_matrix) { + GPU_matrix_push_projection(); + GPU_matrix_ortho_set_z(-size, size); } GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), @@ -1784,6 +1783,10 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec GPU_blend(false); GPU_line_smooth(false); + if (use_project_matrix) { + GPU_matrix_pop_projection(); + } + /* matrix after circle */ GPU_matrix_pop(); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 75ab6518a4f..e86aaccf848 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -197,6 +197,7 @@ static void axis_geom_draw(const wmGizmo *gz, const bool select, const struct AxisDrawInfo *draw_info) { + GPU_line_width(gz->line_width); GPUVertFormat *format = immVertexFormat(); @@ -239,6 +240,7 @@ static void axis_geom_draw(const wmGizmo *gz, static float axis_color[3][4]; const float axis_depth_bias = 0.01f; + const float sphere_scale = 1.15f; #ifdef USE_AXIS_FONT struct { @@ -268,6 +270,13 @@ static void axis_geom_draw(const wmGizmo *gz, /* When the cursor is over any of the gizmos (show circle backdrop). */ const bool is_active = (color[3] != 0.0f); + const float clip_range = gz->scale_final * sphere_scale; + bool use_project_matrix = (clip_range >= -GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT); + if (use_project_matrix) { + GPU_matrix_push_projection(); + GPU_matrix_ortho_set_z(-clip_range, clip_range); + } + /* Circle defining active area. */ if (is_active) { immUniformColor4fv(color); @@ -364,11 +373,10 @@ static void axis_geom_draw(const wmGizmo *gz, * they use a faded color which can be similar to the circle backdrop in tone. */ if (is_active && !is_highlight && !is_pos && !select && !(axis_align == axis)) { static const float axis_black_faded[4] = {0, 0, 0, 0.2f}; - const float scale = 1.15f; - GPU_matrix_scale_1f(scale); + GPU_matrix_scale_1f(sphere_scale); GPU_batch_uniform_4fv(sphere, "color", axis_black_faded); GPU_batch_draw(sphere); - GPU_matrix_scale_1f(1.0 / scale); + GPU_matrix_scale_1f(1.0 / sphere_scale); } GPU_batch_uniform_4fv(sphere, "color", is_pos_color ? color_current : color_current_fade); @@ -407,6 +415,10 @@ static void axis_geom_draw(const wmGizmo *gz, GPU_matrix_pop(); immUnbindProgram(); + + if (use_project_matrix) { + GPU_matrix_pop_projection(); + } } static void axis3d_draw_intern(const bContext *C, diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h index a424f3180de..2899fba46e4 100644 --- a/source/blender/gpu/GPU_matrix.h +++ b/source/blender/gpu/GPU_matrix.h @@ -90,6 +90,8 @@ void GPU_matrix_identity_projection_set(void); void GPU_matrix_projection_set(const float m[4][4]); void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far); +void GPU_matrix_ortho_set_z(float near, float far); + void GPU_matrix_frustum_set( float left, float right, float bottom, float top, float near, float far); void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far); @@ -222,4 +224,9 @@ int GPU_matrix_stack_level_get_projection(void); # define GPU_matrix_normal_inverse_get(x) GPU_matrix_normal_inverse_get(_GPU_MAT3_CAST(x)) #endif /* SUPPRESS_GENERIC_MATRIX_API */ +/* Not part of the GPU_matrix API, + * however we need to check these limits in code that calls into these API's. */ +#define GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT (-100) +#define GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT (100) + #endif /* __GPU_MATRIX_H__ */ diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c index 5e44a950ba7..8260e1496ff 100644 --- a/source/blender/gpu/intern/gpu_matrix.c +++ b/source/blender/gpu/intern/gpu_matrix.c @@ -421,6 +421,14 @@ void GPU_matrix_ortho_set(float left, float right, float bottom, float top, floa gpu_matrix_state_active_set_dirty(true); } +void GPU_matrix_ortho_set_z(float near, float far) +{ + CHECKMAT(Projection); + Projection[2][2] = -2.0f / (far - near); + Projection[3][2] = -(far + near) / (far - near); + gpu_matrix_state_active_set_dirty(true); +} + void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top) { Mat4 m; diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 6a5de84ac31..5ef78723a2a 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -108,7 +108,8 @@ void wmOrtho2(float x1, float x2, float y1, float y2) y2 += 1.0f; } - GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100); + GPU_matrix_ortho_set( + x1, x2, y1, y2, GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT, GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT); } static void wmOrtho2_offset(const float x, const float y, const float ofs) @@ -136,6 +137,6 @@ void wmGetProjectionMatrix(float mat[4][4], const rcti *winrct) (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS, - -100, - 100); + GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT, + GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT); } |