diff options
author | MarianoGNU <marianognu.easyrpg@gmail.com> | 2015-10-17 23:38:33 -0300 |
---|---|---|
committer | MarianoGNU <marianognu.easyrpg@gmail.com> | 2015-10-17 23:38:33 -0300 |
commit | 4452e262539ad9d52a5980305584d897829986d1 (patch) | |
tree | cde7f3bdc36e727a21f55938a131083f84e043a6 /servers | |
parent | 68fb30aaea0acf3ff279831d2d77b2e7129e4b69 (diff) | |
parent | 97f483af0a3e040f73c2df957bd092af2f6c085b (diff) |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics/body_pair_sw.cpp | 1 | ||||
-rw-r--r-- | servers/physics/space_sw.cpp | 6 | ||||
-rw-r--r-- | servers/physics_2d/joints_2d_sw.cpp | 12 | ||||
-rw-r--r-- | servers/physics_2d/joints_2d_sw.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 19 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_wrap_mt.h | 3 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics_2d_server.h | 7 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 9 |
10 files changed, 56 insertions, 9 deletions
diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp index da4c1b48d8..7eab9eb86d 100644 --- a/servers/physics/body_pair_sw.cpp +++ b/servers/physics/body_pair_sw.cpp @@ -194,7 +194,6 @@ bool BodyPairSW::_test_ccd(float p_step,BodySW *p_A, int p_shape_A,const Transfo //cast a segment from support in motion normal, in the same direction of motion by motion length //support is the worst case collision point, so real collision happened before - int a; Vector3 s=p_A->get_shape(p_shape_A)->get_support(p_xform_A.basis.xform(mnormal).normalized()); Vector3 from = p_xform_A.xform(s); Vector3 to = from + motion; diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index d36b004989..ba1c737530 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -34,10 +34,10 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_layer_mask, uint32_t p_type_mask) { - if ((p_object->get_layer_mask()&p_layer_mask)==0) - return false; + if (p_object->get_type()==CollisionObjectSW::TYPE_AREA) + return p_type_mask&PhysicsDirectSpaceState::TYPE_MASK_AREA; - if (p_object->get_type()==CollisionObjectSW::TYPE_AREA && !(p_type_mask&PhysicsDirectSpaceState::TYPE_MASK_AREA)) + if ((p_object->get_layer_mask()&p_layer_mask)==0) return false; BodySW *body = static_cast<BodySW*>(p_object); diff --git a/servers/physics_2d/joints_2d_sw.cpp b/servers/physics_2d/joints_2d_sw.cpp index b4c149e7e0..7c12000084 100644 --- a/servers/physics_2d/joints_2d_sw.cpp +++ b/servers/physics_2d/joints_2d_sw.cpp @@ -279,6 +279,18 @@ void PinJoint2DSW::solve(float p_step){ P += impulse; } +void PinJoint2DSW::set_param(Physics2DServer::PinJointParam p_param, real_t p_value) { + + if(p_param == Physics2DServer::PIN_JOINT_SOFTNESS) + softness = p_value; +} + +real_t PinJoint2DSW::get_param(Physics2DServer::PinJointParam p_param) const { + + if(p_param == Physics2DServer::PIN_JOINT_SOFTNESS) + return softness; + ERR_FAIL_V(0); +} PinJoint2DSW::PinJoint2DSW(const Vector2& p_pos,Body2DSW* p_body_a,Body2DSW* p_body_b) : Joint2DSW(_arr,p_body_b?2:1) { diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h index 2093be88c9..e43f8eee33 100644 --- a/servers/physics_2d/joints_2d_sw.h +++ b/servers/physics_2d/joints_2d_sw.h @@ -121,6 +121,8 @@ public: virtual bool setup(float p_step); virtual void solve(float p_step); + void set_param(Physics2DServer::PinJointParam p_param, real_t p_value); + real_t get_param(Physics2DServer::PinJointParam p_param) const; PinJoint2DSW(const Vector2& p_pos,Body2DSW* p_body_a,Body2DSW* p_body_b=NULL); ~PinJoint2DSW(); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 14b4c09ebc..6a1c790da8 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -1096,6 +1096,25 @@ RID Physics2DServerSW::damped_spring_joint_create(const Vector2& p_anchor_a,cons } +void Physics2DServerSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) { + + Joint2DSW *j = joint_owner.get(p_joint); + ERR_FAIL_COND(!j); + ERR_FAIL_COND(j->get_type()!=JOINT_PIN); + + PinJoint2DSW *pin_joint = static_cast<PinJoint2DSW*>(j); + pin_joint->set_param(p_param, p_value); +} + +real_t Physics2DServerSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const { + Joint2DSW *j = joint_owner.get(p_joint); + ERR_FAIL_COND_V(!j,0); + ERR_FAIL_COND_V(j->get_type()!=JOINT_PIN,0); + + PinJoint2DSW *pin_joint = static_cast<PinJoint2DSW*>(j); + return pin_joint->get_param(p_param); +} + void Physics2DServerSW::damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value) { diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index 605e04ead8..b2c58b788e 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -243,6 +243,8 @@ public: virtual RID pin_joint_create(const Vector2& p_pos,RID p_body_a,RID p_body_b=RID()); virtual RID groove_joint_create(const Vector2& p_a_groove1,const Vector2& p_a_groove2, const Vector2& p_b_anchor, RID p_body_a,RID p_body_b); virtual RID damped_spring_joint_create(const Vector2& p_anchor_a,const Vector2& p_anchor_b,RID p_body_a,RID p_body_b=RID()); + virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value); + virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const; virtual void damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value); virtual real_t damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const; diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 54af3eeb99..60f8a4c879 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -258,6 +258,9 @@ public: FUNC5R(RID,groove_joint_create,const Vector2&,const Vector2&,const Vector2&,RID,RID); FUNC4R(RID,damped_spring_joint_create,const Vector2&,const Vector2&,RID,RID); + FUNC3(pin_joint_set_param,RID,PinJointParam,real_t); + FUNC2RC(real_t,pin_joint_get_param,RID,PinJointParam); + FUNC3(damped_string_joint_set_param,RID,DampedStringParam,real_t); FUNC2RC(real_t,damped_string_joint_get_param,RID,DampedStringParam); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index a71e6c4bf5..9f2f03baec 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -36,8 +36,8 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObject2DSW *p_objec if ((p_object->get_layer_mask()&p_layer_mask)==0) return false; - if (p_object->get_type()==CollisionObject2DSW::TYPE_AREA && !(p_type_mask&Physics2DDirectSpaceState::TYPE_MASK_AREA)) - return false; + if (p_object->get_type()==CollisionObject2DSW::TYPE_AREA) + return p_type_mask&Physics2DDirectSpaceState::TYPE_MASK_AREA; Body2DSW *body = static_cast<Body2DSW*>(p_object); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 2d70337dc8..6845c7dfe1 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -516,6 +516,13 @@ public: virtual RID groove_joint_create(const Vector2& p_a_groove1,const Vector2& p_a_groove2, const Vector2& p_b_anchor, RID p_body_a,RID p_body_b)=0; virtual RID damped_spring_joint_create(const Vector2& p_anchor_a,const Vector2& p_anchor_b,RID p_body_a,RID p_body_b=RID())=0; + enum PinJointParam { + PIN_JOINT_SOFTNESS + }; + + virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value)=0; + virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const=0; + enum DampedStringParam { DAMPED_STRING_REST_LENGTH, DAMPED_STRING_STIFFNESS, diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index fbea60c3a6..01af2d86ad 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -1375,7 +1375,7 @@ void VisualServerRaster::_update_baked_light_sampler_dp_cache(BakedLightSampler void VisualServerRaster::baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution){ - ERR_FAIL_COND(p_resolution<4 && p_resolution>64); + ERR_FAIL_COND(p_resolution<4 || p_resolution>64); VS_CHANGED; BakedLightSampler * blsamp = baked_light_sampler_owner.get(p_baked_light_sampler); ERR_FAIL_COND(!blsamp); @@ -5219,7 +5219,6 @@ void VisualServerRaster::_light_instance_update_lispsm_shadow(Instance *p_light, AABB proj_space_aabb; - float max_d,min_d; { @@ -6824,7 +6823,11 @@ void VisualServerRaster::_render_canvas_item(CanvasItem *p_canvas_item,const Mat copymem(child_items,ci->child_items.ptr(),child_item_count*sizeof(CanvasItem*)); if (ci->clip) { - ci->final_clip_rect=global_rect; + if (p_canvas_clip != NULL) { + ci->final_clip_rect=p_canvas_clip->final_clip_rect.clip(global_rect); + } else { + ci->final_clip_rect=global_rect; + } ci->final_clip_owner=ci; } else { |