diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2014-12-09 17:51:14 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2014-12-09 17:51:14 +0300 |
commit | ff755f93eb86e3f7f6801918457ca77a3001671b (patch) | |
tree | 58d6def002b427db665a504f08d25eae335bd9d9 /scene/3d | |
parent | d45be7d9f43046365fcfbf97420f9eca636c51e7 (diff) | |
parent | be4e40e90a5a322f6a7cec4893854ef5b15db600 (diff) |
Merge branch 'master' of http://github.com/okamstudio/godot
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/area.cpp | 18 | ||||
-rw-r--r-- | scene/3d/area.h | 1 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/light.cpp | 4 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 10 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 8 |
6 files changed, 37 insertions, 6 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index cb1df78fda..9cdd24d102 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -115,6 +115,7 @@ void Area::_body_enter_tree(ObjectID p_id) { void Area::_body_exit_tree(ObjectID p_id) { + Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_FAIL_COND(!node); @@ -132,6 +133,7 @@ void Area::_body_exit_tree(ObjectID p_id) { void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape) { + bool body_in = p_status==PhysicsServer::AREA_BODY_ADDED; ObjectID objid=p_instance; @@ -142,6 +144,8 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod ERR_FAIL_COND(!body_in && !E); + locked=true; + if (body_in) { if (!E) { @@ -197,11 +201,19 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod } + locked=false; + + } void Area::_clear_monitoring() { + if (locked) { + ERR_EXPLAIN("This function can't be used during the in/out signal."); + } + ERR_FAIL_COND(locked); + Map<ObjectID,BodyState> bmcopy = body_map; body_map.clear(); //disconnect all monitored stuff @@ -235,6 +247,11 @@ void Area::_notification(int p_what) { void Area::set_enable_monitoring(bool p_enable) { + if (locked) { + ERR_EXPLAIN("This function can't be used during the in/out signal."); + } + ERR_FAIL_COND(locked); + if (p_enable==monitoring) return; @@ -325,6 +342,7 @@ Area::Area() : CollisionObject(PhysicsServer::get_singleton()->area_create(),tru space_override=SPACE_OVERRIDE_DISABLED; set_gravity(9.8);; + locked=false; set_gravity_vector(Vector3(0,-1,0)); gravity_is_point=false; density=0.1; diff --git a/scene/3d/area.h b/scene/3d/area.h index 4707b73e1c..40c6d24b5c 100644 --- a/scene/3d/area.h +++ b/scene/3d/area.h @@ -52,6 +52,7 @@ private: real_t density; int priority; bool monitoring; + bool locked; void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 933f270475..1db9886261 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -529,6 +529,8 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const { } + + Vector3 ray; ray.x = pos.x * (hsize) - hsize/2; ray.y = (1.0 - pos.y) * (vsize) - vsize/2; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 9d959cb0d6..15e77e5378 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -415,11 +415,11 @@ void Light::approximate_opengl_attenuation(float p_constant, float p_linear, flo float energy=1.0; - if (p_constant>0) + /*if (p_constant>0) energy=1.0/p_constant; //energy is this else energy=8.0; // some high number.. - +*/ if (radius==10000) radius=100; //bug? diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index a6a8919d13..77f2cf5cc1 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -275,6 +275,9 @@ void SpriteBase3D::_bind_methods() { BIND_CONSTANT( ALPHA_CUT_DISABLED ); BIND_CONSTANT( ALPHA_CUT_DISCARD ); BIND_CONSTANT( ALPHA_CUT_OPAQUE_PREPASS ); + + + } @@ -494,6 +497,8 @@ void Sprite3D::set_frame(int p_frame) { frame=p_frame; _queue_update(); + ADD_SIGNAL(MethodInfo("frame_changed")); + } int Sprite3D::get_frame() const { @@ -579,6 +584,8 @@ void Sprite3D::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::BOOL, "region"), _SCS("set_region"),_SCS("is_region")); ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); + ADD_SIGNAL(MethodInfo("frame_changed")); + } Sprite3D::Sprite3D() { @@ -722,6 +729,8 @@ void AnimatedSprite3D::_bind_methods(){ ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); ADD_PROPERTY( PropertyInfo( Variant::INT, "frame"), _SCS("set_frame"),_SCS("get_frame")); + ADD_SIGNAL(MethodInfo("frame_changed")); + } @@ -764,6 +773,7 @@ void AnimatedSprite3D::set_frame(int p_frame){ frame=p_frame; _queue_update(); + emit_signal(SceneStringNames::get_singleton()->frame_changed); } int AnimatedSprite3D::get_frame() const{ diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 5b40a4d7e5..a82c69e67f 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -359,13 +359,13 @@ void GeometryInstance::_bind_methods() { GeometryInstance::GeometryInstance() { draw_begin=0; draw_end=0; + for(int i=0;i<FLAG_MAX;i++) { + flags[i]=false; + } + flags[FLAG_VISIBLE]=true; flags[FLAG_CAST_SHADOW]=true; flags[FLAG_RECEIVE_SHADOWS]=true; - flags[FLAG_BILLBOARD]=false; - flags[FLAG_BILLBOARD_FIX_Y]=false; - flags[FLAG_DEPH_SCALE]=false; - flags[FLAG_VISIBLE_IN_ALL_ROOMS]=false; baked_light_instance=NULL; baked_light_texture_id=0; VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); |