diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/SCsub | 2 | ||||
-rw-r--r-- | servers/audio/SCsub | 2 | ||||
-rw-r--r-- | servers/physics/SCsub | 2 | ||||
-rw-r--r-- | servers/physics/joints/SCsub | 2 | ||||
-rw-r--r-- | servers/physics/space_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics/space_sw.h | 1 | ||||
-rw-r--r-- | servers/physics_2d/SCsub | 2 | ||||
-rw-r--r-- | servers/physics_2d/shape_2d_sw.cpp | 14 | ||||
-rw-r--r-- | servers/physics_2d/shape_2d_sw.h | 18 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 19 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.h | 1 | ||||
-rw-r--r-- | servers/spatial_sound/SCsub | 2 | ||||
-rw-r--r-- | servers/spatial_sound_2d/SCsub | 2 | ||||
-rw-r--r-- | servers/visual/SCsub | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 5 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 1 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 1 | ||||
-rw-r--r-- | servers/visual_server.cpp | 4 | ||||
-rw-r--r-- | servers/visual_server.h | 1 |
19 files changed, 57 insertions, 26 deletions
diff --git a/servers/SCsub b/servers/SCsub index d861847101..57b5b36758 100644 --- a/servers/SCsub +++ b/servers/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.servers_sources=[] diff --git a/servers/audio/SCsub b/servers/audio/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/audio/SCsub +++ b/servers/audio/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics/SCsub b/servers/physics/SCsub index 95296eadbe..b527f38ceb 100644 --- a/servers/physics/SCsub +++ b/servers/physics/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics/joints/SCsub b/servers/physics/joints/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/physics/joints/SCsub +++ b/servers/physics/joints/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 7077146420..9755c49e2d 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -721,7 +721,7 @@ SpaceSW::SpaceSW() { constraint_bias = 0.01; body_linear_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_linear",0.1); body_angular_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_angular", (8.0 / 180.0 * Math_PI) ); - body_time_to_sleep=0.5; + body_time_to_sleep=GLOBAL_DEF("physics/time_before_sleep",0.5); body_angular_velocity_damp_ratio=10; diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 3fdef7e62b..29eca2690a 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -37,6 +37,7 @@ #include "area_pair_sw.h" #include "broad_phase_sw.h" #include "collision_object_sw.h" +#include "globals.h" class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState { diff --git a/servers/physics_2d/SCsub b/servers/physics_2d/SCsub index ebb7f8be00..2114782faa 100644 --- a/servers/physics_2d/SCsub +++ b/servers/physics_2d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 9291aa6c17..77245c687d 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -136,7 +136,7 @@ bool LineShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_en return true; } -real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; } @@ -191,7 +191,7 @@ bool RayShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end } -real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; //rays are mass-less } @@ -252,7 +252,7 @@ bool SegmentShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return true; } -real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 s[2]={a*p_scale,b*p_scale}; @@ -336,7 +336,7 @@ bool CircleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_ return true; } -real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return (radius*radius)*(p_scale.x*0.5+p_scale.y*0.5); @@ -407,7 +407,7 @@ bool RectangleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); } -real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Vector2 he2=half_extents*2*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -540,7 +540,7 @@ bool CapsuleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return collided; //todo } -real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 he2=Vector2(radius*2,height+radius*2)*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -670,7 +670,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vect return inters; //todo } -real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Rect2 aabb; aabb.pos=points[0].pos*p_scale; diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index 4164896696..b90c36bc04 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -86,7 +86,7 @@ public: virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const=0; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const=0; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const=0; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const=0; virtual void set_data(const Variant& p_data)=0; virtual Variant get_data() const=0; @@ -175,7 +175,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -218,7 +218,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -266,7 +266,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -304,7 +304,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -344,7 +344,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -432,7 +432,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -495,7 +495,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -584,7 +584,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { return 0; } + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const { return 0; } virtual void set_data(const Variant& p_data); virtual Variant get_data() const; diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index d0dcee7763..56bee8b0c5 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -81,6 +81,9 @@ int Physics2DDirectSpaceStateSW::intersect_point(const Vector2& p_point,ShapeRes if (!shape->contains_point(local_point)) continue; + if (cc>=p_result_max) + continue; + r_results[cc].collider_id=col_obj->get_instance_id(); if (r_results[cc].collider_id!=0) r_results[cc].collider=ObjectDB::get_instance(r_results[cc].collider_id); @@ -1321,14 +1324,14 @@ Space2DSW::Space2DSW() { contact_debug_count=0; locked=false; - contact_recycle_radius=0.01; - contact_max_separation=0.05; - contact_max_allowed_penetration= 0.01; - - constraint_bias = 0.01; - body_linear_velocity_sleep_treshold=0.01; - body_angular_velocity_sleep_treshold=(8.0 / 180.0 * Math_PI); - body_time_to_sleep=0.5; + contact_recycle_radius=1.0; + contact_max_separation=1.5; + contact_max_allowed_penetration= 0.3; + + constraint_bias = 0.2; + body_linear_velocity_sleep_treshold=GLOBAL_DEF("physics_2d/sleep_threashold_linear",2.0); + body_angular_velocity_sleep_treshold=GLOBAL_DEF("physics_2d/sleep_threshold_angular",(8.0 / 180.0 * Math_PI)); + body_time_to_sleep=GLOBAL_DEF("physics_2d/time_before_sleep",0.5); broadphase = BroadPhase2DSW::create_func(); diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index f58e8c3fe7..45a3e4ca8f 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -37,6 +37,7 @@ #include "area_pair_2d_sw.h" #include "broad_phase_2d_sw.h" #include "collision_object_2d_sw.h" +#include "globals.h" class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState { diff --git a/servers/spatial_sound/SCsub b/servers/spatial_sound/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/spatial_sound/SCsub +++ b/servers/spatial_sound/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/spatial_sound_2d/SCsub b/servers/spatial_sound_2d/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/spatial_sound_2d/SCsub +++ b/servers/spatial_sound_2d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/visual/SCsub b/servers/visual/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/visual/SCsub +++ b/servers/visual/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 8d228ad859..1df0aafb23 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -7612,6 +7612,11 @@ void VisualServerRaster::set_default_clear_color(const Color& p_color) { clear_color=p_color; } +Color VisualServerRaster::get_default_clear_color() const { + + return clear_color; +} + void VisualServerRaster::set_boot_image(const Image& p_image, const Color& p_color,bool p_scale) { if (p_image.empty()) diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 496820f4a8..1f22e31ab0 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -1283,6 +1283,7 @@ public: virtual void set_boot_image(const Image& p_image, const Color& p_color, bool p_scale); virtual void set_default_clear_color(const Color& p_color); + virtual Color get_default_clear_color() const; VisualServerRaster(Rasterizer *p_rasterizer); ~VisualServerRaster(); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index b4e374dd6f..f0fe80d100 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -718,6 +718,7 @@ public: FUNC3(set_boot_image,const Image& , const Color&,bool ); FUNC1(set_default_clear_color,const Color& ); + FUNC0RC(Color,get_default_clear_color ); FUNC0R(RID,get_test_cube ); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index f69580254c..6099a86b96 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -382,7 +382,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("mesh_create"),&VisualServer::mesh_create); - ObjectTypeDB::bind_method(_MD("mesh_add_surface"),&VisualServer::mesh_add_surface, DEFVAL(NO_INDEX_ARRAY)); + ObjectTypeDB::bind_method(_MD("mesh_add_surface"),&VisualServer::mesh_add_surface, DEFVAL(Array()), DEFVAL(false)); ObjectTypeDB::bind_method(_MD("mesh_surface_set_material"),&VisualServer::mesh_surface_set_material,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("mesh_surface_get_material"),&VisualServer::mesh_surface_get_material); @@ -531,6 +531,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z); + ObjectTypeDB::bind_method(_MD("canvas_item_set_sort_children_by_y"),&VisualServer::canvas_item_set_sort_children_by_y); ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0), DEFVAL(false)); ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect); @@ -563,6 +564,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free); ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color); + ObjectTypeDB::bind_method(_MD("get_default_clear_color"),&VisualServer::get_default_clear_color); ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info); diff --git a/servers/visual_server.h b/servers/visual_server.h index 2f3d8371f6..844da2d245 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -1181,6 +1181,7 @@ public: virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale)=0; virtual void set_default_clear_color(const Color& p_color)=0; + virtual Color get_default_clear_color() const=0; enum Features { FEATURE_SHADERS, |