summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-01 12:56:52 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-01 13:01:08 -0300
commit8f30c52a3751586edab6d7482425075aef8de6e3 (patch)
treece113d16f4e1a6da82e08ac5a9eaaa99c26dae0b /servers
parent6e9e25b41d33745f65910fa077c9049ddccb3445 (diff)
Removed ontop property, added a material rendering priority system. Fixes #9935, closes #10135
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h1
-rw-r--r--servers/visual/shader_types.cpp3
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual/visual_server_scene.cpp2
-rw-r--r--servers/visual/visual_server_wrap_mt.h1
-rw-r--r--servers/visual_server.h7
6 files changed, 13 insertions, 2 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 9e4acac25d..187a0b180b 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -213,6 +213,7 @@ public:
virtual RID material_create() = 0;
+ virtual void material_set_render_priority(RID p_material, int priority) = 0;
virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
virtual RID material_get_shader(RID p_shader_material) const = 0;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index d8d1b1c1b1..ef0d063f83 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -128,12 +128,13 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_never");
shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_alpha_prepass");
+ shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_test_disable");
+
shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_front");
shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_back");
shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disabled");
shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded");
- shader_modes[VS::SHADER_SPATIAL].modes.insert("ontop");
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_lambert");
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_half_lambert");
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 774b692a22..3953bc5f48 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -690,6 +690,7 @@ public:
BIND3(material_set_param, RID, const StringName &, const Variant &)
BIND2RC(Variant, material_get_param, RID, const StringName &)
+ BIND2(material_set_render_priority, RID, int)
BIND2(material_set_line_width, RID, float)
BIND2(material_set_next_pass, RID, RID)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index cd68c14de8..2a6cba453c 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1434,7 +1434,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
}
ins->depth = near_plane.distance_to(ins->transform.origin);
- ins->depth_layer = CLAMP(int(ins->depth * 8 / z_far), 0, 7);
+ ins->depth_layer = CLAMP(int(ins->depth * 16 / z_far), 0, 15);
}
if (!keep) {
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 7143178b04..f24049be92 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -128,6 +128,7 @@ public:
FUNC3(material_set_param, RID, const StringName &, const Variant &)
FUNC2RC(Variant, material_get_param, RID, const StringName &)
+ FUNC2(material_set_render_priority, RID, int)
FUNC2(material_set_line_width, RID, float)
FUNC2(material_set_next_pass, RID, RID)
diff --git a/servers/visual_server.h b/servers/visual_server.h
index acf5675aa5..45eaeeea25 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -166,6 +166,11 @@ public:
/* COMMON MATERIAL API */
+ enum {
+ MATERIAL_RENDER_PRIORITY_MIN = -128,
+ MATERIAL_RENDER_PRIORITY_MAX = 127,
+
+ };
virtual RID material_create() = 0;
virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
@@ -174,6 +179,8 @@ public:
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
+ virtual void material_set_render_priority(RID p_material, int priority) = 0;
+
virtual void material_set_line_width(RID p_material, float p_width) = 0;
virtual void material_set_next_pass(RID p_material, RID p_next_material) = 0;