diff options
Diffstat (limited to 'scene/3d/collision_polygon.cpp')
-rw-r--r-- | scene/3d/collision_polygon.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 2948966fb3..d0612986df 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -56,11 +56,11 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { shape_from=co->get_shape_count(); for(int i=0;i<decomp.size();i++) { Ref<ConvexPolygonShape> convex = memnew( ConvexPolygonShape ); - DVector<Vector3> cp; + PoolVector<Vector3> cp; int cs = decomp[i].size(); cp.resize(cs*2); { - DVector<Vector3>::Write w = cp.write(); + PoolVector<Vector3>::Write w = cp.write(); int idx=0; for(int j=0;j<cs;j++) { @@ -84,16 +84,16 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { #if 0 Ref<ConcavePolygonShape> concave = memnew( ConcavePolygonShape ); - DVector<Vector2> segments; + PoolVector<Vector2> segments; segments.resize(polygon.size()*2); - DVector<Vector2>::Write w=segments.write(); + PoolVector<Vector2>::Write w=segments.write(); for(int i=0;i<polygon.size();i++) { w[(i<<1)+0]=polygon[i]; w[(i<<1)+1]=polygon[(i+1)%polygon.size()]; } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); concave->set_segments(segments); co->add_shape(concave,get_transform()); @@ -200,7 +200,7 @@ void CollisionPolygon::set_polygon(const Vector<Point2>& p_polygon) { Vector3 p1(polygon[i].x,polygon[i].y,depth*0.5); if (i==0) - aabb=AABB(p1,Vector3()); + aabb=Rect3(p1,Vector3()); else aabb.expand_to(p1); @@ -209,9 +209,9 @@ void CollisionPolygon::set_polygon(const Vector<Point2>& p_polygon) { } - if (aabb==AABB()) { + if (aabb==Rect3()) { - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); } else { aabb.pos-=aabb.size*0.3; aabb.size+=aabb.size*0.6; @@ -240,7 +240,7 @@ CollisionPolygon::BuildMode CollisionPolygon::get_build_mode() const{ return build_mode; } -AABB CollisionPolygon::get_item_rect() const { +Rect3 CollisionPolygon::get_item_rect() const { return aabb; } @@ -275,26 +275,26 @@ String CollisionPolygon::get_configuration_warning() const { void CollisionPolygon::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon::_add_to_collision_object); + ClassDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon::_add_to_collision_object); - ObjectTypeDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon::set_build_mode); - ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon::get_build_mode); + ClassDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon::set_build_mode); + ClassDB::bind_method(_MD("get_build_mode"),&CollisionPolygon::get_build_mode); - ObjectTypeDB::bind_method(_MD("set_depth","depth"),&CollisionPolygon::set_depth); - ObjectTypeDB::bind_method(_MD("get_depth"),&CollisionPolygon::get_depth); + ClassDB::bind_method(_MD("set_depth","depth"),&CollisionPolygon::set_depth); + ClassDB::bind_method(_MD("get_depth"),&CollisionPolygon::get_depth); - ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon::set_polygon); - ObjectTypeDB::bind_method(_MD("get_polygon"),&CollisionPolygon::get_polygon); + ClassDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon::set_polygon); + ClassDB::bind_method(_MD("get_polygon"),&CollisionPolygon::get_polygon); - ObjectTypeDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon::_set_shape_range); - ObjectTypeDB::bind_method(_MD("_get_shape_range"),&CollisionPolygon::_get_shape_range); + ClassDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon::_set_shape_range); + ClassDB::bind_method(_MD("_get_shape_range"),&CollisionPolygon::_get_shape_range); - ObjectTypeDB::bind_method(_MD("get_collision_object_first_shape"),&CollisionPolygon::get_collision_object_first_shape); - ObjectTypeDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon::get_collision_object_last_shape); + ClassDB::bind_method(_MD("get_collision_object_first_shape"),&CollisionPolygon::get_collision_object_first_shape); + ClassDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon::get_collision_object_last_shape); ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Triangles"),_SCS("set_build_mode"),_SCS("get_build_mode")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"depth"),_SCS("set_depth"),_SCS("get_depth")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range")); } @@ -304,7 +304,7 @@ CollisionPolygon::CollisionPolygon() { shape_to=-1; can_update_body=false; - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); build_mode=BUILD_SOLIDS; depth=1.0; |