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:
authorCampbell Barton <ideasman42@gmail.com>2021-01-20 10:56:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-20 10:56:29 +0300
commit160d8c1ea6cde7282ab9e1b6b01815031d73a2f9 (patch)
tree54b0974c117dee4943de691d75d7f7ce0fb93ea0
parent2c31a84bd1d5cacc9f03409d57b8fcf493f873ba (diff)
parentfad8a753a9d7ff9c1acfd40d82bd1808b83f79e0 (diff)
Merge branch 'blender-v2.92-release'
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 0700b47dbde..3ae09624f0c 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -1989,20 +1989,10 @@ static void cursor_plane_draw(bContext *C, int x, int y, void *customdata)
/* Draw */
float pixel_size;
- /* Arbitrary, 1.0 is a little too strong though. */
- float color_alpha = 0.75f;
-
if (rv3d->is_persp) {
float center[3];
negate_v3_v3(center, rv3d->ofs);
pixel_size = ED_view3d_pixel_size(rv3d, center);
-
- /* Scale down the alpha when this is drawn very small,
- * since the add shader causes the small size to show too dense & bright. */
- const float relative_pixel_scale = pixel_size / ED_view3d_pixel_size(rv3d, plc->matrix[3]);
- if (relative_pixel_scale < 1.0f) {
- color_alpha *= max_ff(square_f(relative_pixel_scale), 0.3f);
- }
}
else {
pixel_size = ED_view3d_pixel_size(rv3d, plc->matrix[3]);
@@ -2010,6 +2000,25 @@ static void cursor_plane_draw(bContext *C, int x, int y, void *customdata)
if (pixel_size > FLT_EPSILON) {
+ /* Arbitrary, 1.0 is a little too strong though. */
+ float color_alpha = 0.75f;
+ if (rv3d->is_persp) {
+ /* Scale down the alpha when this is drawn very small,
+ * since the add shader causes the small size to show too dense & bright. */
+ const float relative_pixel_scale = pixel_size / ED_view3d_pixel_size(rv3d, plc->matrix[3]);
+ if (relative_pixel_scale < 1.0f) {
+ color_alpha *= max_ff(square_f(relative_pixel_scale), 0.3f);
+ }
+ }
+
+ {
+ /* Extra adjustment when it's near view-aligned as it seems overly bright. */
+ float view_vector[3];
+ ED_view3d_global_to_vector(rv3d, plc->matrix[3], view_vector);
+ float view_dot = fabsf(dot_v3v3(plc->matrix[plc->plane_axis], view_vector));
+ color_alpha *= max_ff(0.3f, 1.0f - square_f(square_f(1.0f - view_dot)));
+ }
+
/* Setup viewport & matrix. */
wmViewport(&region->winrct);
GPU_matrix_push_projection();