Move the brightness factor for highlighted 3D gizmos to a variable

See
8522ac7711 (r45230326).

(cherry picked from commit 507e9b12a4)
This commit is contained in:
Hugo Locurcio 2020-12-18 16:28:12 +01:00 committed by Rémi Verschelde
parent 9248ee39ca
commit 3addea0057
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 5 deletions

View File

@ -2661,7 +2661,8 @@ void SpatialEditorViewport::_draw() {
break;
}
handle_color.a = 1.0;
handle_color *= Color(1.3, 1.3, 1.3, 1.0);
const float brightness = 1.3;
handle_color *= Color(brightness, brightness, brightness);
VisualServer::get_singleton()->canvas_item_add_line(
ci,
@ -5223,7 +5224,9 @@ void SpatialEditor::_init_indicators() {
gizmo_color[i] = mat;
Ref<SpatialMaterial> mat_hl = mat->duplicate();
mat_hl->set_albedo(Color(col.r * 1.3, col.g * 1.3, col.b * 1.3, 1.0));
const float brightness = 1.3;
const Color albedo = Color(col.r * brightness, col.g * brightness, col.b * brightness);
mat_hl->set_albedo(albedo);
gizmo_color_hl[i] = mat_hl;
Vector3 ivec;
@ -5321,7 +5324,7 @@ void SpatialEditor::_init_indicators() {
surftool->commit(move_plane_gizmo[i]);
Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
plane_mat_hl->set_albedo(Color(col.r * 1.3, col.g * 1.3, col.b * 1.3, 1.0));
plane_mat_hl->set_albedo(albedo);
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
@ -5401,7 +5404,7 @@ void SpatialEditor::_init_indicators() {
rotate_gizmo[i]->surface_set_material(0, rotate_mat);
Ref<ShaderMaterial> rotate_mat_hl = rotate_mat->duplicate();
rotate_mat_hl->set_shader_param("albedo", Color(col.r * 1.3, col.g * 1.3, col.b * 1.3, 1.0));
rotate_mat_hl->set_shader_param("albedo", albedo);
rotate_gizmo_color_hl[i] = rotate_mat_hl;
if (i == 2) { // Rotation white outline
@ -5530,7 +5533,7 @@ void SpatialEditor::_init_indicators() {
surftool->commit(scale_plane_gizmo[i]);
Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
plane_mat_hl->set_albedo(Color(col.r * 1.3, col.g * 1.3, col.b * 1.3, 1.0));
plane_mat_hl->set_albedo(Color(col.r * 1.3, col.g * 1.3, col.b * 1.3));
plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
}