summaryrefslogtreecommitdiffstats
path: root/scene/3d/visual_instance_3d.h
diff options
context:
space:
mode:
authorFernando Cosentino <fbcosentino@yahoo.com.br>2021-09-25 19:40:26 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-01-05 11:47:51 +0100
commitca79373d135634b45518e82edcce15b15d25171c (patch)
tree905939a9f7e2ffcfa424e45845bbe4f9cfe74a51 /scene/3d/visual_instance_3d.h
parent2c7fcdd7f94307a8dbf9436edc3294aaa6f87a88 (diff)
downloadredot-engine-ca79373d135634b45518e82edcce15b15d25171c.tar.gz
Added material_overlay property to MeshInstance3D
Applying overlay materials into multi-surface meshes currently requires adding a next pass material to all the surfaces, which might be cumbersome when the material is to be applied to a range of different geometries. This also makes it not trivial to use AnimationPlayer to control the material in case of visual effects. The material_override property is not an option as it works replacing the active material for the surfaces, not adding a new pass. This commit adds the material_overlay property to GeometryInstance3D (and therefore MeshInstance3D), having the same reach as material_override (that is, all surfaces) but adding a new material pass on top of the active materials, instead of replacing them.
Diffstat (limited to 'scene/3d/visual_instance_3d.h')
-rw-r--r--scene/3d/visual_instance_3d.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index b08f54b3ec..dd0eb25001 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -110,6 +110,7 @@ public:
private:
ShadowCastingSetting shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
Ref<Material> material_override;
+ Ref<Material> material_overlay;
float visibility_range_begin = 0.0;
float visibility_range_end = 0.0;
@@ -164,6 +165,9 @@ public:
void set_material_override(const Ref<Material> &p_material);
Ref<Material> get_material_override() const;
+ void set_material_overlay(const Ref<Material> &p_material);
+ Ref<Material> get_material_overlay() const;
+
void set_extra_cull_margin(float p_margin);
float get_extra_cull_margin() const;