summaryrefslogtreecommitdiffstats
path: root/modules/gridmap
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-09-15 01:01:52 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:01:24 +0100
commitdd3682e5feb433117fbf62c363c7ba6ff214f8fa (patch)
treeebe83f2fb472140c4ae267fd5f4a7db7525acbc1 /modules/gridmap
parent6deffa62fbd1e91873afa663630b788b9ffabee3 (diff)
downloadredot-engine-dd3682e5feb433117fbf62c363c7ba6ff214f8fa.tar.gz
Modernized default 3D material, fixes material bugs.
Diffstat (limited to 'modules/gridmap')
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp19
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h8
2 files changed, 14 insertions, 13 deletions
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 7b846569dc..2144ff264f 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1446,8 +1446,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
inner_mat.instance();
inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2));
- inner_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- inner_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ inner_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ inner_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
d[VS::ARRAY_VERTEX] = triangles;
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d);
@@ -1456,13 +1456,14 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
outer_mat.instance();
outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.8));
outer_mat->set_on_top_of_alpha();
- outer_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- outer_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+
+ outer_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ outer_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
selection_floor_mat.instance();
selection_floor_mat->set_albedo(Color(0.80, 0.80, 1.0, 1));
selection_floor_mat->set_on_top_of_alpha();
- selection_floor_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ selection_floor_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
d[VS::ARRAY_VERTEX] = lines;
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_LINES, d);
@@ -1489,10 +1490,10 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
accumulated_floor_delta = 0.0;
indicator_mat.instance();
- indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- indicator_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ indicator_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
+ indicator_mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
+ indicator_mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
indicator_mat->set_albedo(Color(0.8, 0.5, 0.1));
}
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 5e6221b4f0..d6459cee0a 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -125,10 +125,10 @@ class GridMapEditor : public VBoxContainer {
List<ClipboardItem> clipboard_items;
- Ref<SpatialMaterial> indicator_mat;
- Ref<SpatialMaterial> inner_mat;
- Ref<SpatialMaterial> outer_mat;
- Ref<SpatialMaterial> selection_floor_mat;
+ Ref<StandardMaterial3D> indicator_mat;
+ Ref<StandardMaterial3D> inner_mat;
+ Ref<StandardMaterial3D> outer_mat;
+ Ref<StandardMaterial3D> selection_floor_mat;
bool updating;