diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-03-02 00:54:10 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-03-02 00:54:43 -0300 |
commit | a1f715a4da71fbc2b7d6fad68624bf8b22c6da17 (patch) | |
tree | 5cd305c8f8858504f0b5efb804b2c291b1dc5089 /scene/3d/visual_instance.cpp | |
parent | 0e732637d07d908daf64526f222e71fea402f3db (diff) |
support for 2D shadow casters
Added support for 2D shadow casters.
*DANGER* Shaders in CanvasItem CHANGED, if you are using shader in a
CanvasItem and pull this, you will lose them. Shaders now work through a
2D material system similar to 3D. If you don't want to lose the 2D
shader code, save the shader as a .shd, then create a material in
CanvasItem and re-assign the shader.
Diffstat (limited to 'scene/3d/visual_instance.cpp')
-rw-r--r-- | scene/3d/visual_instance.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index a82c69e67f..45c7fa912c 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -310,6 +310,17 @@ int GeometryInstance::get_baked_light_texture_id() const{ return baked_light_texture_id; } +void GeometryInstance::set_extra_cull_margin(float p_margin) { + + ERR_FAIL_COND(p_margin<0); + extra_cull_margin=p_margin; + VS::get_singleton()->instance_set_extra_visibility_margin(get_instance(),extra_cull_margin); +} + +float GeometryInstance::get_extra_cull_margin() const{ + + return extra_cull_margin; +} void GeometryInstance::_bind_methods() { @@ -328,6 +339,9 @@ void GeometryInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_baked_light_texture_id","id"), &GeometryInstance::set_baked_light_texture_id); ObjectTypeDB::bind_method(_MD("get_baked_light_texture_id"), &GeometryInstance::get_baked_light_texture_id); + ObjectTypeDB::bind_method(_MD("set_extra_cull_margin","margin"), &GeometryInstance::set_extra_cull_margin); + ObjectTypeDB::bind_method(_MD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); + ObjectTypeDB::bind_method(_MD("_baked_light_changed"), &GeometryInstance::_baked_light_changed); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE); @@ -336,6 +350,7 @@ void GeometryInstance::_bind_methods() { 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")); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "geometry/extra_cull_margin",PROPERTY_HINT_RANGE,"0,16384,0"), _SCS("set_extra_cull_margin"), _SCS("get_extra_cull_margin")); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard_y"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD_FIX_Y); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/depth_scale"), _SCS("set_flag"), _SCS("get_flag"),FLAG_DEPH_SCALE); |