summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaracen <SaracenOne@gmail.com>2016-03-07 23:00:55 +0000
committerSaracen <SaracenOne@gmail.com>2016-03-07 23:14:14 +0000
commit7fecebd8a8dc12e59c8fd430b9e3dc0069fd48d1 (patch)
tree668b6cc2cc7787711d3384f2308684bf5fc68e44
parent20308c0475acb4678c9b86c7a4f210c1ec7548dc (diff)
Added extra controls to GeometryInstances to control how they should cast shadows: double-sided and shadows only.
Conflicts: servers/visual/visual_server_raster.h
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp13
-rw-r--r--drivers/gles2/rasterizer_gles2.h2
-rw-r--r--scene/3d/visual_instance.cpp42
-rw-r--r--scene/3d/visual_instance.h12
-rw-r--r--servers/visual/rasterizer.h1
-rw-r--r--servers/visual/visual_server_raster.cpp48
-rw-r--r--servers/visual/visual_server_raster.h6
-rw-r--r--servers/visual/visual_server_wrap_mt.h3
-rw-r--r--servers/visual_server.h10
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp14
-rw-r--r--tools/editor/spatial_editor_gizmos.cpp2
11 files changed, 129 insertions, 24 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 7714a5d17a..7740c9054b 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -4781,9 +4781,12 @@ void RasterizerGLES2::_add_geometry( const Geometry* p_geometry, const InstanceD
if (has_blend_alpha || (has_base_alpha && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA))
return; //bye
- if (m->shader_cache && !m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA) {
+ if (!m->shader_cache || (!m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) {
//shader does not use discard and does not write a vertex position, use generic material
- m = shadow_mat_ptr;
+ if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED)
+ m = shadow_mat_double_sided_ptr;
+ else
+ m = shadow_mat_ptr;
if (m->last_pass!=frame) {
if (m->shader.is_valid()) {
@@ -10961,6 +10964,12 @@ void RasterizerGLES2::init() {
shadow_material = material_create(); //empty with nothing
shadow_mat_ptr = material_owner.get(shadow_material);
+
+ // Now create a second shadow material for double-sided shadow instances
+ shadow_material_double_sided = material_create();
+ shadow_mat_double_sided_ptr = material_owner.get(shadow_material_double_sided);
+ shadow_mat_double_sided_ptr->flags[VS::MATERIAL_FLAG_DOUBLE_SIDED] = true;
+
overdraw_material = create_overdraw_debug_material();
copy_shader.set_conditional(CopyShaderGLES2::USE_8BIT_HDR,!use_fp16_fb);
canvas_shader.set_conditional(CanvasShaderGLES2::USE_DEPTH_SHADOWS,read_depth_supported);
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index 0f70ceaa97..2a2f587f11 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -829,7 +829,9 @@ class RasterizerGLES2 : public Rasterizer {
bool fragment_lighting;
RID shadow_material;
+ RID shadow_material_double_sided;
Material *shadow_mat_ptr;
+ Material *shadow_mat_double_sided_ptr;
int max_texture_units;
GLuint base_framebuffer;
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 723b0a9af5..b15226cce3 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -267,6 +267,15 @@ void GeometryInstance::_update_visibility() {
void GeometryInstance::set_flag(Flags p_flag,bool p_value) {
ERR_FAIL_INDEX(p_flag,FLAG_MAX);
+ if (p_flag==FLAG_CAST_SHADOW) {
+ if (p_value == true) {
+ set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
+ }
+ else {
+ set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
+ }
+ }
+
if (flags[p_flag]==p_value)
return;
@@ -294,10 +303,32 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) {
bool GeometryInstance::get_flag(Flags p_flag) const{
ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false);
+
+ if (p_flag == FLAG_CAST_SHADOW) {
+ if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
return flags[p_flag];
}
+void GeometryInstance::set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting) {
+
+ shadow_casting_setting = p_shadow_casting_setting;
+
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (VS::ShadowCastingSetting)p_shadow_casting_setting);
+}
+
+GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_setting() const {
+
+ return shadow_casting_setting;
+}
+
void GeometryInstance::set_baked_light_texture_id(int p_id) {
baked_light_texture_id=p_id;
@@ -330,6 +361,9 @@ void GeometryInstance::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_flag","flag","value"), &GeometryInstance::set_flag);
ObjectTypeDB::bind_method(_MD("get_flag","flag"), &GeometryInstance::get_flag);
+ ObjectTypeDB::bind_method(_MD("set_cast_shadows_setting", "shadow_casting_setting"), &GeometryInstance::set_cast_shadows_setting);
+ ObjectTypeDB::bind_method(_MD("get_cast_shadows_setting"), &GeometryInstance::get_cast_shadows_setting);
+
ObjectTypeDB::bind_method(_MD("set_draw_range_begin","mode"), &GeometryInstance::set_draw_range_begin);
ObjectTypeDB::bind_method(_MD("get_draw_range_begin"), &GeometryInstance::get_draw_range_begin);
@@ -346,7 +380,7 @@ void GeometryInstance::_bind_methods() {
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE);
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "geometry/material_override",PROPERTY_HINT_RESOURCE_TYPE,"Material"), _SCS("set_material_override"), _SCS("get_material_override"));
- ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/cast_shadow"), _SCS("set_flag"), _SCS("get_flag"),FLAG_CAST_SHADOW);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), _SCS("set_cast_shadows_setting"), _SCS("get_cast_shadows_setting"));
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/receive_shadows"), _SCS("set_flag"), _SCS("get_flag"),FLAG_RECEIVE_SHADOWS);
ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_begin",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_begin"), _SCS("get_draw_range_begin"));
ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_end",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_end"), _SCS("get_draw_range_end"));
@@ -369,6 +403,11 @@ void GeometryInstance::_bind_methods() {
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS );
BIND_CONSTANT(FLAG_MAX );
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_ON);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
+
}
GeometryInstance::GeometryInstance() {
@@ -381,6 +420,7 @@ GeometryInstance::GeometryInstance() {
flags[FLAG_VISIBLE]=true;
flags[FLAG_CAST_SHADOW]=true;
flags[FLAG_RECEIVE_SHADOWS]=true;
+ shadow_casting_setting=SHADOW_CASTING_SETTING_ON;
baked_light_instance=NULL;
baked_light_texture_id=0;
extra_cull_margin=0;
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index e49f4fb82f..2b8292261b 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -98,10 +98,17 @@ public:
FLAG_MAX=VS::INSTANCE_FLAG_MAX,
};
+ enum ShadowCastingSetting {
+ SHADOW_CASTING_SETTING_OFF=VS::SHADOW_CASTING_SETTING_OFF,
+ SHADOW_CASTING_SETTING_ON = VS::SHADOW_CASTING_SETTING_ON,
+ SHADOW_CASTING_SETTING_DOUBLE_SIDED=VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED,
+ SHADOW_CASTING_SETTING_SHADOWS_ONLY=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY
+ };
private:
bool flags[FLAG_MAX];
+ ShadowCastingSetting shadow_casting_setting;
Ref<Material> material_override;
float draw_begin;
float draw_end;
@@ -121,6 +128,9 @@ public:
void set_flag(Flags p_flag,bool p_value);
bool get_flag(Flags p_flag) const;
+ void set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting);
+ ShadowCastingSetting get_cast_shadows_setting() const;
+
void set_draw_range_begin(float p_dist);
float get_draw_range_begin() const;
@@ -140,5 +150,7 @@ public:
};
VARIANT_ENUM_CAST( GeometryInstance::Flags );
+VARIANT_ENUM_CAST( GeometryInstance::ShadowCastingSetting );
+
#endif
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index b84e83cb0c..345c8bb32e 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -539,6 +539,7 @@ public:
Vector<RID> light_instances;
Vector<float> morph_values;
BakedLightData *baked_light;
+ VS::ShadowCastingSetting cast_shadows;
Transform *baked_light_octree_xform;
int baked_lightmap_id;
bool mirror :8;
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 3675194325..ec468b5e04 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -2724,7 +2724,12 @@ void VisualServerRaster::instance_geometry_set_flag(RID p_instance,InstanceFlags
} break;
case INSTANCE_FLAG_CAST_SHADOW: {
- instance->cast_shadows=p_enabled;
+ if (p_enabled == true) {
+ instance->data.cast_shadows = SHADOW_CASTING_SETTING_ON;
+ }
+ else {
+ instance->data.cast_shadows = SHADOW_CASTING_SETTING_OFF;
+ }
} break;
case INSTANCE_FLAG_RECEIVE_SHADOWS: {
@@ -2771,7 +2776,12 @@ bool VisualServerRaster::instance_geometry_get_flag(RID p_instance,InstanceFlags
} break;
case INSTANCE_FLAG_CAST_SHADOW: {
- return instance->cast_shadows;
+ if(instance->data.cast_shadows == SHADOW_CASTING_SETTING_OFF) {
+ return false;
+ }
+ else {
+ return true;
+ }
} break;
case INSTANCE_FLAG_RECEIVE_SHADOWS: {
@@ -2795,6 +2805,22 @@ bool VisualServerRaster::instance_geometry_get_flag(RID p_instance,InstanceFlags
return false;
}
+void VisualServerRaster::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) {
+
+ Instance *instance = instance_owner.get( p_instance );
+ ERR_FAIL_COND( !instance );
+
+ instance->data.cast_shadows = p_shadow_casting_setting;
+}
+
+VS::ShadowCastingSetting VisualServerRaster::instance_geometry_get_cast_shadows_setting(RID p_instance) const{
+
+ const Instance *instance = instance_owner.get( p_instance );
+ ERR_FAIL_COND_V( !instance, SHADOW_CASTING_SETTING_OFF );
+
+ return instance->data.cast_shadows;
+}
+
void VisualServerRaster::instance_geometry_set_material_override(RID p_instance, RID p_material) {
@@ -5019,7 +5045,7 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc
float min,max;
Instance *ins=instance_shadow_cull_result[j];
- if (!ins->visible || !ins->cast_shadows)
+ if (!ins->visible || ins->data.cast_shadows == VS::SHADOW_CASTING_SETTING_OFF)
continue;
ins->transformed_aabb.project_range_in_plane(Plane(z_vec,0),min,max);
@@ -5047,7 +5073,7 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc
for (int j=0;j<caster_cull_count;j++) {
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !instance->cast_shadows)
+ if (!instance->visible || instance->data.cast_shadows==VS::SHADOW_CASTING_SETTING_OFF)
continue;
_instance_draw(instance);
}
@@ -5130,7 +5156,7 @@ void VisualServerRaster::_light_instance_update_lispsm_shadow(Instance *p_light,
for(int i=0;i<caster_count;i++) {
Instance *ins = instance_shadow_cull_result[i];
- if (!ins->visible || !ins->cast_shadows)
+ if (!ins->visible || ins->data.cast_shadows == VS::SHADOW_CASTING_SETTING_OFF)
continue;
for(int j=0;j<8;j++) {
@@ -5281,7 +5307,7 @@ void VisualServerRaster::_light_instance_update_lispsm_shadow(Instance *p_light,
Instance *instance = instance_shadow_cull_result[i];
- if (!instance->visible || !instance->cast_shadows)
+ if (!instance->visible || instance->data.cast_shadows == VS::SHADOW_CASTING_SETTING_OFF)
continue;
_instance_draw(instance);
}
@@ -5378,7 +5404,7 @@ void VisualServerRaster::_light_instance_update_lispsm_shadow(Instance *p_light,
for(int i=0;i<caster_count;i++) {
Instance *ins=instance_shadow_cull_result[i];
- if (!ins->visible || !ins->cast_shadows)
+ if (!ins->visible || ins->cast_shadows==VS::SHADOW_CASTING_SETTING_OFF)
continue;
//@TODO optimize using support mapping
@@ -5468,7 +5494,7 @@ void VisualServerRaster::_light_instance_update_lispsm_shadow(Instance *p_light,
Instance *instance = instance_shadow_cull_result[i];
- if (!instance->visible || !instance->cast_shadows)
+ if (!instance->visible || instance->cast_shadows==VS::SHADOW_CASTING_SETTING_OFF)
continue;
_instance_draw(instance);
}
@@ -5516,7 +5542,7 @@ void VisualServerRaster::_light_instance_update_shadow(Instance *p_light,Scenari
for (int i=0;i<cull_count;i++) {
Instance *instance = instance_shadow_cull_result[i];
- if (!instance->visible || !instance->cast_shadows)
+ if (!instance->visible || instance->data.cast_shadows == VS::SHADOW_CASTING_SETTING_OFF)
continue;
_instance_draw(instance);
}
@@ -5557,7 +5583,7 @@ void VisualServerRaster::_light_instance_update_shadow(Instance *p_light,Scenari
for (int j=0;j<cull_count;j++) {
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !instance->cast_shadows)
+ if (!instance->visible || instance->data.cast_shadows == VS::SHADOW_CASTING_SETTING_OFF)
continue;
_instance_draw(instance);
@@ -6511,7 +6537,7 @@ void VisualServerRaster::_render_camera(Viewport *p_viewport,Camera *p_camera, S
}
}
- } else if ((1<<ins->base_type)&INSTANCE_GEOMETRY_MASK && ins->visible) {
+ } else if ((1<<ins->base_type)&INSTANCE_GEOMETRY_MASK && ins->visible && ins->data.cast_shadows!=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) {
bool discarded=false;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 459dc60e81..4456843c79 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -169,7 +169,6 @@ class VisualServerRaster : public VisualServer {
AABB transformed_aabb;
uint32_t object_ID;
bool visible;
- bool cast_shadows;
bool receive_shadows;
bool visible_in_all_rooms;
uint32_t layer_mask;
@@ -300,7 +299,7 @@ class VisualServerRaster : public VisualServer {
update_next=NULL;
update=false;
visible=true;
- cast_shadows=true;
+ data.cast_shadows=SHADOW_CASTING_SETTING_ON;
receive_shadows=true;
data.depth_scale=false;
data.billboard=false;
@@ -1093,6 +1092,9 @@ public:
virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled);
virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const;
+ virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting);
+ virtual VS::ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const;
+
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material);
virtual RID instance_geometry_get_material_override(RID p_instance) const;
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index fb502d8a6e..74630d67ef 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -534,6 +534,9 @@ public:
FUNC3(instance_geometry_set_flag,RID,InstanceFlags ,bool );
FUNC2RC(bool,instance_geometry_get_flag,RID,InstanceFlags );
+ FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting);
+ FUNC1RC(ShadowCastingSetting, instance_geometry_get_cast_shadows_setting, RID);
+
FUNC2(instance_geometry_set_material_override,RID, RID );
FUNC1RC(RID,instance_geometry_get_material_override,RID);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 4841720f41..bf689bd0a6 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -937,9 +937,19 @@ public:
INSTANCE_FLAG_MAX
};
+ enum ShadowCastingSetting {
+ SHADOW_CASTING_SETTING_OFF,
+ SHADOW_CASTING_SETTING_ON,
+ SHADOW_CASTING_SETTING_DOUBLE_SIDED,
+ SHADOW_CASTING_SETTING_SHADOWS_ONLY,
+ };
+
virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled)=0;
virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const=0;
+ virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
+ virtual ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const = 0;
+
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material)=0;
virtual RID instance_geometry_get_material_override(RID p_instance) const=0;
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 1f264a2337..522da24ea6 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -2196,7 +2196,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) {
VS::get_singleton()->instance_set_scenario(move_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false);
//VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true);
- VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_set_layer_mask(move_gizmo_instance[i],layer);
rotate_gizmo_instance[i]=VS::get_singleton()->instance_create();
@@ -2204,7 +2204,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) {
VS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false);
//VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true);
- VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i],layer);
}
@@ -2585,7 +2585,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
si->sp=sp;
si->sbox_instance=VisualServer::get_singleton()->instance_create2(selection_box->get_rid(),sp->get_world()->get_scenario());
- VS::get_singleton()->instance_geometry_set_flag(si->sbox_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF);
RID inst = sp->call("_get_visual_instance_rid");
@@ -3272,8 +3272,8 @@ void SpatialEditor::_init_indicators() {
grid_visible[i]=false;
grid_enable[i]=false;
VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,false);
- VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false);
- VS::get_singleton()->instance_set_layer_mask(grid_instance[i],1<<SpatialEditorViewport::GIZMO_GRID_LAYER);
+ VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(grid_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
+ VS::get_singleton()->instance_set_layer_mask(grid_instance[i], 1 << SpatialEditorViewport::GIZMO_GRID_LAYER);
}
@@ -3294,7 +3294,7 @@ void SpatialEditor::_init_indicators() {
origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_tree()->get_root()->get_world()->get_scenario());
VS::get_singleton()->instance_set_layer_mask(origin_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER);
- VisualServer::get_singleton()->instance_geometry_set_flag(origin_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, VS::SHADOW_CASTING_SETTING_OFF);
@@ -3331,7 +3331,7 @@ void SpatialEditor::_init_indicators() {
cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario());
VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER);
- VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(cursor_instance, VS::SHADOW_CASTING_SETTING_OFF);
}
diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp
index de35672278..d4bc701dad 100644
--- a/tools/editor/spatial_editor_gizmos.cpp
+++ b/tools/editor/spatial_editor_gizmos.cpp
@@ -81,7 +81,7 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) {
VS::get_singleton()->instance_attach_skeleton(instance,skeleton);
if (extra_margin)
VS::get_singleton()->instance_set_extra_visibility_margin(instance,1);
- VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_CAST_SHADOW,false);
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance,VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_RECEIVE_SHADOWS,false);
VS::get_singleton()->instance_set_layer_mask(instance,1<<SpatialEditorViewport::GIZMO_EDIT_LAYER); //gizmos are 26
}